6 Replies Latest reply on Feb 14, 2005 12:23 PM by Michael Furman

    JBoss 4.0 Dynamic runtime loading (Class.forName) problem

    Michael Furman Newbie

      Hi!!
      I am trying to use the following simple reflection code in the business logic layer:

      Class toRun = Class.forName("Simple");


      Unfortunately, I have the following exception:
      java.lang.ClassNotFoundException: No ClassLoaders found for: Simple
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:292)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:463)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:374)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
       at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:78)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:219)
       ...
      


      The following code throws the same exception:

      Thread t = Thread.currentThread();
      ClassLoader cl = t.getContextClassLoader();
      Class toRun = cl.loadClass("Simple");


      I found the topic on the issue, but it deals with JBoss 3.2.3 and the presentation layer:

      http://www.jboss.org/index.html?module=bb&op=viewtopic&t=45602

      Please help!
      Best regards,
      Michael