7 Replies Latest reply on Feb 20, 2008 9:45 AM by chandra_88

    EAR deploy fails in JBoss 4.2

    chandra_88

      Hi

      I have a ear with a ejb and a util jar. The util jar contains classes the session bean interface has an parameter which is referenced from the util jar . When i deploy the ejb it complains that it is not able to find the class that was referenced from the jar.

      EAR

      lib
      util.jar
      - TestParam
      meta-inf
      jboss-app.xml
      application.xml

      ejbjar
      Session Bean
      meta-inf
      ejb-jar.xml


      Session Bean
      ============
      package myTransTest;
      import javax.ejb.Remote;
      @Remote
      public interface ITest{
      void addPerson(PersonParam personParam);

      }

      The PersonParam is being refenced from the util.jar .

      On deploying am getting a classcast exception saying myUtil.PersonParam not found.

        • 1. Re: EAR deploy fails in JBoss 4.2
          alrubinger

          Does your EAR's application.xml descriptor reference the java module util.jar?

          S,
          ALR

          • 2. Re: EAR deploy fails in JBoss 4.2
            chandra_88

            Yes it does in this way.

            Apologies i was getting a class not found exception not a class cast exception.

            Applicaiton.xml under ear
            ==================

            <?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">

            <display-name>ejbSession</display-name>

            EjbSession.jar



            <library-directory>lib</library-directory>




            The util jar is kept under lib folder. Can you tell what is the correct way to mention it.

            • 3. Re: EAR deploy fails in JBoss 4.2
              chandra_88

              Looks like a problem with my prev reply in terms of display so sending it again.

              The applicaiton.xml indirectly references the util jar by pointing to the lib directory where the util.jar is kept.

              <?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">

              <display-name>ejbSession</display-name>

              EjbSession.jar


              <library-directory>lib</library-directory>


              The util.jar is kept under lib directory and am getting a class not found exception

              • 4. Re: EAR deploy fails in JBoss 4.2
                chandra_88

                Iam not sure why the module tag is not getting displayed in the post

                • 5. Re: EAR deploy fails in JBoss 4.2
                  alrubinger

                  Should look like:

                  <?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>Foo</display-name>
                  
                   <!-- Libraries -->
                   <module>
                   <java>foo.jar</java>
                   </module>
                  ....
                  
                  </application>


                  In the example above, "foo.jar" is in the root of the EAR. If you want it in the "lib" directory, put "lib/foo.jar".

                  S,
                  ALR

                  • 6. Re: EAR deploy fails in JBoss 4.2
                    chandra_88

                    Thanks for the reply . I have multiple util jars all from the JBoss 4.2 doc it says multiple jars can be specified in the lib folder and the lib folder can be presnet in the ear folder.
                    The lib folder is specified using the library-directory tag.

                    So if in the application.xml i mention

                    <?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">

                    <display-name>EjbSession</display-name>
                    <!-- Libraries -->
                    < module>
                    EjbSession.jar
                    < /module>

                    <library-directory>lib</library-directory>




                    All the common libraries present in the lib folder i presumed. I did try modifying the manifest entries in the ejb jar and then i get an exception saying no class loaders found for the ejb impl classes.

                    Manifest.MF
                    =============

                    Manifest-Version: 1.0
                    Class-Path: ../lib/commons-collections-3.2.jar ../lib/commons-configuration-1.5.jar ../lib/commons-lang-2.3.jar ../lib/commons-logging-1.1.1.jar

                    How do i specify multiple jars file using <library-directory> if it is not suppored i will try whatever is mentioned from you.


                    • 7. Re: EAR deploy fails in JBoss 4.2
                      chandra_88

                      Thanks for the reply . I have multiple util jars all from the JBoss 4.2 doc it says multiple jars can be specified in the lib folder and the lib folder can be presnet in the ear folder.
                      The lib folder is specified using the library-directory tag.

                      So if in the application.xml i mention

                      <?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">

                      <display-name>EjbSession</display-name>
                      <!-- Libraries -->
                      < module>
                      EjbSession.jar
                      < /module>

                      <library-directory>lib</library-directory>




                      All the common libraries present in the lib folder i presumed. I did try modifying the manifest entries in the ejb jar and then i get an exception saying no class loaders found for the ejb impl classes.

                      Manifest.MF
                      =============

                      Manifest-Version: 1.0
                      Class-Path: ../lib/commons-collections-3.2.jar ../lib/commons-configuration-1.5.jar ../lib/commons-lang-2.3.jar ../lib/commons-logging-1.1.1.jar

                      How do i specify multiple jars file using <library-directory> if it is not suppored i will try whatever is mentioned from you.