11 Replies Latest reply on Feb 25, 2004 3:01 PM by oldblue

    My ejb application can't see jar files

    justjuice

      I have followed the instructions in the documentation about making jar files visible to my ejb application. ie, I have an ear file with the following contents:

      meta-inf/application.xml
      meta-inf/Manifest.mf
      myEJB.jar
      myWAR.war
      lib/myUtilities.jar

      The classes inside myEJB.jar reference classes inside myUtilities.jar. The myEJB.jar contains a manifest file that looks like this:

      Manifest-Version: 1.0
      Created-By: Ant 1.4
      Class-Path: lib/myUtilities.jar

      But the classLoader spits a dummy and gives me a NoClassDefFoundError when the a method is called in the ejb that references the classes in myUtilities.jar. And yes, there is a carriage return after the Class-Path line. I've also tried it with ./lib/myUtilities.jar but with no luck. And I've tried putting it into the myEJB.jar, which (expectedly) didn't work.

      The only way the classes in myUtilities.jar can be visible is by putting the jar into the jboss lib/ext directory, which is not recommended.

      Any help is desperately appreciated.

      Thanks

        • 1. Re: My ejb application can't see jar files
          oldblue

          I am experiencing this same problem.

          Any answer? What am I missing??

          • 2. Re: My ejb application can't see jar files
            oldblue

            Does no one know the answer to this?? Is the question not clear?

            Please help!! I'm stuck and don't know how to get my application to work!

            • 3. Re: My ejb application can't see jar files

              I can't help you but I found useful this lecture about classloading: http://webdev.apl.jhu.edu/~jcs/corej2ee.spring03/deploy/doc/book/public/02_J2EE_Application_Components.pdf

              I hope this can help you!
              Gio

              • 4. Re: My ejb application can't see jar files
                triathlon98

                Why not forget about the reference in the manifest file and add the library file as module in your application.xml?

                That is likely to cause less problems when redeploying as well.

                Joachim

                • 5. Re: My ejb application can't see jar files
                  oldblue

                  I originally tried the reference in the application.xml. Didn't work. I then tried the classpath in the manifest file. Didn't work.

                  Something doesn't seem right.

                  This was an app created in a WebLogic environment and I've been tasked with "porting" it to JBoss.

                  • 6. Re: My ejb application can't see jar files
                    triathlon98

                    Post the application.xml you used to reference it from there.
                    It might help to not put the library file in a subdirectory.

                    Joachim

                    • 7. Re: My ejb application can't see jar files
                      oldblue

                      I'll show you what I had in WebLogic. Here's what I have in my ear:

                      DocumentBean.jar
                      MessageDocumentBean.jar
                      MessageLoggingBean.jar
                      TRIF.war
                      APP-INF/lib/SharedUtils.jar
                      meta-inf/application.xml
                      meta-inf/Manifest.mf

                      Here's my Manifest.mf:
                      Manifest-Version: 1.0
                      Ant-Version: Apache Ant 1.5.3
                      Created-By: 1.4.2_03-b02 (Sun Microsystems Inc.)

                      Here's my application.xml:
                      <?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>TRIF</display-name>
                      TradeRanger Infrastructure

                      DocumentBean.jar


                      MessageLoggingBean.jar


                      MessageDocumentBean.jar



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




                      I've tried adding a Class-Path attribute to the manifest with no success.

                      I've tried adding a module element to the application.xml with no success. (I even tried all three types of modules besides web just for the sake of trying.) So something like SharedUtils.jar

                      And I've tried putting the SharedUtils.jar in just a lib subdirectory (no APP-INF above it), and tried putting it in no subdirectory.

                      It's a class withing the SharedUtils.jar that can't seem to be found at runtime. Do I need to create a directory structure under the lib directory that mimicks my package structure? (I know this is done in the classes directory in a web app.)

                      • 8. Re: My ejb application can't see jar files
                        oldblue

                        Sorry the xml in the application.xml isn't showing up properly. Should be:

                        TradeRanger Infrastructure


                        DocumentBean.jar


                        and so on.

                        • 9. Re: My ejb application can't see jar files
                          oldblue

                          Hmm.... If I take the SharedUtils.jar out of the ear and just drop it into the deploy directory, the app can find the classes.

                          • 10. Re: My ejb application can't see jar files
                            triathlon98

                            I am sure that referencing the jar from inside application.xml works.
                            As the xml snipped got eaten (you need to put it in a code block), here is a (working) application.xml from one of my projects:

                            <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN'
                             'http://java.sun.com/dtd/application_1_3.dtd'>
                            
                            <application>
                            
                             <display-name>IC-trace</display-name>
                            
                             <!-- libraries -->
                             <module>
                             <java>cabsoft.jar</java>
                             </module>
                             <module>
                             <java>uni-d-client.jar</java>
                             </module>
                             <module>
                             <java>resources.jar</java>
                             </module>
                            
                             <!-- actual IC-trace server-side components -->
                             <module>
                             <ejb>core.jar</ejb>
                             </module>
                             <module>
                             <web>
                             <web-uri>ws.war</web-uri>
                             <context-root>/ws/1.0</context-root>
                             </web>
                             </module>
                             <module>
                             <web>
                             <web-uri>ic-trace.war</web-uri>
                             <context-root>/</context-root>
                             </web>
                             </module>
                             <module>
                             <web>
                             <web-uri>admin.war</web-uri>
                             <context-root>/admin</context-root>
                             </web>
                             </module>
                            
                            </application>
                            


                            Hope that helps.

                            Joachim

                            • 11. Re: My ejb application can't see jar files
                              oldblue

                              Thanks Joachim. Your persistence telling me to put it in my application.xml got me to thinking. I think it's working now after I added this:

                               <module>
                               <java>APP-INF/lib/SharedUtils.jar</java>
                               </module>
                              


                              Interesting that in all the documents I've seen, I've never seen one that added the path. But it works.