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

    JBoss classloading behaviour

    gifs71

      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.

        • 1. Re: JBoss classloading behaviour
          starksm64

          Thanks for the melodrama. Flush the class loader blacklist and look at how the aop framework generates classes.

          • 2. Re: JBoss classloading behaviour
            gifs71

            Hi Scott,

            Atleast the melodrama got me your attention and a reply!!! :)
            I was frustated earlier coz of my repeated posts to these forums turned up no replies.

            About flushing the resourceBlackList, how would I do that and an even bigger concern is that I don't want to introduce an app server-specific code into my app. So flushing the blackList would be less preferable.

            Thanks.

            Rahul.