0 Replies Latest reply on Feb 21, 2008 5:15 PM by Luc DEW

    Classloading issue confirmation needed

    Luc DEW Newbie

      Hi,

      in a library within a JBoss ESB archive or SAR archive, the following code is performed to find annotated classes:

      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      URL[] urls = cl.getURLs();
      


      The problem is that the urls array returned is always empty. I was expecting to have URLs of libraries packages in my ESB archive. (The code is executed within a library in the archive).

      The same code executed within a Web application does not return an empty array.

      Trying to find out what the problem was, i had a look the RepositoryClassLoader class that overrides the URLClassLoader getURLs method with:
       public URL[] getURLs()
       {
       return EMPTY_URL_ARRAY;
       }
      



      I also noticed that JBoss has a WebClassLoader that overrides the getURLs() method with a totally different behaviour.

      Would you know another way to find annotated classes in a ESB, SAR JBoss archive ?

      Thanks in advance.