pmlopes     2005/02/18 10:38:57

  Modified:    modules/core/src/java/org/openejb/util ClasspathUtils.java
  Log:

  ClassPathUtils fix for webapp loading under Tomcat5.5
  
  Revision  Changes    Path
  1.5       +13 -10    
openejb1/modules/core/src/java/org/openejb/util/ClasspathUtils.java
  
  Index: ClasspathUtils.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/util/ClasspathUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClasspathUtils.java       5 Jul 2004 15:47:46 -0000       1.4
  +++ ClasspathUtils.java       18 Feb 2005 15:38:57 -0000      1.5
  @@ -117,7 +117,7 @@
   
       /**
        * Appends the jar to the classpath of the classloader passed in.
  -     * 
  +     *
        * @param url
        *            the URL to be added to the search path of URLs
        */
  @@ -127,7 +127,7 @@
   
       /**
        * Appends the jar to the classpath of the classloader passed in.
  -     * 
  +     *
        * @param url
        *            the URL to be added to the search path of URLs
        */
  @@ -137,7 +137,7 @@
   
       /**
        * Appends the jar to the classpath of the classloader passed in.
  -     * 
  +     *
        * @param url
        *            the URL to be added to the search path of URLs
        */
  @@ -396,7 +396,9 @@
           }
   
           public void addRepository(String path) throws Exception {
  -            this.getAddRepositoryMethod().invoke(getCommonLoader(), new 
Object[] { path });
  +
  +             // Add this repository to our underlying class loader
  +            this.getAddRepositoryMethod().invoke(getCommonLoader(), new 
Object[] { new URL(path) });
           }
   
           private void rebuild() {
  @@ -449,20 +451,22 @@
            * via reflection. This allows us to call the addRepository method 
for
            * Tomcat integration, but doesn't require us to include or ship any
            * Tomcat libraries.
  -         * 
  +         *
            * @param clazz
            * @return @exception
            *         Exception
            */
           private java.lang.reflect.Method getAddRepositoryMethod() throws 
Exception {
               if (addRepositoryMethod == null) {
  -                final Class clazz = getCommonLoader().getClass();
  +
  +                             final Class clazz = URLClassLoader.class;
  +
                   this.addRepositoryMethod = (java.lang.reflect.Method) 
AccessController
                           .doPrivileged(new PrivilegedAction() {
                               public Object run() {
                                   java.lang.reflect.Method method = null;
                                   try {
  -                                    method = 
clazz.getDeclaredMethod("addRepository", new Class[] { String.class });
  +                                    method = 
clazz.getDeclaredMethod("addURL", new Class[] { URL.class });
                                       method.setAccessible(true);
                                   } catch (Exception e2) {
                                       e2.printStackTrace();
  @@ -486,5 +490,4 @@
               return webappLoader;
           }
       }
  -}
  -
  +}
  \ No newline at end of file
  
  
  

Reply via email to