0

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
Garet Jax
  • 1,091
  • 3
  • 17
  • 37
  • Can you clarify how you are running it in Eclipse? e.g. is it a Dynamic Web Project? Are you building with Maven? etc. – jzheaux Apr 10 '15 at 19:25
  • Josh - I added a PS section to give you the details you requested. – Garet Jax Apr 10 '15 at 20:04
  • The JAR in question was added to Maven's local repository using install:file and the JAR is being added to the JUNIT environment through the Maven Dependencies. – Garet Jax Apr 10 '15 at 20:30
  • [This answer](http://stackoverflow.com/a/4831850) states that your error is caused by a previous failure to initialize the class with the given name. If the error message you see is written to some kind of log, please double-check the log to see if there is a previous failure. That may lead you to the root cause of your problem. – Luke Woodward Apr 10 '15 at 22:12
  • Luke - Thanks for the suggestion. Unfortunately, the class def not found exception is the only one in the logs. :-( – Garet Jax Apr 14 '15 at 13:45

1 Answers1

0

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.

Garet Jax
  • 1,091
  • 3
  • 17
  • 37