2 Replies Latest reply on Apr 9, 2008 7:18 AM by jaikiran pai

    some question on the classloader

    nie feng Newbie

      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


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


      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?