openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r917060 - in /openwebbeans/trunk: samples/ejb-sample/ samples/ejb-sample/src/main/resources/META-INF/openwebbeans/ samples/ejb-telephone/ samples/guess/ webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl...
Date Sat, 27 Feb 2010 22:14:47 GMT
Author: gerdogdu
Date: Sat Feb 27 22:14:47 2010
New Revision: 917060

URL: http://svn.apache.org/viewvc?rev=917060&view=rev
Log:
Update ProxyFactory class creation for classloader issues

Modified:
    openwebbeans/trunk/samples/ejb-sample/pom.xml
    openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
    openwebbeans/trunk/samples/ejb-telephone/pom.xml
    openwebbeans/trunk/samples/guess/pom.xml
    openwebbeans/trunk/webbeans-impl/pom.xml
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ResourceProxyHandler.java
    openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
    openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/util/EjbDefinitionUtility.java

Modified: openwebbeans/trunk/samples/ejb-sample/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/ejb-sample/pom.xml?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/samples/ejb-sample/pom.xml (original)
+++ openwebbeans/trunk/samples/ejb-sample/pom.xml Sat Feb 27 22:14:47 2010
@@ -63,8 +63,31 @@
 			<groupId>org.apache.openwebbeans</groupId>
 			<artifactId>openwebbeans-impl</artifactId>
 			<version>${project.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.apache.geronimo.specs</groupId>
+					<artifactId>geronimo-jcdi_1.0_spec</artifactId>
+				</exclusion>
+				<exclusion>
+                      <groupId>org.apache.geronimo.specs</groupId>
+                      <artifactId>geronimo-atinject_1.0_spec</artifactId>			
	
+				</exclusion>
+			</exclusions>
 		</dependency>		
 		
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jcdi_1.0_spec</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+        <dependency>
+             <groupId>org.apache.geronimo.specs</groupId>
+             <artifactId>geronimo-atinject_1.0_spec</artifactId>
+             <scope>provided</scope>
+        </dependency>
+		
+		
 		<!-- JSF Plugin -->
 		<dependency>
 			<groupId>org.apache.openwebbeans</groupId>

Modified: openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
(original)
+++ openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
Sat Feb 27 22:14:47 2010
@@ -33,4 +33,4 @@
 org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService=true
 
 #use resource service
-org.apache.webbeans.spi.ResourceService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
\ No newline at end of file
+org.apache.webbeans.spi.ResourceInjectionService=org.apache.webbeans.ejb.resource.OpenEjbResourceInjectionService
\ No newline at end of file

Modified: openwebbeans/trunk/samples/ejb-telephone/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/ejb-telephone/pom.xml?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/samples/ejb-telephone/pom.xml (original)
+++ openwebbeans/trunk/samples/ejb-telephone/pom.xml Sat Feb 27 22:14:47 2010
@@ -56,8 +56,30 @@
 			<groupId>org.apache.openwebbeans</groupId>
 			<artifactId>openwebbeans-impl</artifactId>
 			<version>${project.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.apache.geronimo.specs</groupId>
+					<artifactId>geronimo-jcdi_1.0_spec</artifactId>
+				</exclusion>
+				<exclusion>
+                      <groupId>org.apache.geronimo.specs</groupId>
+                      <artifactId>geronimo-atinject_1.0_spec</artifactId>			
	
+				</exclusion>
+			</exclusions>
 		</dependency>		
 		
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jcdi_1.0_spec</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+        <dependency>
+             <groupId>org.apache.geronimo.specs</groupId>
+             <artifactId>geronimo-atinject_1.0_spec</artifactId>
+             <scope>provided</scope>
+        </dependency>
+		
 		<!-- JSF Plugin -->
 		<dependency>
 			<groupId>org.apache.openwebbeans</groupId>
@@ -119,11 +141,11 @@
 			<scope>provided</scope>
 		</dependency>		
 
-                 <!-- Validator API -->
-                 <dependency>
-                         <groupId>org.apache.geronimo.specs</groupId>
-                          <artifactId>geronimo-validation_1.0_spec</artifactId>
-                  </dependency>
+        <!-- Validator API -->
+        <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                 <artifactId>geronimo-validation_1.0_spec</artifactId>
+         </dependency>
 	
 	</dependencies>
 

Modified: openwebbeans/trunk/samples/guess/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/guess/pom.xml?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/samples/guess/pom.xml (original)
+++ openwebbeans/trunk/samples/guess/pom.xml Sat Feb 27 22:14:47 2010
@@ -63,12 +63,12 @@
 		</dependency>
 
 
-                                <!-- OWB implementation per application -->
-                                <dependency>
-                                        <groupId>org.apache.openwebbeans</groupId>
-                                        <artifactId>openwebbeans-impl</artifactId>
-                                        <version>${project.version}</version>
-                                </dependency>
+         <!-- OWB implementation per application -->
+         <dependency>
+                 <groupId>org.apache.openwebbeans</groupId>
+                 <artifactId>openwebbeans-impl</artifactId>
+                 <version>${project.version}</version>
+         </dependency>
 
 				
 	</dependencies>

Modified: openwebbeans/trunk/webbeans-impl/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/pom.xml?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/pom.xml (original)
+++ openwebbeans/trunk/webbeans-impl/pom.xml Sat Feb 27 22:14:47 2010
@@ -80,10 +80,10 @@
 			<artifactId>geronimo-jcdi_1.0_spec</artifactId>
 		</dependency>
 
-                <dependency>
-                        <groupId>org.apache.geronimo.specs</groupId>
-                        <artifactId>geronimo-atinject_1.0_spec</artifactId>
-                </dependency>
+              <dependency>
+                      <groupId>org.apache.geronimo.specs</groupId>
+                      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+              </dependency>
 
 		<dependency>
             	    <groupId>junit</groupId>

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
Sat Feb 27 22:14:47 2010
@@ -59,7 +59,7 @@
             this.actualResourceReference = resourceService.getResourceReference(this.resourceReference);
             proxyFactory.setHandler(new ResourceProxyHandler(this.actualResourceReference));
             
-            instance = (X)proxyFactory.createClass().newInstance();
+            instance = (X)(JavassistProxyFactory.getProxyClass(proxyFactory).newInstance());
         }
         catch (Exception e)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
Sat Feb 27 22:14:47 2010
@@ -180,7 +180,7 @@
                         if (proxyClass == null)
                         {
                             ProxyFactory delegateFactory = JavassistProxyFactory.createProxyFactory(bean);
-                            proxyClass = delegateFactory.createClass();
+                            proxyClass = JavassistProxyFactory.getProxyClass(delegateFactory);
                             interceptorProxyClasses.put(bean, proxyClass);
                         }
                         Object delegate = proxyClass.newInstance();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
Sat Feb 27 22:14:47 2010
@@ -62,7 +62,7 @@
             {
                 ProxyFactory fact = createProxyFactory(bean);
 
-                proxyClass = fact.createClass();
+                proxyClass = getProxyClass(fact);
                 normalScopedBeanProxyClasses.put(bean, proxyClass);
             }
             
@@ -128,7 +128,7 @@
             if (proxyClass == null)
             {
                 ProxyFactory fact = createProxyFactory(bean);
-                proxyClass = fact.createClass();
+                proxyClass = getProxyClass(fact);
                 dependentScopedBeanProxyClasses.put(bean, proxyClass);
             }
             
@@ -148,6 +148,31 @@
     }
     
 
