0 Replies Latest reply on Jul 30, 2003 7:41 AM by Srivatsan

    Class Loader problem?

    Srivatsan Newbie

      Hi,

      I have a jar present in server/default/lib directory with some classes. To find out the jar in which my classes were present, I used the following code:

      ClassLoader cl = this.getClass().getClassLoader();
      if(cl instanceof UnifiedClassLoader)
      {
      UnifiedClassLoader ucl = (UnifiedClassLoader)cl;
      URL url = ucl.getURL(); // returned the jar in which my class is present
      }

      In JBoss 3.0.0, this worked fine. But in JBoss 3.2.1, the url returned was file://<jboss-base-dir>/server/default/conf/jboss-service.xml

      How to get the url of the jar in which my class is present.

      If I use this.getClass().getClassLoader().getResource("a.xml"), if there are more than one jar in the lib directory that contains the same file(a.xml), I may not get the resource correctly.