Author: dblevins
Date: Sun Jul  1 23:01:54 2012
New Revision: 1356044

URL: http://svn.apache.org/viewvc?rev=1356044&view=rev
Log:
Ugly but works and someone else might have run into this in their own tests
OPENEJB-1855 - LinkageError on Mac OS with "sun/security/pkcs11/SunPKCS11"

Modified:
    
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationComposer.java

Modified: 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationComposer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationComposer.java?rev=1356044&r1=1356043&r2=1356044&view=diff
==============================================================================
--- 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationComposer.java
 (original)
+++ 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationComposer.java
 Sun Jul  1 23:01:54 2012
@@ -302,13 +302,17 @@ public class ApplicationComposer extends
                         final InjectionProcessor processor = new 
InjectionProcessor(testInstance, context.getInjections(), 
context.getJndiContext());
 
                         processor.createInstance();
-
+                        load("org.apache.webbeans.component.AbstractOwbBean");
+                        load("sun.security.pkcs11.SunPKCS11");
+                        load("sun.security.pkcs11.SunPKCS11$Descriptor");
+                        load("sun.security.pkcs11.wrapper.PKCS11Exception");
                         try {
                             OWBInjector beanInjector = new 
OWBInjector(appContext.getWebBeansContext());
                             beanInjector.inject(testInstance);
                         } catch (Throwable t) {
                             // TODO handle this differently
                             // this is temporary till the injector can be 
rewritten
+                            t.printStackTrace();
                         }
                     } finally {
                         ThreadContext.exit(oldContext);
@@ -333,6 +337,18 @@ public class ApplicationComposer extends
             }
         }
 
+        private void load(String className) {
+//            className = className.replace('/', '.');
+            try {
+                this.getClass().getClassLoader().loadClass(className);
+            } catch (Throwable t1) {
+                try {
+                    this.getClass().getClassLoader().loadClass(className);
+                } catch (Throwable t2) {
+                }
+            }
+        }
+
         private <Module extends NamedModule> Module setId(Module module, 
FrameworkMethod method) {
             return setId(module, method.getName());
         }


Reply via email to