+    public static Class<?> getProxyClass(ProxyFactory factory)
+    {
+    	Class<?> proxyClass = null;
+        try
+        {
+        	proxyClass = factory.createClass();
+        	
+        }catch(Exception e)
+        {
+            ProxyFactory.classLoaderProvider = new ProxyFactory.ClassLoaderProvider(){
+
+    			@Override
+    			public ClassLoader get(ProxyFactory pf) 
+    			{
+    				return Thread.currentThread().getContextClassLoader();
+    			}
+            	
+            };
+            
+            proxyClass = factory.createClass();        	
+        }                
+            	
+        return proxyClass;
+    }
+    
     public static ProxyFactory createProxyFactory(Bean<?> bean) throws Exception
     {
         Set<Type> types = bean.getTypes();
@@ -176,9 +201,9 @@
         Class<?>[] interfaceArray = new Class<?>[interfaceList.size()];
         interfaceArray = interfaceList.toArray(interfaceArray);
 
-        ProxyFactory fact = new ProxyFactory();
+        ProxyFactory fact = new ProxyFactory();        
         fact.setInterfaces(interfaceArray);
-        fact.setSuperclass(superClass);
+        fact.setSuperclass(superClass);        
 
         // turn off caching since this is utterly broken
         // this is a static field, but we do not know who else

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ResourceProxyHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ResourceProxyHandler.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ResourceProxyHandler.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ResourceProxyHandler.java
Sat Feb 27 22:14:47 2010
@@ -32,9 +32,9 @@
     }
     
     @Override
-    public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws
Throwable
+    public Object invoke(Object self, Method actualMethod, Method proceed, Object[] args)
throws Throwable
     {
-        return proceed.invoke(this.actualResource, args);
+        return actualMethod.invoke(this.actualResource, args);
     }
 
 }

Modified: openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
(original)
+++ openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
Sat Feb 27 22:14:47 2010
@@ -43,6 +43,7 @@
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.jms.JMSModel;
 import org.apache.webbeans.jms.component.JmsBean;
+import org.apache.webbeans.proxy.JavassistProxyFactory;
 import org.apache.webbeans.spi.JNDIService;
 import org.apache.webbeans.spi.ServiceLoader;
 import org.apache.webbeans.util.Asserts;
@@ -177,7 +178,7 @@
             
             pf.setHandler(new JmsProxyHandler(jmsComponent,intf));
 
-            result = pf.createClass().newInstance();
+            result = JavassistProxyFactory.getProxyClass(pf).newInstance();
 
         }
         catch (Exception e)

Modified: openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/util/EjbDefinitionUtility.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/util/EjbDefinitionUtility.java?rev=917060&r1=917059&r2=917060&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/util/EjbDefinitionUtility.java
(original)
+++ openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/util/EjbDefinitionUtility.java
Sat Feb 27 22:14:47 2010
@@ -24,6 +24,7 @@
 import org.apache.webbeans.ejb.component.creation.EjbBeanCreatorImpl;
 import org.apache.webbeans.ejb.proxy.EjbBeanProxyHandler;
 import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.proxy.JavassistProxyFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -63,7 +64,7 @@
                 factory.setInterfaces(new Class[]{iface});
             }
          
-            return (T)factory.createClass().newInstance();
+            return (T)(JavassistProxyFactory.getProxyClass(factory).newInstance());
             
         }catch(Exception e)
         {



Mime
View raw message