0

I am getting a ClassNotFoundException on the following class:

org.apache.commons.pool.impl.CursorableLinkedList$Cursor.

I have reviewed the web app, which is packaged into an EAR and noticed that there are 2 libraries where the above class exists (CursorableLinkedList).

The JAR files are:

1.) com.ibm.ws.jpa.jar
2.) commons-pool-1.4.jar

The project specific JAR files (i.e. commons-pool-1.4.jar) are packaged in the WAR file, in the lib directory.

Environment

The EAR is being deployed to Websphere Applicatoin Server 8. The IDE I am using is Rational Application Developer 8.

I have set the Application Deployment as follows:

Application:

myApp.EAR

  • Classloader mode: Parent_First
  • WAR classloader policy : MODULE
  • Start weight: 10
  • Auto Start: Yes

myApp.WAR

  • Classloader mode: PARENT_FIRST
  • Start Weight: 10000

With the above settings, I sometimes get the ClassNotFoundException and sometimes I do not. I would like to not get this error anymore because I believe that there would be other errors that could come up later due to improper class loading. Can anyone assist me in setting the proper deployment settings so that libraries that are project specific get loaded first?

Ruepen
  • 411
  • 5
  • 8
  • 19

1 Answers1

0

What happens here is that due to the fact you are using PARENT_FIRST, when WebSphere is looking for a class that is contained it both com.ibm.ws.jpa.jar and commons-pool-1.4.jar it will load it from com.ibm.ws.jpa.jar, I guess there are version mismatches and stuff like that.

My guess is that some classes are loaded from com.ibm.ws.jpa.jar and some (which are not in om.ibm.ws.jpa.jar) are loaded from commons-pool-1.4.jar, then you start having problems.

If you want your jar to be loaded first you need to specify your WAR module to use PARENT_LAST, that way you can make sure the classes will be loaded from your jar and not WebSphere's jar

Aviram Segal
  • 10,962
  • 3
  • 39
  • 52