4 Replies Latest reply on Mar 19, 2008 8:22 AM by j0llyr0g3r

    Where to put application- AND layer-specific jar-files withi

    j0llyr0g3r

      Hi folks,

      i am writing a simple jboss / ear application to get myself used to dealing with Jboss and EJB.

      I googled a lot, but i couldn't find an answer to the problem i have right now:

      My project has the common EAR-layout:

      - common
      - ejb
      - webapp
      - build.xml

      Now my EJB-layer uses one ActiveMQ jar file.

      Now i don't know where to put this jar within my EAR-file?

      First - in lack of better knowledge and for testing purposes - i put the jar-file just in the root of my EAR-file.

      This is simply ignored by Jboss:

      java.lang.NoClassDefFoundError: org/apache/activemq/ActiveMQConnectionFactory


      But this class is deinitely in the ActiveMQ-jar which resides on the root-level of my EAR:

      jar tf activemq-core-5.0-SNAPSHOT.jar | grep -i ActiveMQConnectionFactory
      org/apache/activemq/ActiveMQConnectionFactory$1.class
      org/apache/activemq/ActiveMQConnectionFactory.class
      org/apache/activemq/spring/ActiveMQConnectionFactory.class


      So, finally my question......:-)

      Where to put application- AND layer-specific jar-files within an EAR?

      More specific:

      Where to put the ActiveMQ jar-file within my EAR and how do i get Jboss to put it in the classpath?

        • 1. Re: Where to put application- AND layer-specific jar-files w
          jaikiran

          Which version of JBoss? In JBoss-4.2.x, you can create a folder named "lib" at the root of the EAR and place your common jar files in that lib folder. These jars will be made available in the classpath of your application.

          • 2. Re: Where to put application- AND layer-specific jar-files w
            j0llyr0g3r

            Hi,

            Which version of JBoss?


            sorry, totally forgot to give this information: Yes, i was referring to Jboss V. 4.2.

            In JBoss-4.2.x, you can create a folder named "lib" at the root of the EAR and place your common jar files in that lib folder. These jars will be made available in the classpath of your application.


            Ah, thanks very much!

            One more question regarding this matter:

            In JBoss-4.2.x, you can create a folder named "lib" at the root of the EAR and place your common jar files in that lib folder. These jars will be made available in the classpath of your application.


            Is there a way to let ant do this? I don't see a corresponding parameter in the ant EAR task according to: http://ant.apache.org/manual/CoreTasks/ear.html

            I would have expected a lib-parameter or something like that, but i don't see anything that meets the requirements....

            And using "include" will not create a lib-directory.

            Sure i could do this stuff manually, but is there an "ant-way" to do this?

            • 3. Re: Where to put application- AND layer-specific jar-files w
              peterj

              I think you are looking for this:

              <ear ...>
               <zipfileset dir="..." prefix="lib">
               <include name="activeMQ.jar" />
               </zipfileset>
              </ear>


              Personally, I never use the "ear" task to create an ear. Instead I first copy everything that goes into the ear to a directory, then use the jar task to package up that directory. I do it this way because 90% of the time what I want to deploy is the exploded ear directory, not the ear file.

              • 4. Re: Where to put application- AND layer-specific jar-files w
                j0llyr0g3r

                Thank you very much, Peter, works like a charm...:-)