[jboss-user] [Installation, Configuration & DEPLOYMENT] - some question on the classloader

niefeng do-not-reply at jboss.com
Tue Apr 8 05:42:49 EDT 2008


We have migrated from JBOSS4.0.5 GA to JBOSS4.2.2, and we encounter the class loader issue.

We have packaged the java mail.jar in our application archive (due to our application archive can be deployed in different AS, so we include that instead of depending the existing mail.jar in JBOSS\server\default\lib), and we discovered the NoClassDefFoundError.

java.lang.NoClassDefFoundError: javax/mail/Address
  |         at javax.mail.Session.getTransport(Session.java:681)
  |         at javax.mail.Transport.send0(Transport.java:148)
  |         at javax.mail.Transport.send(Transport.java:80)

We didn't have such an issue in JBOSS405. And I have read the following wiki regard the class loader

http://wiki.jboss.org/wiki/JBossClassLoadingUseCases

Our case is fall within use case 4. Below is the jboss-app.xml defined for the application archive

<jboss-app>
  | 	<loader-repository>
  | 		com.test:loader=test.ear
  | 		<loader-repository-config>
  | 			java2ParentDelegation=true
  | 		</loader-repository-config>
  | 	</loader-repository>
  | </jboss-app>

Case 4. The Utility.class is present both in the application's archive AND server/default/lib. The deployment is scoped, but java2ParentDelegation is turned on.

The snippet from the use case 4
What happens if the parent delegation is true and a classloader already loaded the class in the parent repository's class cache? Answer: My scoped application will use the already loaded class from the parent repository's class cache

Based on that, the JBOSS AS will not load the javax/mail/Address within our application archive, it will load from the server/default/lib/mail.jar. However, the javax/mail/Address can't be found in the class path, and throwing the NoClassDefError.

Could I know why JBOSS AS can't locate the javax/mail/Address under server/default/lib although my configuration is fall within the case 4?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142301#4142301

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142301



More information about the jboss-user mailing list