Author: thomas.diesler(a)jboss.com
Date: 2007-05-16 09:29:33 -0400 (Wed, 16 May 2007)
New Revision: 3109
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
Log:
restructure
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java 2007-05-16
13:17:58 UTC (rev 3108)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java 2007-05-16
13:29:33 UTC (rev 3109)
@@ -25,8 +25,10 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
/**
* A deployer that injects the correct classloader into the Deployment
@@ -46,12 +48,34 @@
ClassLoader classLoader = unit.getClassLoader();
// Get the webapp context classloader and use it as the deploymet class loader
- WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
+ WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
classLoader = webMetaData.getContextLoader();
}
dep.setClassLoader(classLoader);
+
+ // Reload target beans with the updated class loader
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBean();
+ if (targetBean != null)
+ {
+ String beanName = targetBean.getName();
+ if (targetBean.getClassLoader() != classLoader)
+ {
+ try
+ {
+ targetBean = classLoader.loadClass(beanName);
+ ep.setTargetBean(targetBean);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSDeploymentException("Cannot reload target bean: "
+ beanName);
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
Modified:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-16
13:17:58 UTC (rev 3108)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-16
13:29:33 UTC (rev 3109)
@@ -25,8 +25,10 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
@@ -57,6 +59,28 @@
classLoader = webMetaData.getContextLoader();
}
- umd.setClassLoader(classLoader);
+ dep.setClassLoader(classLoader);
+
+ // Reload target beans with the updated class loader
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBean();
+ if (targetBean != null)
+ {
+ String beanName = targetBean.getName();
+ if (targetBean.getClassLoader() != classLoader)
+ {
+ try
+ {
+ targetBean = classLoader.loadClass(beanName);
+ ep.setTargetBean(targetBean);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSDeploymentException("Cannot reload target bean: "
+ beanName);
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
Modified:
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16
13:17:58 UTC (rev 3108)
+++
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16
13:29:33 UTC (rev 3109)
@@ -128,7 +128,7 @@
The Deployers
Each handles a single aspect of web service deployment
-->
- <bean name="WSClassLoaderInjectionDeployer"
class="org.jboss.ws.integration.jboss50.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSClassLoaderInjectionDeployer"
class="org.jboss.ws.integration.jboss50.ClassLoaderInjectionDeployer"/>
<bean name="WSEagerInitializeDeployer"
class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.ws.integration.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.ws.core.server.RequestHandlerImpl</property>
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16
13:17:58 UTC (rev 3108)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16
13:29:33 UTC (rev 3109)
@@ -438,7 +438,17 @@
}
}
- Method implMethod = implClass.getMethod(methodName, paramTypes);
+ Method implMethod = null;
+ try
+ {
+ implMethod = implClass.getMethod(methodName, paramTypes);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ log.error("CodeSource: " +
implClass.getProtectionDomain().getCodeSource());
+ log.error("ClassLoader: " + implClass.getClassLoader());
+ throw ex;
+ }
return implMethod;
}
Show replies by date