"Could not initialize class" error at runtime

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

Execution of tests or a standalone application terminates with an error message similar to the following:

Could not initialize class com.acme.MyClass$__CLR3_2_02t2thng9gff

or from Maven:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.acme.MyClass$__CLR3_2_02t2thng9gffc

or from JBoss:

org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy to container: ...
Caused by: javax.persistence.PersistenceException: ...
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.hibernate.InstantiationException: could not instantiate test <some test name>
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.acme.MyEntity$__CLR3_1_12b0b0hlfzxawo

 

原因

In 99% of cases this is caused by a fact that clover.jar is missing in runtime. Please keep in mind that it's not enough to have clover.jar during compilation - classes instrumented by Clover needs Clover's core classes from clover.jar during application (or test) execution.

Please have a look at solutions in a related article: NoClassDefFoundError com_atlassian_clover/CoverageRecorder.

参考

 

最終更新日: 2013 年 10 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.