You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2019/03/01 13:48:15 UTC

[tomee] branch tomee-7.1.x updated (249f423 -> 50c6e3d)

This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a change to branch tomee-7.1.x
in repository https://gitbox.apache.org/repos/asf/tomee.git.


    from 249f423  Fixes TOMEE-2261 Make service.bat compatible with JDK11+
     new f10d9f4  jdk 11 compatibility
     new 0fa199c  typo
     new 50c6e3d  Update ActiveMQ version

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../openejb/util/proxy/LocalBeanProxyFactory.java  | 37 +++++++++++++++++++---
 pom.xml                                            |  2 +-
 2 files changed, 34 insertions(+), 5 deletions(-)


[tomee] 02/03: typo

Posted by jg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a commit to branch tomee-7.1.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 0fa199c9d80f3cc01b7126d44a2153b8b69c7fd0
Author: Vicente Rossello <vr...@travelcompositor.com>
AuthorDate: Thu Aug 16 00:16:38 2018 +0200

    typo
---
 .../main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
index a36f7b8..20e9ab9 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
@@ -50,7 +50,7 @@ import java.util.concurrent.locks.ReentrantLock;
 
 public class LocalBeanProxyFactory implements Opcodes {
 
-    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, QueryProxy.class);
+    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, LocalBeanProxyFactory.class);
 
     public static final InvocationHandler NON_BUSINESS_HANDLER = new NonBusinessHandler();
 


[tomee] 03/03: Update ActiveMQ version

Posted by jg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a commit to branch tomee-7.1.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 50c6e3d06bd61f3d2b9975bc81f5b8551a710f89
Author: Jonathan Gallimore <jo...@jrg.me.uk>
AuthorDate: Fri Mar 1 11:33:11 2019 +0000

    Update ActiveMQ version
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index db6953e..d10ed34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -170,7 +170,7 @@
     <commons-net.version>3.3</commons-net.version>
 
     <bval.version>1.1.2</bval.version>
-    <org.apache.activemq.version>5.15.6</org.apache.activemq.version>
+    <org.apache.activemq.version>5.15.8</org.apache.activemq.version>
     <org.springframework.version>3.1.4.RELEASE</org.springframework.version>
     <junit.version>4.12</junit.version>
     <org.apache.axis2.version>1.4.1</org.apache.axis2.version>


[tomee] 01/03: jdk 11 compatibility

Posted by jg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a commit to branch tomee-7.1.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit f10d9f4acec5dc6440f72da405757f97a2a71e4c
Author: Vicente Rossello <vr...@travelcompositor.com>
AuthorDate: Wed Aug 15 23:55:01 2018 +0200

    jdk 11 compatibility
---
 .../openejb/util/proxy/LocalBeanProxyFactory.java  | 37 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
index 8a0dd8a..a36f7b8 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
@@ -17,6 +17,9 @@
 
 package org.apache.openejb.util.proxy;
 
+
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
 import org.apache.openejb.util.Debug;
 import org.apache.xbean.asm6.ClassWriter;
 import org.apache.xbean.asm6.Label;
@@ -47,6 +50,8 @@ import java.util.concurrent.locks.ReentrantLock;
 
 public class LocalBeanProxyFactory implements Opcodes {
 
+    private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB, QueryProxy.class);
+
     public static final InvocationHandler NON_BUSINESS_HANDLER = new NonBusinessHandler();
 
     private static final String BUSSINESS_HANDLER_NAME = "businessHandler";
@@ -700,7 +705,7 @@ public class LocalBeanProxyFactory implements Opcodes {
 
         // sun.misc.Unsafe
         private static final Object unsafe;
-        private static final Method defineClass;
+        private static final Method unsafeDefineClass;
         private static final Method allocateInstance;
         private static final Method putObject;
         private static final Method objectFieldOffset;
@@ -774,7 +779,7 @@ public class LocalBeanProxyFactory implements Opcodes {
                     }
                 }
             });
-            defineClass = AccessController.doPrivileged(new PrivilegedAction<Method>() {
+            unsafeDefineClass = AccessController.doPrivileged(new PrivilegedAction<Method>() {
                 @Override
                 public Method run() {
                     try {
@@ -782,7 +787,8 @@ public class LocalBeanProxyFactory implements Opcodes {
                         mtd.setAccessible(true);
                         return mtd;
                     } catch (final Exception e) {
-                        throw new IllegalStateException("Cannot get sun.misc.Unsafe.defineClass", e);
+                        LOGGER.debug("Unsafe's defineClass not available, will use classloader's defineClass");
+                        return null;
                     }
                 }
             });
@@ -816,8 +822,31 @@ public class LocalBeanProxyFactory implements Opcodes {
 
         // it is super important to pass a classloader as first parameter otherwise if API class is in a "permanent" classloader then it will leak
         public static Class defineClass(final ClassLoader loader, final Class<?> clsToProxy, final String proxyName, final byte[] proxyBytes) throws IllegalAccessException, InvocationTargetException {
-            return (Class<?>) defineClass.invoke(unsafe, proxyName, proxyBytes, 0, proxyBytes.length, loader, clsToProxy.getProtectionDomain());
+            if (unsafeDefineClass != null) {
+                return (Class<?>) unsafeDefineClass.invoke(unsafe, proxyName, proxyBytes, 0, proxyBytes.length, loader, clsToProxy.getProtectionDomain());
+            } else {
+                return (Class) getClassLoaderDefineClassMethod(loader).invoke(loader, proxyName, proxyBytes, 0, proxyBytes.length, clsToProxy.getProtectionDomain());
+            }
+        }
+
+        private static Method getClassLoaderDefineClassMethod(ClassLoader classLoader) {
+            Class<?> clazz = classLoader.getClass();
+            Method defineClassMethod = null;
+            do {
+                try {
+                    defineClassMethod = clazz.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
+                } catch (NoSuchMethodException e) {
+                    // do nothing, we need to search the superclass
+                }
+                clazz = clazz.getSuperclass();
+            } while (defineClassMethod == null && clazz != Object.class);
+
+            if (defineClassMethod != null && !defineClassMethod.isAccessible()) {
+                defineClassMethod.setAccessible(true);
+            }
+            return defineClassMethod;
         }
+
     }
 
     @Target(ElementType.TYPE)