tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1393583 - in /openejb/trunk/openejb/tomee: tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java tomee-common/src/main/java/org/apache/tomee/installer/Paths.java
Date Wed, 03 Oct 2012 16:19:43 GMT
Author: rmannibucau
Date: Wed Oct  3 16:19:42 2012
New Revision: 1393583

URL: http://svn.apache.org/viewvc?rev=1393583&view=rev
Log:
TOMEE-444 enricher doesn't work in tomee embedded

Modified:
    openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java
    openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Paths.java

Modified: openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java?rev=1393583&r1=1393582&r2=1393583&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java
(original)
+++ openejb/trunk/openejb/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/LazyStopWebappClassLoader.java
Wed Oct  3 16:19:42 2012
@@ -51,6 +51,25 @@ public class LazyStopWebappClassLoader e
         }
     }
 
+    @Override
+    public Class<?> loadClass(final String name) throws ClassNotFoundException {
+        if ("org.apache.openejb.hibernate.OpenEJBJtaPlatform".equals(name)
+                || "org.apache.openejb.jpa.integration.hibernate.PrefixNamingStrategy".equals(name)
+                || "org.apache.openejb.jpa.integration.eclipselink.PrefixSessionCustomizer".equals(name)
+                || "org.apache.openejb.eclipselink.JTATransactionController".equals(name)
+                || "org.apache.tomee.mojarra.TomEEInjectionProvider".equals(name)) {
+            // don't load them from system classloader (breaks all in embedded mode and no
sense in other cases)
+            final ClassLoader old = system;
+            system = NoClassClassLoader.INSTANCE;
+            try {
+                return super.loadClass(name);
+            } finally {
+                system = old;
+            }
+        }
+        return super.loadClass(name);
+    }
+
     public void internalStop() throws LifecycleException {
         if (isStarted()) {
             super.stop();
@@ -106,4 +125,13 @@ public class LazyStopWebappClassLoader e
         }
         return urls;
     }
+
+    private static class NoClassClassLoader extends ClassLoader {
+        private static final NoClassClassLoader INSTANCE = new NoClassClassLoader();
+
+        @Override
+        public Class<?> loadClass(final String name) throws ClassNotFoundException
{
+            throw new ClassNotFoundException();
+        }
+    }
 }

Modified: openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Paths.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Paths.java?rev=1393583&r1=1393582&r2=1393583&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Paths.java
(original)
+++ openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Paths.java
Wed Oct  3 16:19:42 2012
@@ -17,6 +17,8 @@
  */
 package org.apache.tomee.installer;
 
+import org.apache.openejb.jpa.integration.MakeTxLookup;
+import org.apache.openejb.loader.JarLocation;
 import org.apache.tomee.common.TomcatVersion;
 
 import java.io.File;
@@ -259,11 +261,14 @@ public class Paths {
     }
 
     public File findTomEELibJar(final String prefix) {
-        final File jar = findJar(getCatalinaLibDir(), prefix);
+        File jar = findJar(getCatalinaLibDir(), prefix);
         if (jar == null) { // maybe tomcat/openejb integration
             final String tomeeWar = System.getProperty("tomee.war");
             if (tomeeWar != null) {
-                return findJar(new File(tomeeWar, "lib"), prefix);
+                jar = findJar(new File(tomeeWar, "lib"), prefix);
+            }
+            if (jar == null || !jar.exists()) {
+                jar = JarLocation.jarLocation(MakeTxLookup.class);
             }
         }
         return jar;



Mime
View raw message