13 Replies Latest reply on Mar 6, 2002 1:19 AM by fstarsinic

    classpath to external jar files

    oli306

      hi all,

      From my session beans, I need to access an SAP Api, installed on the same machine.
      How can I specify these external jar in the classpath files with Jboss2.4. ?
      I cannot just drop them in the /ext directory because this API is only a small part of another Product.

      If I add them to the classpath in run.bat, it's useless.

      where should I specify the path to these jars ?

      thanks a lot,

      olivier.

        • 1. Re: classpath to external jar files

          Add a ClassPathExtension MBean to jboss.conf

          Regards,
          Adrian

          • 2. Re: classpath to external jar files
            oli306

            wow, what a fast answer !

            thanks a lot adrian,


            cheers,

            olivier.

            • 3. Re: classpath to external jar files
              oli306

              that's the line I added:






              but I get the following trace :


              java.lang.NoSuchMethodException: No such constructor
              at com.sun.management.jmx.MBeanServerImpl.internal_instantiate(MBeanServerImpl.java:2113)
              at com.sun.management.jmx.MBeanServerImpl.createMBean(MBeanServerImpl.java:509)
              at javax.management.loading.MLet.getMBeansFromURL(MLet.java:523)
              at javax.management.loading.MLet.getMBeansFromURL(MLet.java:369)
              at org.jboss.Main.(Main.java:180)
              at org.jboss.Main$1.run(Main.java:110)
              at java.security.AccessController.doPrivileged(Native Method)
              at org.jboss.Main.main(Main.java:106)



              I missed something ?

              • 4. Re: classpath to external jar files

                The archive and codebase attributes are for the jar
                containing the ClassPathExtension MBean.

                ARCHIVE="jboss.jar"
                CODEBASE="../../lib/ext"

                Also, you can only do one URL in each extension.
                You will need two MLETs for two directories.

                Regards,
                Adrian

                • 5. Re: classpath to external jar files
                  oli306

                  ok,

                  that's my line :




                  and my beans still not find the path to external libraries.

                  I must do something more ?


                  • 6. Re: classpath to external jar files

                    Try





                    Translateed, this says run org.jboss.util.ClassPathExtension from
                    ../../lib/jboss.jar passing the single String parameter
                    {your directory}

                    I'm not sure, you have to add the prefix file:/ for
                    fully qualified directories?

                    If you specify a directory that contains jars, the
                    MBean loads all jars in the directory.
                    It will however ignore everything else, e.g. classes
                    and property files.

                    Regards,
                    Adrian

                    • 7. Re: classpath to external jar files
                      oli306

                      oh yeah, that's fine now, thank you.

                      And to include directories for property files or conf files, I should add one mor ARG tag with the directory name or these lines only deal with jar files ?

                      • 8. Re: classpath to external jar files

                        The classpath extension works in three modes.

                        1) You specify a url to a jar
                        it adds that jar

                        2) You specify a url to a directory containing jars
                        it adds those jars

                        3) You specify a url to a directory not containing jars
                        it adds the directory to the classpath

                        Option 3 will add classes/property files providing
                        the directory does contain jars.

                        Regards,
                        Adrian

                        • 9. Re: classpath to external jar files

                          Sorry,

                          The last line should read

                          Option 3 will add classes/property files providing
                          the directory does NOT contain jars.

                          Regards,
                          Adrian

                          • 10. Re: classpath to external jar files

                            And also for more entries, you need a whole new
                            MLET.

                            Regards,
                            Adrian

                            • 11. Re: classpath to external jar files
                              fstarsinic

                              with JBoss 3...
                              My application is jar'd up and put in lib/ext directory (afsp.jar). the ejb part of the application is jar'd up separately and deployed into the deploy directory (BaseMDBConsumer.jar), but I end up getting a NoClassDefFound Error when the ejb makes a call to a class in afsp.jar, even though my jar file (afsp.jar) has been put into lib/ext.

                              [11:25:21,990,AutoDeployer] Deployment failed:file:/C:/packages/jb3/deploy/BaseMDBConsumer.jar
                              org.jboss.deployment.J2eeDeploymentException: Error while starting BaseMDBConsumer.jar: gov/ca/boe/util/BOEException, Cause:
                              java.lang.NoClassDefFoundError: gov/ca/boe/util/BOEException

                              why is that? am i doing something wrong?
                              thanks,
                              frank

                              • 12. Re: classpath to external jar files
                                davidjencks

                                I'd expect this problem with jboss 3 alpha, be only mildly surprised with jboss 3 beta, and be very surprised with the cvs version. For alpha, you'd have to put your jar in the list of jars to load from lib/ext in conf/default/jboss-service.xml. Other versions, this is taken care of automatically.

                                • 13. Re: classpath to external jar files
                                  fstarsinic

                                  thanks dave.

                                  i've been using jboss for several months now and have it running version 2.4.1a in production. i've never understood (or got working) any application deployed in what i would call the excepted way. i have decided to create my CLASSPATH and start JBoss by modifying run.bat so it uses the CLASSPATH that i configure. So, i do not put any jar files in lib/ext at all.

                                  I'd like to do it the "REAL" way by using lib/ext and starting JBoss properly.

                                  I have a small EJB (Message Driven Bean). It really does nothing at all except makes a call to a Workflow Engine that I wrote with the contents
                                  of the JMS message (an object message) The workflow engine tears apart the object message and "does stuff".

                                  So most of my code is in a jar file called "afsp.jar" that the EJB calls.

                                  i thought that i could drop my ejb jar file in the deploy directory, drop my war file in the tomcat webapps directory, drop my jar file and all the other jar files in the lib/ext directory and the ejb would find everything and all would work. is this how you would expect it to work?

                                  aparently you're saying with verison 3 dropping files in lib/ext doesn't do it without extra work. i can accept that.
                                  in production, we're using 2.4.1a and i thought i had the same problem.
                                  i'll revisit this approach with JBoss 2.4.1a. I just want to make sure i'm not off base with my approach for how to make the EJB see my afsp.jar file.

                                  i was also trying to create an MBean and have had no luck getting it to start. i'm assumming it's for the same reason. it cannot see afsp.jar


                                  any feedback you could provide would be greatly appreciated.

                                  thanks,
                                  frank