3 Replies Latest reply on Feb 18, 2011 3:41 PM by wolfgangknauf

    Jars Conflicting in Jboss 6.0

    nirajchapla

      Hi,

      I am deploying my web-application(WAR) on Jboss 6.0.0 Final. I have two jars in my war’s WEB-INF/lib those are activation.jar & common-annotations.jar. both contains same package i.e., javax.activation. So it is giving run-time error in sending mail through my application. Error trace is :
      java.lang.NoSuchMethodError: com.sun.activation.registries.MailcapFile.getMailcapList(Ljava/lang/String;)Ljava/util/Map;
      at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:545)
      at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:611)
      at javax.activation.DataHandler.writeTo(DataHandler.java:315)
      at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:181)
      at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1055)
      at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:790)
      at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:216)
      at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)
      at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1841)
      at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1822)
      at javax.mail.Transport.send(Transport.java:80)
      I think it is loading class javax.activation.MailcapCommandMap from common-annotations.jar instead of activation.jar & it doesn’t have this method. Removal of jar common-annotations.jar solve this problem, but i need that jar for other function.
      Can i specify jboss to load a class from an activation.jar?
      Thanks in advance

        • 1. Jars Conflicting in Jboss 6.0
          wolfgangknauf

          Hi,

           

          do you have a download link for "common-annotations.jar" so that I could take a look at the content? If you require just a part of it, you might extract it and create a JAR with only the necessary class files,

          By the way: "activation.jar" is bundled with JBoss and can be found here: "jboss-6.0.0.Final\lib\endorsed". So you should not need to bundle it with your own app.

           

          Hope this helps

           

          Wolfgang

          1 of 1 people found this helpful
          • 2. Re: Jars Conflicting in Jboss 6.0
            nirajchapla

            Thanks a lot,

            I can't found any download link for common-annotation.jar that i have. sory for that. common-annotation.jar that i have contains javax.annotation & javax.activation package.

            You are write that activation.jar is in endorsed dir & my application runnig fine without activation.jar, but i m trying to make my war such that it can be run on both jboss & tomcat. So, i m putting it in my war's lib.

             

            Can u describe me the use of endorsed dir. why activation.jar in lib/endorsed dir & why not in common/lib?

             

            I want co make clear from u that in what order classes will be searched, as we have many lib dirs in our jboss like

            <JBOSS_HOME>/lib

            <JBOSS_HOME>/lib/endorsed

            <JBOSS_HOME>/common/lib

            <JBOSS_HOME>/server/<config>/lib

             

            & war's lib.

            I mean if many version of class found from this directories then which one is loaded?

             

            Thanks in advance

            • 3. Re: Jars Conflicting in Jboss 6.0
              wolfgangknauf

              Hi,

               

              sorry, I cannot provide you with much information about technical internals :-(.

               

              A way to work around this issue might be JBoss classloading configuration: http://community.jboss.org/wiki/classloadingconfiguration

              But I never used it myself, so I don't know much more details. And it would be once again a JBoss specific modification to your web app.

               

              Best would be to remove all classes from your app which are bundled with JBoss (remove "activation.jar" and duplicate classes from "common-annotation.jar").

               

              To explain the "endorsed" directory: http://download.oracle.com/javase/1.5.0/docs/guide/standards/index.html

               

              Best regards

               

              Wolfgang