Author: jdillon
Date: Fri Jul 28 06:19:07 2006
New Revision: 426508
URL: http://svn.apache.org/viewvc?rev=426508&view=rev
Log:
r557@Bliss (orig r426349): jsisson | 2006-07-27 18:09:35 -0700
GERONIMO-2222 (Merged from 1.1 branch) Application errors in static initialization blocks
during serialization of configuration during deployment due to incorrect TCCL
Modified:
geronimo/sandbox/svkmerge/trunk/ (props changed)
geronimo/sandbox/svkmerge/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
Propchange: geronimo/sandbox/svkmerge/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Jul 28 06:19:07 2006
@@ -1,2 +1,2 @@
13f79535-47bb-0310-9956-ffa450edef68:/geronimo/sandbox/svkmerge/m2migration:419395
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/trunk:426252
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/trunk:426349
Modified: geronimo/sandbox/svkmerge/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/svkmerge/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java?rev=426508&r1=426507&r2=426508&view=diff
==============================================================================
--- geronimo/sandbox/svkmerge/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
(original)
+++ geronimo/sandbox/svkmerge/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
Fri Jul 28 06:19:07 2006
@@ -307,6 +307,15 @@
if (configurations.isEmpty()) {
throw new DeploymentException("Deployer did not create any configurations");
}
+
+ // Set TCCL to the classloader for the configuration being deployed
+ // so that any static blocks invoked during the loading of classes
+ // during serialization of the configuration have the correct TCCL
+ // ( a TCCL that is consistent with what is set when the same
+ // classes are loaded when the configuration is started.
+ Thread thread = Thread.currentThread();
+ ClassLoader oldCl = thread.getContextClassLoader();
+ thread.setContextClassLoader( context.getConfiguration().getConfigurationClassLoader());
try {
if (targetFile != null) {
if (configurations.size() > 1) {
@@ -339,6 +348,7 @@
// unlikely as we just built this
throw new DeploymentException(e);
} finally {
+ thread.setContextClassLoader(oldCl);
if (context != null) {
context.close();
}
|