7 Replies Latest reply on Sep 21, 2006 10:48 AM by lcurros

    shared jar

      I have an ear packaged like this:
      util.jar
      ejb.jar
      web.war.
      Both, jar and war uses an util.jar. But if i don´t include in
      Now util.jar is packaged too inside war and if i remove it (and put manifest.mf with classpath= util.jar in meta-inf dir of ejb.jar and web.jar), jboss deployed correclty, but doesn´t work. Is there any way to do it?
      I work with jboss 4.0.4 and ejb2

        • 1. Re: shared jar

           

          "lcurros" wrote:
          I have an ear packaged like this:
          util.jar
          ejb.jar
          web.war.

          Now util.jar is packaged too inside war and ejb.jar and if i remove it (and put manifest.mf with classpath= util.jar in meta-inf dir of ejb.jar and web.jar), jboss deployed correclty, but doesn´t work. Is there any way to do it?
          I work with jboss 4.0.4 and ejb2


          • 2. Re: shared jar
            jaikiran

            Package your ear as follows:

            myApp.ear
             |
             |------------ META-INF
             | |---------- application.xml
             |
             |---- util.jar
             |
             |---- ejb.jar
             |
             |---- web.war


            Your application.xml should contain the following:
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
            <application>
            
             <module>
             <java>util.jar</java>
             </module>
            
             <module>
             <web>
             <web-uri>web.war</web-uri>
             <context-root>/myApp</context-root>
             </web>
             </module>
            
             <module>
             <ejb>ejb.jar</ejb>
             </module>
            
            </application>




            • 3. Re: shared jar

              <?xml version="1.0" encoding="UTF-8"?>
              <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">

              <display-name>appname</display-name>

              util.jar


              ejb.jar



              <web-uri>web.war</web-uri>
              <context-root>appname</context-root>





              This is my application.xml, only difference i see is order of modules (i suppose this is not the reason),
              and the doctype declaration which uses diferent dtd. Could be this?

              the error i see is
              ava.lang.LinkageError: Class javax/ejb/EJBHome violates loader constraints: definition mismatch between parent and child loaders

              • 4. Re: shared jar

                Sorry me, this is the correct one

                <?xml version="1.0" encoding="UTF-8"?>
                <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
                
                 <display-name>appname</display-name>
                 <module>
                 <java>util.jar</java>
                 </module>
                 <module>
                 <ejb>ejb.jar</ejb>
                 </module>
                 <module>
                 <web>
                 <web-uri>web.war</web-uri>
                 <context-root>appname</context-root>
                 </web>
                 </module>
                
                </application>


                This is my application.xml, only difference i see is order of modules (i suppose this is not the reason),
                and the doctype declaration which uses diferent dtd. Could be this?

                the error i see is
                java.lang.LinkageError: Class javax/ejb/EJBHome violates loader constraints: definition mismatch between parent and child loaders

                • 5. Re: shared jar
                  jaikiran

                   

                  the error i see is
                  java.lang.LinkageError: Class javax/ejb/EJBHome violates loader constraints: definition mismatch between parent and child loaders


                  Are you packaging jboss-j2ee.jar as part of your ear application? If yes remove that jar from your application.

                  The reason why you are seeing the exception is that the jar containing javax.ejb.EJBHome is found in more than one places in the server classpath

                  • 6. Re: shared jar
                    jaikiran
                    • 7. Re: shared jar

                      Do it and no success ;-(. Apparently jmx-console doesn´t find duplicate instances of class, and jboss-j2ee.jar is not packaged.
                      Is strange, because if i copy util.jar too into war\web-inf\lib works perfectly

                      The line where error is:

                      UserFacadeHome userFacadeHome =
                       (UserFacadeHome) EJBHomeLocator.getEJBHome(
                       userFacadeHomeJNDIName, UserFacadeHome.class);
                      


                      This code is in a class inside war. And EJBHomeLocator.getEJBHome is inside util.jar.