7 Replies Latest reply on Nov 23, 2002 6:41 AM by b powell

    Classloader rules... what are they?


      I have a stateless session bean that needs to look up a class via a Class.forName call.

      However, whenever I try it I get a class not found exception:

      java.lang.ClassNotFoundException: com.dsicdiiti.tnt.demo1.search.SearchCommand
      at org.jboss.mx.loading.UnifiedLoaderRepository.loadClass(UnifiedLoaderRepository.java:152)
      at org.jboss.mx.loading.UnifiedClassLoader.loadClass(UnifiedClassLoader.java:285)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:115)

      If I change the line from

      return Class.forName("com.dsicdiiti.tnt.demo1.search.SearchCommand");


      com.dsicdiiti.tnt.demo1.search.SearchCommand cls = new com.dsicdiiti.tnt.demo1.search.SearchCommand();
      return cls.getClass();

      it works just fine. However, I can't use this solution since the actual class name will not be known until runtime.

      How do i configure the class loader to find the class I need?