简体   繁体   中英

Maven Eclipse Spring JUNIT java.lang.NoClassDefFoundError: com.filenet.apiimpl.util.J2EEUtil (initialization failure)

This is a weird one. The error only happens when I run through eclipse and Junit. It works fine when I release the identical code to a full blown web container and it works fine when I externalize the code into a stand alone Java application. The error is

java.lang.NoClassDefFoundError: com.filenet.apiimpl.util.J2EEUtil (initialization failure)

The error is reporting that the class can't be initialized, but there is no other detail as to what the J2EEUtil class is dependent on. I am having trouble figuring out how to prove or disprove this.

I have confirmed through verbose class loading that the JAR (Jace.jar) and the class itself are being loaded.

I am also looking for other ideas and thoughts if you believe I have misdiagnosed the problem. Thanks a lot.

PS - I am running it by right clicking on the JUnit testing class and choosing Run As -> JUnit Test. I have included the following annotations at the top of the JUnit test to load Spring artifacts:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/SpringConfig.xml")
@EnableTransactionManagement
@TransactionConfiguration(defaultRollback=true)
@Transactional

OK - I was able to fix the problem. I needed to recreate the project from scratch and kept adding things until I was able to recreate the problem. From there solving it was easy.

I needed to remove the WebSphere Application Server 8.5 Server Runtime from the project's build path. I added it to solve some JAX-RS class references. Of course I needed to resolve those references - I did so by installing the JAX-RS thin client JAR into Maven's local repository and then adding it to the POM.

It still isn't clear to me why I didn't get more information from verbose class loading or from the exception traces. Either way, the problem is solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM