tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [6/6] tomee git commit: reducing our dependency on corba and rmi and ensuring we have jaxb there - this last change can need some adjustment to endorse or not jaxb
Date Wed, 03 May 2017 16:25:46 GMT
reducing our dependency on corba and rmi and ensuring we have jaxb there - this last change can need some adjustment to endorse or not jaxb


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

Branch: refs/heads/master
Commit: 09ace0868d0bd6a4ec8e16f613501c37fcedd4d5
Parents: 93e0ea3
Author: rmannibucau <rmannibucau@apache.org>
Authored: Wed May 3 18:25:29 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Wed May 3 18:25:29 2017 +0200

----------------------------------------------------------------------
 .../src/main/resources/META-INF/NOTICE          |  2 +
 container/openejb-core/pom.xml                  |  1 +
 .../org/apache/openejb/ClassLoaderUtil.java     | 12 ++-
 .../java/org/apache/openejb/Extensions.java     | 10 +--
 .../openejb/monitoring/DynamicMBeanWrapper.java |  4 +-
 .../openejb/util/JuliLogStreamFactory.java      |  9 +-
 .../openejb/config/OpenEjb2ConversionTest.java  |  2 +
 .../java/org/apache/openejb/mbeans/Empty.java   |  2 +-
 .../org/apache/openejb/mbeans/Inheritance.java  |  6 +-
 .../apache/openejb/mbeans/MBeanDescription.java |  4 +-
 .../org/apache/openejb/mbeans/Operation.java    |  6 +-
 .../openejb/mbeans/OperationDescription.java    |  6 +-
 .../java/org/apache/openejb/mbeans/Parent.java  |  4 +-
 .../java/org/apache/openejb/mbeans/Reader.java  |  6 +-
 .../openejb/mbeans/ReaderDescription.java       |  6 +-
 .../org/apache/openejb/mbeans/ReaderWriter.java |  6 +-
 .../resource/ThreadDumpOnDestroyTest.java       |  2 +-
 .../oej2/simple/openejb-jar-expected.xml        |  8 +-
 container/openejb-jee/pom.xml                   | 12 +++
 .../openejb/jee/oejb3/PropertiesAdapter.java    | 27 +++++-
 .../openejb/jee/jpa/PersistenceXmlTest.java     | 20 +++--
 .../apache/openejb/loader/ClassPathFactory.java | 12 ++-
 .../apache/openejb/loader/SystemClassPath.java  |  2 +-
 .../apache/openejb/loader/SystemInstance.java   | 77 ------------------
 .../org/superbiz/applet/CalculatorApplet.java   |  6 +-
 .../test/java/org/superbiz/JNDILookupTest.java  |  3 +-
 .../openejb/test/entity/bmp/EncBmpBean.java     | 54 ++++++------
 .../openejb/test/entity/cmp/EncCmp2Bean.java    | 52 ++++++------
 .../openejb/test/entity/cmp/EncCmpBean.java     | 56 ++++++-------
 .../org/apache/openejb/test/mdb/EncMdbBean.java | 50 ++++++------
 .../test/singleton/BeanTxSingletonBean.java     | 17 ++--
 .../test/singleton/EncSingletonBean.java        | 49 +++++------
 .../test/stateful/BeanTxStatefulBean.java       | 17 ++--
 .../openejb/test/stateful/EncStatefulBean.java  | 53 ++++++------
 .../test/stateless/BeanTxStatelessBean.java     | 17 ++--
 .../test/stateless/EncStatelessBean.java        | 48 +++++------
 .../apache/openejb/test/ClientTestSuite.java    |  5 +-
 .../apache/openejb/test/DerbyTestDatabase.java  |  2 +-
 .../apache/openejb/test/FilteredTestSuite.java  |  2 +-
 .../apache/openejb/test/HsqldbTestDatabase.java |  2 +-
 .../openejb/test/InstantDbTestDatabase.java     | 11 ++-
 .../org/apache/openejb/test/IvmTestServer.java  |  5 +-
 .../apache/openejb/test/NumberedTestCase.java   | 10 +--
 .../openejb/test/PostgreSqlTestDatabase.java    |  2 +-
 .../org/apache/openejb/test/ResultPrinter.java  |  6 +-
 .../org/apache/openejb/test/RiTestServer.java   |  3 +-
 .../org/apache/openejb/test/TestClient.java     | 20 ++---
 .../org/apache/openejb/test/TestManager.java    |  4 +-
 .../entity/bmp/BmpAllowedOperationsTests.java   |  6 +-
 .../test/entity/bmp/BmpContextLookupTests.java  |  2 +-
 .../test/entity/bmp/BmpEjbHomeTests.java        |  2 +-
 .../test/entity/bmp/BmpEjbMetaDataTests.java    |  2 +-
 .../test/entity/bmp/BmpEjbObjectTests.java      |  2 +-
 .../openejb/test/entity/bmp/BmpHandleTests.java |  2 +-
 .../test/entity/bmp/BmpHomeHandleTests.java     |  2 +-
 .../test/entity/bmp/BmpHomeIntfcTests.java      |  4 +-
 .../test/entity/bmp/BmpJndiEncTests.java        |  2 +-
 .../openejb/test/entity/bmp/BmpJndiTests.java   |  2 +-
 .../test/entity/bmp/BmpRemoteIntfcTests.java    |  2 +-
 .../test/entity/bmp/BmpRmiIiopTests.java        | 47 ++++++-----
 .../openejb/test/entity/bmp/BmpTestClient.java  |  6 +-
 .../entity/cmp/CmpAllowedOperationsTests.java   |  4 +-
 .../test/entity/cmp/CmpContextLookupTests.java  |  2 +-
 .../test/entity/cmp/CmpEjbHomeTests.java        |  2 +-
 .../test/entity/cmp/CmpEjbMetaDataTests.java    |  2 +-
 .../test/entity/cmp/CmpEjbObjectTests.java      |  2 +-
 .../openejb/test/entity/cmp/CmpHandleTests.java |  2 +-
 .../test/entity/cmp/CmpHomeHandleTests.java     |  2 +-
 .../test/entity/cmp/CmpHomeIntfcTests.java      |  4 +-
 .../test/entity/cmp/CmpJndiEncTests.java        |  2 +-
 .../openejb/test/entity/cmp/CmpJndiTests.java   |  2 +-
 .../test/entity/cmp/CmpRemoteIntfcTests.java    |  2 +-
 .../test/entity/cmp/CmpRmiIiopTests.java        | 47 ++++++-----
 .../openejb/test/entity/cmp/CmpTestClient.java  |  6 +-
 .../test/entity/cmp/ComplexEjbHomeTests.java    |  3 +-
 .../entity/cmp/ComplexEjbMetaDataTests.java     |  3 +-
 .../test/entity/cmp/ComplexEjbObjectTests.java  |  3 +-
 .../test/entity/cmp/ComplexHandleTests.java     |  3 +-
 .../test/entity/cmp/ComplexHomeHandleTests.java |  3 +-
 .../test/entity/cmp/ComplexHomeIntfcTests.java  |  5 +-
 .../entity/cmp/ComplexRemoteIntfcTests.java     |  4 +-
 .../test/entity/cmp/UnknownEjbHomeTests.java    |  3 +-
 .../entity/cmp/UnknownEjbMetaDataTests.java     |  3 +-
 .../test/entity/cmp/UnknownEjbObjectTests.java  |  3 +-
 .../test/entity/cmp/UnknownHandleTests.java     |  3 +-
 .../test/entity/cmp/UnknownHomeHandleTests.java |  3 +-
 .../test/entity/cmp/UnknownHomeIntfcTests.java  |  5 +-
 .../entity/cmp/UnknownRemoteIntfcTests.java     |  4 +-
 .../entity/cmp2/Cmp2AllowedOperationsTests.java |  4 +-
 .../test/entity/cmp2/Cmp2EjbHomeTests.java      |  6 +-
 .../test/entity/cmp2/Cmp2EjbMetaDataTests.java  |  6 +-
 .../test/entity/cmp2/Cmp2EjbObjectTests.java    |  6 +-
 .../test/entity/cmp2/Cmp2HandleTests.java       | 16 ++--
 .../test/entity/cmp2/Cmp2HomeHandleTests.java   | 16 ++--
 .../test/entity/cmp2/Cmp2HomeIntfcTests.java    |  4 +-
 .../test/entity/cmp2/Cmp2JndiEncTests.java      |  2 +-
 .../openejb/test/entity/cmp2/Cmp2JndiTests.java |  2 +-
 .../test/entity/cmp2/Cmp2RemoteIntfcTests.java  |  2 +-
 .../test/entity/cmp2/Cmp2RmiIiopTests.java      | 55 ++++++-------
 .../test/entity/cmp2/Cmp2TestClient.java        |  7 +-
 .../openejb/test/entity/cmp2/Cmp2TestSuite.java |  1 -
 .../test/entity/cmp2/Complex2EjbHomeTests.java  |  4 +-
 .../entity/cmp2/Complex2EjbMetaDataTests.java   |  4 +-
 .../entity/cmp2/Complex2EjbObjectTests.java     |  4 +-
 .../test/entity/cmp2/Complex2HandleTests.java   |  8 +-
 .../entity/cmp2/Complex2HomeHandleTests.java    |  8 +-
 .../entity/cmp2/Complex2HomeIntfcTests.java     |  5 +-
 .../entity/cmp2/Complex2RemoteIntfcTests.java   |  2 +-
 .../test/entity/cmp2/EjbqlLocalTest.java        |  5 +-
 .../test/entity/cmp2/Unknown2EjbHomeTests.java  |  2 +-
 .../entity/cmp2/Unknown2EjbMetaDataTests.java   |  2 +-
 .../entity/cmp2/Unknown2EjbObjectTests.java     |  2 +-
 .../test/entity/cmp2/Unknown2HandleTests.java   |  8 +-
 .../entity/cmp2/Unknown2HomeHandleTests.java    |  8 +-
 .../entity/cmp2/Unknown2HomeIntfcTests.java     |  9 +-
 .../entity/cmp2/Unknown2RemoteIntfcTests.java   |  2 +-
 .../test/entity/cmr/AbstractCMRTest.java        | 19 ++---
 .../test/entity/cmr/CmrMappingTests.java        |  2 +-
 .../entity/cmr/ManyToManyComplexPkTests.java    |  6 +-
 .../test/entity/cmr/ManyToManyTests.java        |  4 +-
 .../entity/cmr/OneToManyComplexPkTests.java     | 12 +--
 .../openejb/test/entity/cmr/OneToManyTests.java | 10 +--
 .../test/entity/cmr/OneToOneComplexPkTests.java |  8 +-
 .../openejb/test/entity/cmr/OneToOneTests.java  |  6 +-
 .../mdb/MdbAnnotatedFieldInjectionTests.java    |  2 +-
 .../openejb/test/mdb/MdbContextLookupTests.java |  2 +-
 .../test/mdb/MdbFieldInjectionTests.java        |  2 +-
 .../test/mdb/MdbSetterInjectionTests.java       |  2 +-
 .../apache/openejb/test/mdb/MdbTestClient.java  |  2 +-
 .../openejb/test/servlet/ServletTestClient.java | 12 +--
 ...eldInjectionSingletonPojoHomeIntfcTests.java |  3 -
 ...jectionSingletonPojoLocalHomeIntfcTests.java |  3 -
 .../BMTSingletonAllowedOperationsTests.java     |  4 +-
 .../openejb/test/singleton/MiscEjbTests.java    | 10 +--
 .../SingletonAllowedOperationsTests.java        |  8 +-
 .../SingletonAnnotatedFieldInjectionTests.java  |  6 +-
 .../test/singleton/SingletonBeanTxTests.java    | 12 ++-
 .../singleton/SingletonContainerTxTests.java    |  8 +-
 .../singleton/SingletonContextLookupTests.java  |  4 +-
 .../SingletonDefaultInterceptorTests.java       |  3 -
 .../test/singleton/SingletonEjbHomeTests.java   |  2 +-
 .../singleton/SingletonEjbMetaDataTests.java    |  2 +-
 .../test/singleton/SingletonEjbObjectTests.java |  5 +-
 .../singleton/SingletonFieldInjectionTests.java |  8 +-
 .../test/singleton/SingletonHandleTests.java    |  2 +-
 .../singleton/SingletonHomeHandleTests.java     |  2 +-
 .../test/singleton/SingletonHomeIntfcTests.java |  2 +-
 .../singleton/SingletonInterceptorTests.java    |  4 +-
 .../test/singleton/SingletonJndiEncTests.java   |  2 +-
 .../test/singleton/SingletonJndiTests.java      |  2 +-
 .../SingletonPojoContextLookupTests.java        |  4 +-
 .../singleton/SingletonPojoEjbHomeTests.java    |  2 +-
 .../SingletonPojoEjbLocalObjectTests.java       |  3 +-
 .../SingletonPojoEjbMetaDataTests.java          |  2 +-
 .../singleton/SingletonPojoEjbObjectTests.java  |  2 +-
 .../singleton/SingletonPojoHandleTests.java     |  2 +-
 .../singleton/SingletonPojoHomeHandleTests.java |  2 +-
 .../singleton/SingletonPojoHomeIntfcTests.java  |  2 +-
 .../SingletonPojoRemoteIntrfcTests.java         |  2 +-
 .../singleton/SingletonPojoRemoteJndiTests.java |  2 +-
 .../singleton/SingletonRemoteIntfcTests.java    |  2 +-
 .../test/singleton/SingletonRmiIiopTests.java   | 48 ++++++-----
 .../SingletonSetterInjectionTests.java          |  6 +-
 .../BMTStatefulAllowedOperationsTests.java      |  2 +-
 .../StatefulAllowedOperationsTests.java         |  2 +-
 .../test/stateful/StatefulBeanTxTests.java      | 12 ++-
 .../stateful/StatefulContextLookupTests.java    |  4 +-
 .../StatefulDefaultInterceptorTests.java        |  3 -
 .../test/stateful/StatefulEjbHomeTests.java     |  2 +-
 .../test/stateful/StatefulEjbMetaDataTests.java |  2 +-
 .../test/stateful/StatefulEjbObjectTests.java   |  5 +-
 .../stateful/StatefulFieldInjectionTests.java   |  4 +-
 .../test/stateful/StatefulHandleTests.java      |  2 +-
 .../test/stateful/StatefulHomeHandleTests.java  |  2 +-
 .../test/stateful/StatefulHomeIntfcTests.java   |  2 +-
 .../test/stateful/StatefulInterceptorTests.java |  3 +-
 .../test/stateful/StatefulJndiEncTests.java     |  2 +-
 .../test/stateful/StatefulJndiTests.java        |  2 +-
 .../test/stateful/StatefulLocalTestSuite.java   |  2 +-
 .../StatefulPersistenceContextTests.java        |  2 +-
 .../StatefulPojoContextLookupTests.java         |  4 +-
 .../test/stateful/StatefulPojoEjbHomeTests.java |  2 +-
 .../StatefulPojoEjbLocalObjectTests.java        |  1 -
 .../stateful/StatefulPojoEjbObjectTests.java    |  2 +-
 .../test/stateful/StatefulPojoHandleTests.java  |  5 +-
 .../stateful/StatefulPojoHomeHandleTests.java   |  2 +-
 .../stateful/StatefulPojoHomeIntfcTests.java    |  2 +-
 .../stateful/StatefulPojoRemoteJndiTests.java   |  2 +-
 .../test/stateful/StatefulRemoteIntfcTests.java |  2 +-
 .../test/stateful/StatefulRmiIiopTests.java     | 47 ++++++-----
 .../stateful/StatefulSetterInjectionTests.java  |  4 +-
 .../test/stateful/StatefulTestClient.java       |  8 +-
 ...eldInjectionStatelessPojoHomeIntfcTests.java |  3 -
 ...jectionStatelessPojoLocalHomeIntfcTests.java |  3 -
 .../BMTStatelessAllowedOperationsTests.java     |  4 +-
 .../openejb/test/stateless/MiscEjbTests.java    | 10 +--
 .../StatelessAllowedOperationsTests.java        |  8 +-
 .../StatelessAnnotatedFieldInjectionTests.java  |  6 +-
 .../test/stateless/StatelessBeanTxTests.java    | 12 ++-
 .../stateless/StatelessContainerTxTests.java    |  8 +-
 .../stateless/StatelessContextLookupTests.java  |  4 +-
 .../StatelessDefaultInterceptorTests.java       |  3 -
 .../test/stateless/StatelessEjbHomeTests.java   |  2 +-
 .../stateless/StatelessEjbMetaDataTests.java    |  2 +-
 .../test/stateless/StatelessEjbObjectTests.java |  5 +-
 .../stateless/StatelessFieldInjectionTests.java |  8 +-
 .../test/stateless/StatelessHandleTests.java    |  2 +-
 .../stateless/StatelessHomeHandleTests.java     |  2 +-
 .../test/stateless/StatelessHomeIntfcTests.java |  2 +-
 .../stateless/StatelessInterceptorTests.java    |  4 +-
 .../test/stateless/StatelessJndiEncTests.java   |  2 +-
 .../test/stateless/StatelessJndiTests.java      |  2 +-
 .../StatelessPojoContextLookupTests.java        |  4 +-
 .../stateless/StatelessPojoEjbHomeTests.java    |  2 +-
 .../StatelessPojoEjbLocalObjectTests.java       |  3 +-
 .../StatelessPojoEjbMetaDataTests.java          |  2 +-
 .../stateless/StatelessPojoEjbObjectTests.java  |  2 +-
 .../stateless/StatelessPojoHandleTests.java     |  2 +-
 .../stateless/StatelessPojoHomeHandleTests.java |  2 +-
 .../stateless/StatelessPojoHomeIntfcTests.java  |  2 +-
 .../StatelessPojoRemoteIntrfcTests.java         |  2 +-
 .../stateless/StatelessPojoRemoteJndiTests.java |  2 +-
 .../stateless/StatelessRemoteIntfcTests.java    |  2 +-
 .../test/stateless/StatelessRmiIiopTests.java   | 54 ++++++------
 .../StatelessSetterInjectionTests.java          |  6 +-
 pom.xml                                         | 17 +++-
 server/openejb-client/pom.xml                   | 18 ++++
 .../org/apache/openejb/client/EJBRequest.java   |  4 +-
 .../openejb/client/MulticastPulseClient.java    | 28 +++++--
 .../apache/openejb/client/corba/InstanceOf.java | 17 +++-
 .../apache/openejb/client/EJBRequestTest.java   |  5 +-
 .../openejb/client/HttpsConnectionTest.java     | 86 ++++++++++++++------
 .../openejb/client/HttpsSimpleServer.java       | 18 +++-
 .../main/groovy/commands/SetupCommand.groovy    |  2 -
 .../java/org/apache/tomee/installer/Paths.java  |  5 --
 .../apache/tomee/installer/PathsInterface.java  |  2 -
 236 files changed, 946 insertions(+), 975 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/assembly/openejb-lite/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/assembly/openejb-lite/src/main/resources/META-INF/NOTICE b/assembly/openejb-lite/src/main/resources/META-INF/NOTICE
index ef192da..883ade5 100644
--- a/assembly/openejb-lite/src/main/resources/META-INF/NOTICE
+++ b/assembly/openejb-lite/src/main/resources/META-INF/NOTICE
@@ -54,3 +54,5 @@ Joda.org (http://www.joda.org/).
 This product includes software developed and copyrighted by the The OWASP
    Foundation (https://www.owasp.org)
 =========================================================================
+Jaxb Core (https://jaxb.java.net/)
+License: CDDL v1.1 and GPL v2 (https://glassfish.java.net/public/CDDL+GPL_1_1.html)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/pom.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/pom.xml b/container/openejb-core/pom.xml
index 8f6feda..1d061f9 100644
--- a/container/openejb-core/pom.xml
+++ b/container/openejb-core/pom.xml
@@ -317,6 +317,7 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.17</version>
         <configuration>
+          <childDelegation>true</childDelegation>
           <reuseForks>false</reuseForks>
           <forkCount>2</forkCount>
           <testNGArtifactName>none:none</testNGArtifactName>

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java b/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
index a87e27d..63d7319 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/ClassLoaderUtil.java
@@ -52,6 +52,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.jar.JarFile;
 import java.util.zip.ZipFile;
 
@@ -64,6 +65,7 @@ public class ClassLoaderUtil {
     private static final Map<String, List<ClassLoader>> classLoadersByApp = new HashMap<String, List<ClassLoader>>();
     private static final Map<ClassLoader, Set<String>> appsByClassLoader = new HashMap<ClassLoader, Set<String>>();
     private static final UrlCache localUrlCache = new UrlCache();
+    private static final AtomicBoolean skipClearSunJarFile = new AtomicBoolean();
 
     public static void destroyClassLoader(final String appId, final String appPath) {
         destroyClassLoader(appId);
@@ -374,6 +376,9 @@ public class ClassLoaderUtil {
      */
     @SuppressWarnings({"unchecked"})
     private static synchronized void clearSunJarFileFactoryCacheImpl(final String jarLocation, final int attempt) {
+        if (skipClearSunJarFile.get()) {
+            return;
+        }
         logger.debug("Clearing Sun JarFileFactory cache for directory " + jarLocation);
 
         try {
@@ -460,7 +465,6 @@ public class ClassLoaderUtil {
                 }
 
             }
-
         } catch (final ConcurrentModificationException e) {
             if (attempt > 0) {
                 clearSunJarFileFactoryCacheImpl(jarLocation, attempt - 1);
@@ -469,6 +473,12 @@ public class ClassLoaderUtil {
             }
         } catch (final ClassNotFoundException | NoSuchFieldException e) {
             // not a sun vm
+        } catch (final RuntimeException re) {
+            if ("java.lang.reflect.InaccessibleObjectException".equals(re.getClass().getName())) {
+                skipClearSunJarFile.compareAndSet(false, true);
+                return;
+            }
+            throw re;
         } catch (final Throwable e) {
             if (Boolean.getBoolean("openejb.java9.hack")) {
                 return; // reflection fails cause internals are not exported, close() is called and should be fine

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/main/java/org/apache/openejb/Extensions.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/Extensions.java b/container/openejb-core/src/main/java/org/apache/openejb/Extensions.java
index 654182a..f2b61f7 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/Extensions.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/Extensions.java
@@ -20,7 +20,6 @@ package org.apache.openejb;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
-import org.apache.openejb.util.reflection.Reflections;
 import org.apache.xbean.finder.ResourceFinder;
 
 import java.io.IOException;
@@ -84,7 +83,7 @@ public final class Extensions {
     public static void addExtensions(final ClassLoader loader, final Collection<String> classes) {
         for (final String clazz : classes) {
             try {
-                final Object object = loader.loadClass(clazz).newInstance();
+                final Object object = loader.loadClass(clazz).getConstructor().newInstance();
                 SystemInstance.get().addObserver(object);
             } catch (final Throwable t) {
                 LOGGER.error("Extension construction failed" + clazz, t);
@@ -95,7 +94,7 @@ public final class Extensions {
     public static void addExtensions(final Collection<Class<?>> classes) {
         for (final Class<?> clazz : classes) {
             try {
-                final Object object = clazz.newInstance();
+                final Object object = clazz.getConstructor().newInstance();
                 SystemInstance.get().addObserver(object);
             } catch (final Throwable t) {
                 LOGGER.error("Extension construction failed" + clazz.getName(), t);
@@ -105,10 +104,7 @@ public final class Extensions {
 
     public static class Finder extends ResourceFinder {
         public Finder(final String path, final boolean useLoader, final URL... urls) {
-            super(path, urls);
-            if (!useLoader && (urls == null || urls.length == 0)) {
-                Reflections.set(this, "urls", new URL[0]);
-            }
+            super(path, !useLoader && urls == null ? new URL[0] : urls);
         }
 
         // ensure we support multiple class by file

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
index eaa2a3b..e850aef 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/monitoring/DynamicMBeanWrapper.java
@@ -63,11 +63,11 @@ public class DynamicMBeanWrapper implements DynamicMBean, MBeanRegistration {
 
     private static final Map<Class<?>, CacheInfo> CACHE = new HashMap<Class<?>, CacheInfo>();
 
-    private static final Map<Class<?>, Class<? extends Annotation>> OPENEJB_API_TO_JAVAX = new HashMap<Class<?>, Class<? extends Annotation>>();
+    private static final Map<Class<?>, Class<? extends Annotation>> OPENEJB_API_TO_JAVAX = new HashMap<>();
 
     static {
         final ClassLoader loader = DynamicMBeanWrapper.class.getClassLoader();
-        try {
+        try { // all these dont work on java 9 cause of java.management module
             OPENEJB_API_TO_JAVAX.put(MBean.class, (Class<? extends Annotation>) loader.loadClass("javax.management.MBean"));
             OPENEJB_API_TO_JAVAX.put(Description.class, (Class<? extends Annotation>) loader.loadClass("javax.management.Description"));
             OPENEJB_API_TO_JAVAX.put(ManagedOperation.class, (Class<? extends Annotation>) loader.loadClass("javax.management.ManagedOperation"));

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
index 2f2b040..a40850e 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
@@ -24,7 +24,7 @@ import org.apache.openejb.log.SingleLineFormatter;
 import org.apache.openejb.util.reflection.Reflections;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 
-import java.io.OutputStreamWriter;
+import java.io.OutputStream;
 import java.lang.reflect.Constructor;
 import java.util.logging.ConsoleHandler;
 import java.util.logging.LogManager;
@@ -204,8 +204,11 @@ public class JuliLogStreamFactory implements LogStreamFactory {
     public static class OpenEJBSimpleLayoutHandler extends ConsoleHandler {
         public OpenEJBSimpleLayoutHandler() {
             setFormatter(new SingleLineFormatter());
-            //setOutputStream(System.out); // don't do it otherwise you'll lost exception etc in the console
-            Reflections.set(this, "writer", new OutputStreamWriter(System.out));
+        }
+
+        @Override
+        protected synchronized void setOutputStream(final OutputStream out) throws SecurityException {
+            super.setOutputStream(System.out);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/config/OpenEjb2ConversionTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/OpenEjb2ConversionTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/OpenEjb2ConversionTest.java
index eaa9c38..96439b1 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/OpenEjb2ConversionTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/OpenEjb2ConversionTest.java
@@ -24,6 +24,7 @@ import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.loader.IO;
 import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.ElementNameAndAttributeQualifier;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.xml.sax.SAXException;
 
@@ -118,6 +119,7 @@ public class OpenEjb2ConversionTest extends TestCase {
             final org.w3c.dom.Document expectedDoc = XMLUnit.buildDocument(XMLUnit.newControlParser(), isr);
 
             final Diff myDiff = new Diff(expectedDoc, actualDoc);
+            myDiff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
             assertTrue("Files are similar " + myDiff, myDiff.similar());
         } finally {
             XMLUnit.setNormalizeWhitespace(nw);

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
index 2c0e826..8e21445 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Empty.java
@@ -16,7 +16,7 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.MBean;
+import org.apache.openejb.api.jmx.MBean;
 
 @MBean
 public class Empty {

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
index 50c00e9..2c5bf6b 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Inheritance.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedOperation;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedOperation;
 
 @MBean
 public class Inheritance extends Parent {

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
index 3919084..bcaf344 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/MBeanDescription.java
@@ -16,8 +16,8 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
index 96e6886..05dcbf4 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Operation.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedOperation;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedOperation;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
index 27c513b..ffaf3e6 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/OperationDescription.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedOperation;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedOperation;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Parent.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Parent.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Parent.java
index b22c771..2078e3e 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Parent.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Parent.java
@@ -16,8 +16,8 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.ManagedAttribute;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.ManagedAttribute;
 
 // simply a copy of ReaderWriter but abstract to avoid CDI conflict
 public abstract class Parent {

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
index 354ed25..0eab5a8 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/Reader.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedAttribute;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedAttribute;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
index 650f28c..7cb5264 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderDescription.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedAttribute;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedAttribute;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
index 89f527c..8ed98f7 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/mbeans/ReaderWriter.java
@@ -16,9 +16,9 @@
  */
 package org.apache.openejb.mbeans;
 
-import javax.management.Description;
-import javax.management.MBean;
-import javax.management.ManagedAttribute;
+import org.apache.openejb.api.jmx.Description;
+import org.apache.openejb.api.jmx.MBean;
+import org.apache.openejb.api.jmx.ManagedAttribute;
 
 @MBean
 @Description("descr ;)")

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/java/org/apache/openejb/resource/ThreadDumpOnDestroyTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/ThreadDumpOnDestroyTest.java b/container/openejb-core/src/test/java/org/apache/openejb/resource/ThreadDumpOnDestroyTest.java
index 3452618..911bbe8 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/resource/ThreadDumpOnDestroyTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/ThreadDumpOnDestroyTest.java
@@ -69,7 +69,7 @@ public class ThreadDumpOnDestroyTest {
         Logger.getLogger("OpenEJB.startup").removeHandler(h);
         assertEquals("Can't destroy test in 3 seconds, giving up.", records.get(1) /*0 is "undeploying..."*/);
         assertTrue(records.get(2).contains("\"openejb-resource-destruction-test - 1\" suspended=false state=TIMED_WAITING"));
-        assertTrue(records.get(2).contains("at org.apache.openejb.resource.ThreadDumpOnDestroyTest$WillFail.destroy"));
+        assertTrue(records.get(2).contains("org.apache.openejb.resource.ThreadDumpOnDestroyTest$WillFail.destroy"));
     }
 
     public static class WillFail {

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar-expected.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar-expected.xml b/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar-expected.xml
index b0ea922..a53124a 100644
--- a/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar-expected.xml
+++ b/container/openejb-core/src/test/resources/convert/oej2/simple/openejb-jar-expected.xml
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
-    <properties>module.property.b=valueb
-module.property.a=valuea
+    <properties>module.property.a=valuea
+module.property.b=valueb
 </properties>
     <ejb-deployment ejb-name="FooBean" deployment-id="FooBean">
         <jndi interface="Local" name="thename"/>
         <jndi interface="Remote" name="anothername"/>
         <jndi interface="LocalHome" name="loldstyle"/>
         <jndi interface="RemoteHome" name="roldstyle"/>
-        <properties>bean.property.b=valueb
-bean.property.a=valuea
+        <properties>bean.property.a=valuea
+bean.property.b=valueb
 </properties>
     </ejb-deployment>
 </openejb-jar>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-jee/pom.xml
----------------------------------------------------------------------
diff --git a/container/openejb-jee/pom.xml b/container/openejb-jee/pom.xml
index 9cfce11..308ef52 100644
--- a/container/openejb-jee/pom.xml
+++ b/container/openejb-jee/pom.xml
@@ -60,6 +60,18 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-core</artifactId>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
----------------------------------------------------------------------
diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
index 0bbccff..d18ab87 100644
--- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
+++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb3/PropertiesAdapter.java
@@ -17,9 +17,13 @@
 package org.apache.openejb.jee.oejb3;
 
 import javax.xml.bind.annotation.adapters.XmlAdapter;
-import java.util.Properties;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
 
 /**
  * @version $Rev$ $Date$
@@ -36,10 +40,27 @@ public class PropertiesAdapter extends XmlAdapter<String, Properties> {
         if (properties == null) return null;
 
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        properties.store(out, null);
+        new Properties() { // sort entries as before java 9
+            {
+                putAll(properties);
+            }
+
+            @Override
+            public Set<Map.Entry<Object, Object>> entrySet() {
+                final Set<Map.Entry<Object, Object>> entrySet = super.entrySet();
+                return new TreeSet<Map.Entry<Object, Object>>(new Comparator<Map.Entry<Object, Object>>() {
+                    @Override
+                    public int compare(final Map.Entry<Object, Object> o1, final Map.Entry<Object, Object> o2) {
+                        return String.valueOf(o1.getKey()).compareTo(String.valueOf(o2.getKey()));
+                    }
+                }) {{
+                    addAll(entrySet);
+                }};
+            }
+        }.store(out, null);
 
         // First comment is added by properties.store() 
         final String string = new String(out.toByteArray());
-        return string.replaceFirst("#.*?" + System.getProperty("line.separator"), "");
+        return string.replaceFirst("#.*?" + System.lineSeparator(), "");
     }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-jee/src/test/java/org/apache/openejb/jee/jpa/PersistenceXmlTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-jee/src/test/java/org/apache/openejb/jee/jpa/PersistenceXmlTest.java b/container/openejb-jee/src/test/java/org/apache/openejb/jee/jpa/PersistenceXmlTest.java
index ec09b18..cc0dc4f 100644
--- a/container/openejb-jee/src/test/java/org/apache/openejb/jee/jpa/PersistenceXmlTest.java
+++ b/container/openejb-jee/src/test/java/org/apache/openejb/jee/jpa/PersistenceXmlTest.java
@@ -19,23 +19,23 @@ package org.apache.openejb.jee.jpa;
 
 
 import junit.framework.TestCase;
+import org.apache.openejb.jee.JAXBContextFactory;
+import org.apache.openejb.jee.jpa.unit.Persistence;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.ElementNameAndAttributeQualifier;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.ValidationEventHandler;
 import javax.xml.bind.ValidationEvent;
-import javax.xml.bind.Marshaller;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
+import javax.xml.bind.ValidationEventHandler;
 import java.io.BufferedInputStream;
-import java.io.IOException;
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 
-import org.apache.openejb.jee.jpa.unit.Persistence;
-import org.apache.openejb.jee.JAXBContextFactory;
-import org.custommonkey.xmlunit.Diff;
-
 /**
  * @version $Revision$ $Date$
  */
@@ -65,6 +65,7 @@ public class PersistenceXmlTest extends TestCase {
         final String actual = new String(baos.toByteArray());
 
         final Diff myDiff = new Diff(expected, actual);
+        myDiff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
         assertTrue("Files are similar " + myDiff, myDiff.similar());
     }
 
@@ -92,6 +93,7 @@ public class PersistenceXmlTest extends TestCase {
         final String actual = new String(baos.toByteArray());
 
         final Diff myDiff = new Diff(expected, actual);
+        myDiff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
         assertTrue("Files are similar " + myDiff, myDiff.similar());
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-loader/src/main/java/org/apache/openejb/loader/ClassPathFactory.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ClassPathFactory.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ClassPathFactory.java
index bd53948..6eb20bb 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ClassPathFactory.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ClassPathFactory.java
@@ -16,6 +16,10 @@
  */
 package org.apache.openejb.loader;
 
+import java.net.URLClassLoader;
+
+import static java.lang.ClassLoader.getSystemClassLoader;
+
 public class ClassPathFactory {
     @SuppressWarnings("checkstyle:needbraces")
     public static ClassPath createClassPath(final String name) {
@@ -23,10 +27,14 @@ public class ClassPathFactory {
         if (name.equalsIgnoreCase("tomcat-common")) return new TomcatClassPath();
         if (name.equalsIgnoreCase("tomcat-system")) return new TomcatClassPath();
         if (name.equalsIgnoreCase("tomcat-webapp")) return new WebAppClassPath();
-        if (name.equalsIgnoreCase("bootstrap")) return new SystemClassPath();
-        if (name.equalsIgnoreCase("system")) return new SystemClassPath();
+        if (name.equalsIgnoreCase("bootstrap") && isSystemSupported()) return new SystemClassPath();
+        if (name.equalsIgnoreCase("system") && isSystemSupported()) return new SystemClassPath();
         if (name.equalsIgnoreCase("thread")) return new ContextClassPath();
         if (name.equalsIgnoreCase("context")) return new ContextClassPath();
         return new ContextClassPath();
     }
+
+    private static boolean isSystemSupported() {
+        return URLClassLoader.class.isInstance(getSystemClassLoader());
+    }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
index 27315b5..6f87ea9 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemClassPath.java
@@ -27,7 +27,7 @@ import java.security.PrivilegedAction;
 /*-------------------------------------------------------*/
 /* System ClassLoader Support */
 /*-------------------------------------------------------*/
-
+// TODO: we should get rid of it in favor of a custom root loader or flat classpath (ContextClassPath)
 public class SystemClassPath extends BasicURLClassPath {
 
     private URLClassLoader sysLoader;

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
index ec2251f..ee94e4f 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/SystemInstance.java
@@ -46,83 +46,6 @@ import static java.util.Arrays.asList;
  * @org.apache.xbean.XBean element="system"
  */
 public final class SystemInstance {
-    static { // preload API to not fall into module hell on JVM >= 9
-        final String version = System.getProperty("java.version", "-");
-        final boolean j9hacks = (!version.startsWith("1.") || version.startsWith("1.9.")) && !Boolean.getBoolean("openejb.java9.skip-hacks");
-        System.setProperty("openejb.java9.hack", Boolean.toString(j9hacks));
-        if (j9hacks) {
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            if (loader == null) {
-                loader = ClassLoader.getSystemClassLoader();
-            }
-            Method defineClass = null;
-            for (final String clazz : asList(
-                    // JTA - rt.jar API
-                    "javax.transaction.HeuristicCommitException",
-                    "javax.transaction.HeuristicMixedException",
-                    "javax.transaction.HeuristicRollbackException",
-                    "javax.transaction.NotSupportedException",
-                    "javax.transaction.RollbackException",
-                    "javax.transaction.Status",
-                    "javax.transaction.Synchronization",
-                    "javax.transaction.SystemException",
-                    "javax.transaction.Transaction",
-                    "javax.transaction.Transactional",
-                    "javax.transaction.TransactionalException",
-                    "javax.transaction.TransactionManager",
-                    "javax.transaction.TransactionScoped",
-                    "javax.transaction.TransactionSynchronizationRegistry",
-                    "javax.transaction.UserTransaction",
-                    // javax.annotation - rt.jar
-                    "javax.annotation.security.DeclareRoles",
-                    "javax.annotation.security.DenyAll",
-                    "javax.annotation.security.PermitAll",
-                    "javax.annotation.security.RolesAllowed",
-                    "javax.annotation.security.RunAs",
-                    "javax.annotation.sql.DataSourceDefinition",
-                    "javax.annotation.sql.DataSourceDefinitions",
-                    "javax.annotation.ManagedBean",
-                    "javax.annotation.Priority"
-            )) {
-                try {
-                    loader.loadClass(clazz);
-                } catch (final ClassNotFoundException e) {
-                    // DONT CALL LOGGER THERE
-                    final URL url = loader.getResource(clazz.replace('.', '/') + ".class");
-                    if (url == null) {
-                        e.printStackTrace();
-                        continue;
-                    }
-                    try {
-                        if (defineClass == null) {
-                            Class<?> type = loader.getClass();
-                            do {
-                                try {
-                                    defineClass = type.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
-                                } catch (final NoSuchMethodException ignore) {
-                                    // do nothing, we need to search the superclass
-                                }
-                                type = type.getSuperclass();
-                            } while (defineClass == null && type != Object.class);
-                            defineClass.setAccessible(true);
-                        }
-                        try (final InputStream is = url.openStream()) {
-                            final ByteArrayOutputStream out = new ByteArrayOutputStream();
-                            IO.copy(is, out);
-
-                            final byte[] bytes = out.toByteArray();
-                            defineClass.invoke(loader, clazz, bytes, 0, bytes.length);
-
-                            loader.loadClass(clazz);
-                        }
-                    } catch (final Throwable oops) {
-                        e.printStackTrace(); // no logger!
-                    }
-                }
-            }
-        }
-    }
-
     private static final String PROFILE_PROP = "openejb.profile";
     private static final String DEFAULT_PROFILE = "development";
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/examples/applet/src/main/java/org/superbiz/applet/CalculatorApplet.java
----------------------------------------------------------------------
diff --git a/examples/applet/src/main/java/org/superbiz/applet/CalculatorApplet.java b/examples/applet/src/main/java/org/superbiz/applet/CalculatorApplet.java
index 52703ad..eeaa26a 100644
--- a/examples/applet/src/main/java/org/superbiz/applet/CalculatorApplet.java
+++ b/examples/applet/src/main/java/org/superbiz/applet/CalculatorApplet.java
@@ -19,9 +19,6 @@ package org.superbiz.applet;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.rmi.PortableRemoteObject;
-import javax.swing.*;
-import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Properties;
@@ -81,8 +78,7 @@ public class CalculatorApplet extends JApplet {
 
                 try {
                     final Object ref = ctx.lookup("CalculatorImplRemote");
-                    Calculator calc = (Calculator) PortableRemoteObject.narrow(
-                            ref, Calculator.class);
+                    Calculator calc = (Calculator) ref;
                     String text1 = field1.getText();
                     String text2 = field2.getText();
                     int num1 = Integer.parseInt(text1);

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/examples/applet/src/test/java/org/superbiz/JNDILookupTest.java
----------------------------------------------------------------------
diff --git a/examples/applet/src/test/java/org/superbiz/JNDILookupTest.java b/examples/applet/src/test/java/org/superbiz/JNDILookupTest.java
index 45bf18e..77c0273 100644
--- a/examples/applet/src/test/java/org/superbiz/JNDILookupTest.java
+++ b/examples/applet/src/test/java/org/superbiz/JNDILookupTest.java
@@ -22,7 +22,6 @@ import org.superbiz.applet.Calculator;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.rmi.PortableRemoteObject;
 import java.util.Properties;
 
 public class JNDILookupTest {
@@ -36,7 +35,7 @@ public class JNDILookupTest {
             Context ctx = new InitialContext(props);
             System.out.println("Found context " + ctx);
             final Object ref = ctx.lookup("CalculatorImplRemote");
-            Calculator calc = (Calculator) PortableRemoteObject.narrow(ref, Calculator.class);
+            Calculator calc = (Calculator) ref;
             double result = calc.add(10, 30);
             Assert.assertEquals(40, result, 0.5);
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/EncBmpBean.java
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/EncBmpBean.java b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/EncBmpBean.java
index c50b1fc..23467e2 100644
--- a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/EncBmpBean.java
+++ b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/bmp/EncBmpBean.java
@@ -16,36 +16,34 @@
  */
 package org.apache.openejb.test.entity.bmp;
 
-import java.rmi.RemoteException;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+import org.junit.Assert;
 
 import javax.ejb.EJBException;
 import javax.ejb.EntityContext;
 import javax.ejb.RemoveException;
-import javax.naming.InitialContext;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityManager;
-import javax.sql.DataSource;
-import javax.jms.ConnectionFactory;
 import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.MessageProducer;
 import javax.jms.TopicConnectionFactory;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.JMSException;
-
-import org.junit.Assert;
-import junit.framework.AssertionFailedError;
-
-import org.apache.openejb.test.TestFailureException;
-import org.apache.openejb.test.stateful.BasicStatefulHome;
-import org.apache.openejb.test.stateful.BasicStatefulObject;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
-import org.apache.openejb.test.stateless.BasicStatelessHome;
-import org.apache.openejb.test.stateless.BasicStatelessObject;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import java.rmi.RemoteException;
 
 public class EncBmpBean implements javax.ejb.EntityBean {
 
@@ -118,7 +116,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicBmpHome home = (BasicBmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/bmp_entity"), BasicBmpHome.class);
+                final BasicBmpHome home = (BasicBmpHome) ctx.lookup("java:comp/env/entity/bmp/beanReferences/bmp_entity");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicBmpObject object = home.createObject("Enc Bean");
@@ -137,7 +135,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful"), BasicStatefulHome.class);
+                final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatefulObject object = home.createObject("Enc Bean");
@@ -156,7 +154,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateless"), BasicStatelessHome.class);
+                final BasicStatelessHome home = (BasicStatelessHome) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateless");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatelessObject object = home.createObject();
@@ -193,7 +191,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class);
+                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateless-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -209,7 +207,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class);
+                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful-business-local");
                 Assert.assertNotNull("The EJB BusinessLocal is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -225,7 +223,7 @@ public class EncBmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class);
+                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ctx.lookup("java:comp/env/entity/bmp/beanReferences/stateful-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
index ee60c5a..26b8493 100644
--- a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
+++ b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmp2Bean.java
@@ -16,33 +16,33 @@
  */
 package org.apache.openejb.test.entity.cmp;
 
-import java.util.StringTokenizer;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+import org.junit.Assert;
+
 import javax.ejb.CreateException;
 import javax.ejb.EntityBean;
 import javax.ejb.EntityContext;
-import javax.naming.InitialContext;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityManager;
-import javax.jms.ConnectionFactory;
 import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.MessageProducer;
 import javax.jms.TopicConnectionFactory;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.JMSException;
-
-import org.junit.Assert;
-import junit.framework.AssertionFailedError;
-import org.apache.openejb.test.TestFailureException;
-import org.apache.openejb.test.stateful.BasicStatefulHome;
-import org.apache.openejb.test.stateful.BasicStatefulObject;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
-import org.apache.openejb.test.stateless.BasicStatelessHome;
-import org.apache.openejb.test.stateless.BasicStatelessObject;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import java.util.StringTokenizer;
 
 public abstract class EncCmp2Bean implements EntityBean {
     private static int nextId;
@@ -96,7 +96,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicCmpHome home = (BasicCmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/cmp_entity"), BasicCmpHome.class);
+                final BasicCmpHome home = (BasicCmpHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/cmp_entity");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicCmpObject object = home.createObject("Enc Bean");
@@ -115,7 +115,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful"), BasicStatefulHome.class);
+                final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatefulObject object = home.createObject("Enc Bean");
@@ -134,7 +134,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless"), BasicStatelessHome.class);
+                final BasicStatelessHome home = (BasicStatelessHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatelessObject object = home.createObject();
@@ -171,7 +171,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class);
+                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -187,7 +187,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class);
+                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-local");
                 Assert.assertNotNull("The EJB BusinessLocal is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -203,7 +203,7 @@ public abstract class EncCmp2Bean implements EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class);
+                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmpBean.java
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmpBean.java b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmpBean.java
index a87b152..930d3f5 100644
--- a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmpBean.java
+++ b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmp/EncCmpBean.java
@@ -16,37 +16,35 @@
  */
 package org.apache.openejb.test.entity.cmp;
 
-import java.rmi.RemoteException;
-import java.util.StringTokenizer;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+import org.junit.Assert;
 
 import javax.ejb.EJBException;
 import javax.ejb.EntityContext;
 import javax.ejb.RemoveException;
-import javax.naming.InitialContext;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityManager;
-import javax.sql.DataSource;
-import javax.jms.ConnectionFactory;
 import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.MessageProducer;
 import javax.jms.TopicConnectionFactory;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.JMSException;
-
-import org.junit.Assert;
-import junit.framework.AssertionFailedError;
-
-import org.apache.openejb.test.TestFailureException;
-import org.apache.openejb.test.stateful.BasicStatefulHome;
-import org.apache.openejb.test.stateful.BasicStatefulObject;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
-import org.apache.openejb.test.stateless.BasicStatelessHome;
-import org.apache.openejb.test.stateless.BasicStatelessObject;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import java.rmi.RemoteException;
+import java.util.StringTokenizer;
 
 public class EncCmpBean implements javax.ejb.EntityBean {
     private static int nextId;
@@ -97,7 +95,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicCmpHome home = (BasicCmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/cmp_entity"), BasicCmpHome.class);
+                final BasicCmpHome home = (BasicCmpHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/cmp_entity");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicCmpObject object = home.createObject("Enc Bean");
@@ -116,7 +114,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful"), BasicStatefulHome.class);
+                final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatefulObject object = home.createObject("Enc Bean");
@@ -135,7 +133,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless"), BasicStatelessHome.class);
+                final BasicStatelessHome home = (BasicStatelessHome) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatelessObject object = home.createObject();
@@ -172,7 +170,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class);
+                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateless-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -188,7 +186,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class);
+                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-local");
                 Assert.assertNotNull("The EJB BusinessLocal is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -204,7 +202,7 @@ public class EncCmpBean implements javax.ejb.EntityBean {
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class);
+                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ctx.lookup("java:comp/env/entity/cmp/beanReferences/stateful-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/EncMdbBean.java
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/EncMdbBean.java b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/EncMdbBean.java
index ad636e1..24ae8af 100644
--- a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/EncMdbBean.java
+++ b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/mdb/EncMdbBean.java
@@ -17,39 +17,37 @@
  */
 package org.apache.openejb.test.mdb;
 
+import junit.framework.AssertionFailedError;
 import org.apache.openejb.test.TestFailureException;
-import org.apache.openejb.test.stateless.BasicStatelessHome;
-import org.apache.openejb.test.stateless.BasicStatelessObject;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
-import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
-import org.apache.openejb.test.stateful.BasicStatefulHome;
-import org.apache.openejb.test.stateful.BasicStatefulObject;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
-import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
 import org.apache.openejb.test.entity.bmp.BasicBmpHome;
 import org.apache.openejb.test.entity.bmp.BasicBmpObject;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+import org.apache.openejb.test.stateful.BasicStatefulObject;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessLocal;
+import org.apache.openejb.test.stateless.BasicStatelessBusinessRemote;
+import org.apache.openejb.test.stateless.BasicStatelessHome;
+import org.apache.openejb.test.stateless.BasicStatelessObject;
+import org.junit.Assert;
 
-import javax.annotation.PreDestroy;
 import javax.ejb.EJBContext;
 import javax.ejb.EJBException;
 import javax.ejb.MessageDrivenBean;
 import javax.ejb.MessageDrivenContext;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
 import javax.jms.ConnectionFactory;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.QueueConnectionFactory;
 import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
 import javax.jms.Session;
 import javax.jms.Topic;
-import javax.jms.MessageProducer;
-import javax.jms.MessageListener;
-import javax.jms.Message;
-import javax.persistence.EntityManagerFactory;
+import javax.jms.TopicConnectionFactory;
+import javax.naming.InitialContext;
 import javax.persistence.EntityManager;
-
-import org.junit.Assert;
-import junit.framework.AssertionFailedError;
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
 
 public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListener {
     private MessageDrivenContext mdbContext = null;
@@ -91,7 +89,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicBmpHome home = (BasicBmpHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/bmp_entity"), BasicBmpHome.class);
+                final BasicBmpHome home = (BasicBmpHome) ctx.lookup("java:comp/env/stateless/beanReferences/bmp_entity");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicBmpObject object = home.createObject("Enc Bean");
@@ -111,7 +109,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulHome home = (BasicStatefulHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/stateful"), BasicStatefulHome.class);
+                final BasicStatefulHome home = (BasicStatefulHome) ctx.lookup("java:comp/env/stateless/beanReferences/stateful");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatefulObject object = home.createObject("Enc Bean");
@@ -131,7 +129,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessHome home = (BasicStatelessHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/stateless"), BasicStatelessHome.class);
+                final BasicStatelessHome home = (BasicStatelessHome) ctx.lookup("java:comp/env/stateless/beanReferences/stateless");
                 Assert.assertNotNull("The EJBHome looked up is null", home);
 
                 final BasicStatelessObject object = home.createObject();
@@ -170,7 +168,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/stateless-business-remote"), BasicStatelessBusinessRemote.class);
+                final BasicStatelessBusinessRemote object = (BasicStatelessBusinessRemote) ctx.lookup("java:comp/env/stateless/beanReferences/stateless-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -187,7 +185,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/stateful-business-local"), BasicStatefulBusinessLocal.class);
+                final BasicStatefulBusinessLocal object = (BasicStatefulBusinessLocal) ctx.lookup("java:comp/env/stateless/beanReferences/stateful-business-local");
                 Assert.assertNotNull("The EJB BusinessLocal is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());
@@ -204,7 +202,7 @@ public class EncMdbBean implements EncMdbObject, MessageDrivenBean, MessageListe
                 final InitialContext ctx = new InitialContext();
                 Assert.assertNotNull("The InitialContext is null", ctx);
 
-                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/stateless/beanReferences/stateful-business-remote"), BasicStatefulBusinessRemote.class);
+                final BasicStatefulBusinessRemote object = (BasicStatefulBusinessRemote) ctx.lookup("java:comp/env/stateless/beanReferences/stateful-business-remote");
                 Assert.assertNotNull("The EJB BusinessRemote is null", object);
             } catch (final Exception e) {
                 Assert.fail("Received Exception " + e.getClass() + " : " + e.getMessage());

http://git-wip-us.apache.org/repos/asf/tomee/blob/09ace086/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BeanTxSingletonBean.java
----------------------------------------------------------------------
diff --git a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BeanTxSingletonBean.java b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BeanTxSingletonBean.java
index 195f58d..04c219d 100644
--- a/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BeanTxSingletonBean.java
+++ b/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BeanTxSingletonBean.java
@@ -16,10 +16,8 @@
  */
 package org.apache.openejb.test.singleton;
 
-import java.rmi.RemoteException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
+import org.apache.openejb.test.object.Account;
+import org.apache.openejb.test.object.Transaction;
 
 import javax.ejb.CreateException;
 import javax.ejb.EJBException;
@@ -28,9 +26,10 @@ import javax.naming.InitialContext;
 import javax.sql.DataSource;
 import javax.transaction.RollbackException;
 import javax.transaction.UserTransaction;
-
-import org.apache.openejb.test.object.Account;
-import org.apache.openejb.test.object.Transaction;
+import java.rmi.RemoteException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 
 public class BeanTxSingletonBean implements javax.ejb.SessionBean {
 
@@ -80,7 +79,7 @@ public class BeanTxSingletonBean implements javax.ejb.SessionBean {
     public void openAccount(final Account acct, final Boolean rollback) throws RemoteException, RollbackException {
 
         try {
-            final DataSource ds = (DataSource) javax.rmi.PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/database"), DataSource.class);
+            final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/database");
             final Connection con = ds.getConnection();
 
             try {
@@ -119,7 +118,7 @@ public class BeanTxSingletonBean implements javax.ejb.SessionBean {
     public Account retreiveAccount(final String ssn) throws RemoteException {
         final Account acct = new Account();
         try {
-            final DataSource ds = (DataSource) javax.rmi.PortableRemoteObject.narrow(jndiContext.lookup("java:comp/env/database"), DataSource.class);
+            final DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/database");
             final Connection con = ds.getConnection();
 
             try {


Mime
View raw message