2 Replies Latest reply on Jul 22, 2004 7:53 PM by Rahul Jain

    JBoss classloading behaviour

    Rahul Jain Newbie

      Hi,

      I have seen this classloading issue in JBoss and it has caused me great pain. I am using JBoss 3.2.4. The scenario is like this:

      I generate java classes on-the-fly in my application and then try to load those classes. But I perform the class generation only the first time when the classes have not already been generated by a previous run of my application. So in my code I first try to load, say class ABC, using Class.forName() and if it fails I know that I need to generate the classes. I then generate the classes and then try to load again using Class.forName(). This is were it fails with a ClassNotFoundException though the classes are present. I then stepped thru a debugger into Jboss src and found out that when u try to load a class and if that class is not found, it is places in a resourceBlackList (UnifiedLoaderRepository) and hence that class could never be loaded again even though it might be present in the classloader's path. So my first check using the Class.forName() would put the class ABC in the black list and hence would not load that class even after it was generated at runtime by my app.

      Can somebody tell me if this is a bug or a feature?
      I have posted my problems regarding classloading of runtime-generated classes in Jboss earlier on JBoss forums, but seems like nobody knows much or atleast bothers to reply. Seems like the classloading issue is a no-no in Jboss forums. Have heard people complaining about JBoss's classloading scheme too.

      Anyway, I would appreciate if anybody could reply to my query.

      Thanks.

      Rahul.