1 Reply Latest reply on Feb 27, 2002 12:00 AM by Greg Turner

    Loading external classes from Session bean

    Wyvis Newbie


      I have built a session bean which needs to dynamically load different external classes to process different types of data.

      I have built and deployed the bean and it works OK. However, when I try to load the external class within the bean I get a NoClassDefFoundError exception.

      I have tried to put the Jar containing the classes into the JBoss lib and lib/ext directories and also on an explicit classpath in the startup script. Nothing works.

      Is this possible to do? If so, how?


        • 1. Re: Loading external classes from Session bean
          Greg Turner Apprentice

          This is definitely possible; I've done it. Here are a couple of things that may stimulate your thinking. The exception is thrown by the class loader, so the question is what class loader are your using? If you are using your own class loader, its parent typically must be set to be Thread.currentThread().getcontextClassLoader(). Another thing to consider is to pay close attention to what class is not being found. Your code my be trying to load class Foo and Foo.class may well be in the class path, but if Foo depends on some other class that is not in the class path, then you are out of luck.