tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From radcor...@apache.org
Subject [5/5] tomee git commit: TomEE-2258 - Dirty hack to fix classloading issue with tomee-embedded. Needs to be addressed properly.
Date Fri, 12 Oct 2018 21:36:43 GMT
TomEE-2258 - Dirty hack to fix classloading issue with tomee-embedded. Needs to be addressed
properly.


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f521b016
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f521b016
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f521b016

Branch: refs/heads/master
Commit: f521b01675ec352e5c562ace76382693ebbfb55b
Parents: 92bf629
Author: Roberto Cortez <radcortez@yahoo.com>
Authored: Fri Oct 12 20:13:24 2018 +0100
Committer: Roberto Cortez <radcortez@yahoo.com>
Committed: Fri Oct 12 20:13:24 2018 +0100

----------------------------------------------------------------------
 .../apache/openejb/assembler/classic/Assembler.java   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f521b016/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index fb561c9..a0fad43 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -218,6 +218,7 @@ import java.lang.instrument.Instrumentation;
 import java.lang.management.ManagementFactory;
 import java.lang.management.ThreadInfo;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
@@ -383,7 +384,18 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
                             loader.loadClass("org.apache.bval.cdi.BValExtension$AnnotatedTypeFilter"))
                         .invoke(null, filter);
             } catch (final Throwable th) {
-                // ignore, bval not compatible or not present
+                // Quick hack to fix TOMEE-2258. Needs to be addressed properly. Fallback
to TCCL.
+                try {
+                    final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+                    final Object filter = loader.loadClass("org.apache.openejb.bval.BValCdiFilter").newInstance();
+                    loader.loadClass("org.apache.bval.cdi.BValExtension")
+                          .getMethod(
+                                  "setAnnotatedTypeFilter",
+                                  loader.loadClass("org.apache.bval.cdi.BValExtension$AnnotatedTypeFilter"))
+                          .invoke(null, filter);
+                } catch (Throwable e) {
+                    // ignore, bval not compatible or not present
+                }
             }
         }
     }


Mime
View raw message