1 Reply Latest reply on Jun 2, 2003 3:12 AM by Bernd Zeitler

    Problems using URLClassLoader in JBoss

    omilian Newbie

      Hi Folks,

      we need to dynamically load classes. All dynamically loaded classes implement a single specified interface. In my IDE (not running jboss at all) I've had no problem using the URLClassLoader to load classes from various areas on the file system. Once loaded - using loadClass(String) - i can cast a new instance to the interface.

      In jboss i'm using a servlet to invoke a session bean. The servlet does nothing else besides findind and invoking the bean. The bean then uses URLClassLoader in the same way as my example code. Everthing is fine untill the point of casting the new instance to the interface at which point i get a ClassCastException.

      I've read the class loading architecture stuff in the FAQ's and searched the forum but don't seem to see anything to help me. Should I be passing some specific ClassLoader to the load class method? Is there something about class loading in jboss which would effect this?