[ 
http://issues.apache.org/jira/browse/GERONIMO-609?page=comments#action_60738 ]
     
John Sisson commented on GERONIMO-609:
--------------------------------------

I would like to resolve this problem ASAP as it is a PITA not to have an 
operational geronimo.log when one is testing :-(

It seems that Configuration.storeGBeans(..) needs to be changed so that it runs 
under the classloader that was configured by the builder.  

Can someone please tell me whether the following proposed changes sound 
appropriate: 

* Change the signature for DeploymentContext.close() method so that it has a 
ClassLoader parameter.  The following callers would then need to be changed to 
pass a ClassLoader parameter:

addGBeans(EARContext, Module, ClassLoader) - 
org.apache.geronimo.client.builder.AppClientModuleBuilder
buildConfiguration(ConfigurationType, String, String, File) - 
org.apache.geronimo.deployment.service.ServiceConfigBuilder
buildConfiguration(Object, JarFile, File) - 
org.apache.geronimo.j2ee.deployment.EARConfigBuilder
buildConfiguration(Object, JarFile, File) - 
org.apache.geronimo.spring.deployment.SPRConfigBuilder
executeTestBuildModule(InstallAction, boolean) - 
org.apache.geronimo.connector.deployment.ConnectorModuleBuilderTest
testDeployWar4() - org.apache.geronimo.jetty.deployment.JettyModuleBuilderTest

* Change the implementation of DeploymentContext.close(ClassLoader cl) so that 
it passes cl to the saveConfiguration(..) method, which in turn will pass cl on 
the call to Configuration.storeGBeans(..).
* Change the implementation of the Configuration.storeGBeans(..) method so that 
it calls setContextClassLoader.  

Note: It appears that related method, loadGBeans(..), is executed in this 
fashion, as the Configuration constructor calls storeGBeans(..) inside a try 
block similar to the following:

ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
        try {
            
Thread.currentThread().setContextClassLoader(configurationClassLoader);
                                ....
        } finally {
            Thread.currentThread().setContextClassLoader(oldCl);
        }

Side Question: What is the purpose of ObjectInputStreamExt that is used in the 
loadGBeans function?

Thanks,

John

> geronimo.log can be closed whilst distributing an EAR if the application uses 
> log4j
> -----------------------------------------------------------------------------------
>
>          Key: GERONIMO-609
>          URL: http://issues.apache.org/jira/browse/GERONIMO-609
>      Project: Geronimo
>         Type: Bug
>   Components: deployment
>     Reporter: John Sisson

>
> The following stack trace shows the geronimo.log file being closed as a 
> result of static code being executed in a session bean whilst the 
> configuration is being stored.
> The EAR has a geronimo-application.xml file that contains a dependencies 
> element that adds log4j as a dependency, to ensure the application (when it 
> initialises its logging) does not interfere with geronimo's logging.  Well, 
> that was the plan, but I wasn't expecting to see the application's code being 
> executed without using the dependencies it was configured with.
> Here is the stack trace:
> System Thread [RMI TCP Connection(7)-172.21.35.170] (Suspended (breakpoint at 
> line 171 in org.apache.log4j.FileAppender))
>       
> org.apache.log4j.RollingFileAppender(org.apache.log4j.FileAppender).closeFile()
>  line: 171
>       
> org.apache.log4j.RollingFileAppender(org.apache.log4j.FileAppender).reset() 
> line: 302
>       
> org.apache.log4j.RollingFileAppender(org.apache.log4j.WriterAppender).close() 
> line: 195
>       org.apache.log4j.helpers.AppenderAttachableImpl.removeAllAppenders() 
> line: 132
>       
> org.apache.log4j.spi.RootCategory(org.apache.log4j.Category).removeAllAppenders()
>  line: 879
>       
> org.apache.log4j.PropertyConfigurator.parseCategory(java.util.Properties, 
> org.apache.log4j.Logger, java.lang.String, java.lang.String, 
> java.lang.String) line: 594
>       
> org.apache.log4j.PropertyConfigurator.configureRootCategory(java.util.Properties,
>  org.apache.log4j.spi.LoggerRepository) line: 500
>       org.apache.log4j.PropertyConfigurator.doConfigure(java.util.Properties, 
> org.apache.log4j.spi.LoggerRepository) line: 406
>       org.apache.log4j.PropertyConfigurator.configure(java.util.Properties) 
> line: 340
>       <snip - application code>
>       com.blah.server.ejb.ServerConfigPvtBean.<clinit>() line: 93
>       java.io.ObjectStreamClass.hasStaticInitializer(java.lang.Class) line: 
> not available [native method]
>       java.io.ObjectStreamClass.computeDefaultSUID(java.lang.Class) line: 1557
>       java.io.ObjectStreamClass.access$100(java.lang.Class) line: 47
>       java.io.ObjectStreamClass$1.run() line: 173
>       
> java.security.AccessController.doPrivileged(java.security.PrivilegedAction) 
> line: not available [native method]
>       java.io.ObjectStreamClass.getSerialVersionUID() line: 170
>       java.io.ObjectStreamClass.writeNonProxy(java.io.ObjectOutputStream) 
> line: 557
>       
> java.io.ObjectOutputStream.writeClassDescriptor(java.io.ObjectStreamClass) 
> line: 591
>       java.io.ObjectOutputStream.writeNonProxyDesc(java.io.ObjectStreamClass, 
> boolean) line: 1142
>       java.io.ObjectOutputStream.writeClassDesc(java.io.ObjectStreamClass, 
> boolean) line: 1100
>       java.io.ObjectOutputStream.writeClass(java.lang.Class, boolean) line: 
> 1082
>       java.io.ObjectOutputStream.writeObject0(java.lang.Object, boolean) 
> line: 996
>       java.io.ObjectOutputStream.defaultWriteFields(java.lang.Object, 
> java.io.ObjectStreamClass) line: 1332
>       java.io.ObjectOutputStream.writeSerialData(java.lang.Object, 
> java.io.ObjectStreamClass) line: 1304
>       java.io.ObjectOutputStream.writeOrdinaryObject(java.lang.Object, 
> java.io.ObjectStreamClass, boolean) line: 1247
>       java.io.ObjectOutputStream.writeObject0(java.lang.Object, boolean) 
> line: 1052
>       java.io.ObjectOutputStream.writeArray(java.lang.Object, 
> java.io.ObjectStreamClass, boolean) line: 1224
>       java.io.ObjectOutputStream.writeObject0(java.lang.Object, boolean) 
> line: 1050
>       java.io.ObjectOutputStream.defaultWriteFields(java.lang.Object, 
> java.io.ObjectStreamClass) line: 1332
>       java.io.ObjectOutputStream.writeSerialData(java.lang.Object, 
> java.io.ObjectStreamClass) line: 1304
>       java.io.ObjectOutputStream.writeOrdinaryObject(java.lang.Object, 
> java.io.ObjectStreamClass, boolean) line: 1247
>       java.io.ObjectOutputStream.writeObject0(java.lang.Object, boolean) 
> line: 1052
>       java.io.ObjectOutputStream.writeObject(java.lang.Object) line: 278
>       org.apache.geronimo.gbean.GBeanData.writeExternal(java.io.ObjectOutput) 
> line: 132
>       
> org.apache.geronimo.kernel.config.Configuration.storeGBeans(org.apache.geronimo.gbean.GBeanData[])
>  line: 422
>       
> org.apache.geronimo.j2ee.deployment.EARContext(org.apache.geronimo.deployment.DeploymentContext).saveConfiguration()
>  line: 490
>       
> org.apache.geronimo.j2ee.deployment.EARContext(org.apache.geronimo.deployment.DeploymentContext).close()
>  line: 452
>       
> org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(java.lang.Object,
>  java.util.jar.JarFile, java.io.File) line: 359
>       
> org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke(int,
>  java.lang.Object, java.lang.Object[]) line: not available
>       net.sf.cglib.reflect.FastMethod.invoke(java.lang.Object, 
> java.lang.Object[]) line: 53
>       
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(java.lang.Object, 
> java.lang.Object[]) line: 38
>       
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(java.lang.Object, 
> java.lang.Object[]) line: 118
>       org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(int, 
> java.lang.Object[]) line: 710
>       org.apache.geronimo.gbean.runtime.RawInvoker.invoke(int, 
> java.lang.Object[]) line: 57
>       
> org.apache.geronimo.kernel.proxy.RawOperationInvoker.invoke(javax.management.ObjectName,
>  java.lang.Object[]) line: 36
>       
> org.apache.geronimo.kernel.proxy.ProxyMethodInterceptor.intercept(java.lang.Object,
>  java.lang.reflect.Method, java.lang.Object[], 
> net.sf.cglib.proxy.MethodProxy) line: 92
>       
> org.apache.geronimo.deployment.ConfigurationBuilder$$EnhancerByCGLIB$$661d6fa5.buildConfiguration(java.lang.Object,
>  java.util.jar.JarFile, java.io.File) line: not available
>       org.apache.geronimo.deployment.Deployer.deploy(java.io.File, 
> java.io.File, java.io.File, boolean, java.lang.String, java.lang.String, 
> java.lang.String) line: 172
>       org.apache.geronimo.deployment.Deployer.deploy(java.io.File, 
> java.io.File) line: 85
>       
> org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(int,
>  java.lang.Object, java.lang.Object[]) line: not available
>       net.sf.cglib.reflect.FastMethod.invoke(java.lang.Object, 
> java.lang.Object[]) line: 53
>       
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(java.lang.Object, 
> java.lang.Object[]) line: 38
>       
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(java.lang.Object, 
> java.lang.Object[]) line: 118
>       
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(java.lang.String, 
> java.lang.Object[], java.lang.String[]) line: 745
>       org.apache.geronimo.kernel.Kernel.invoke(javax.management.ObjectName, 
> java.lang.String, java.lang.Object[], java.lang.String[]) line: 299
>       
> org.apache.geronimo.kernel.KernelGBean.invoke(javax.management.ObjectName, 
> java.lang.String, java.lang.Object[], java.lang.String[]) line: 121
>       
> org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(int,
>  java.lang.Object, java.lang.Object[]) line: not available
>       net.sf.cglib.reflect.FastMethod.invoke(java.lang.Object, 
> java.lang.Object[]) line: 53
>       
> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(java.lang.Object, 
> java.lang.Object[]) line: 38
>       
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(java.lang.Object, 
> java.lang.Object[]) line: 118
>       
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(java.lang.String, 
> java.lang.Object[], java.lang.String[]) line: 745
>       org.apache.geronimo.kernel.Kernel.invoke(javax.management.ObjectName, 
> java.lang.String, java.lang.Object[], java.lang.String[]) line: 299
>       
> org.apache.geronimo.kernel.jmx.MBeanServerDelegate.invoke(javax.management.ObjectName,
>  java.lang.String, java.lang.Object[], java.lang.String[]) line: 117
>       
> mx4j.remote.rmi.RMIConnectionInvoker.invoke(javax.management.ObjectName, 
> java.lang.String, java.rmi.MarshalledObject, java.lang.String[], 
> javax.security.auth.Subject) line: 219
>       sun.reflect.GeneratedMethodAccessor74.invoke(java.lang.Object, 
> java.lang.Object[]) line: not available
>       sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, 
> java.lang.Object[]) line: 25
>       java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) 
> line: 324
>       
> mx4j.remote.rmi.RMIConnectionSubjectInvoker(mx4j.remote.rmi.RMIConnectionProxy).invoke(java.lang.Object,
>  java.lang.reflect.Method, java.lang.Object[]) line: 34
>       mx4j.remote.rmi.RMIConnectionSubjectInvoker.chain(java.lang.Object, 
> java.lang.reflect.Method, java.lang.Object[]) line: 99
>       
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.access$000(mx4j.remote.rmi.RMIConnectionSubjectInvoker,
>  java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) line: 31
>       mx4j.remote.rmi.RMIConnectionSubjectInvoker$1.run() line: 90
>       
> java.security.AccessController.doPrivileged(java.security.PrivilegedExceptionAction,
>  java.security.AccessControlContext) line: not available [native method]
>       javax.security.auth.Subject.doAsPrivileged(javax.security.auth.Subject, 
> java.security.PrivilegedExceptionAction, java.security.AccessControlContext) 
> line: 500
>       mx4j.remote.MX4JRemoteUtils.subjectInvoke(javax.security.auth.Subject, 
> javax.security.auth.Subject, java.security.AccessControlContext, 
> java.util.Map, java.security.PrivilegedExceptionAction) line: 163
>       
> mx4j.remote.rmi.RMIConnectionSubjectInvoker.subjectInvoke(java.lang.Object, 
> java.lang.reflect.Method, java.lang.Object[], javax.security.auth.Subject) 
> line: 86
>       mx4j.remote.rmi.RMIConnectionSubjectInvoker.invoke(java.lang.Object, 
> java.lang.reflect.Method, java.lang.Object[]) line: 80
>       $Proxy0.invoke(javax.management.ObjectName, java.lang.String, 
> java.rmi.MarshalledObject, java.lang.String[], javax.security.auth.Subject) 
> line: not available
>       
> javax.management.remote.rmi.RMIConnectionImpl.invoke(javax.management.ObjectName,
>  java.lang.String, java.rmi.MarshalledObject, java.lang.String[], 
> javax.security.auth.Subject) line: 221
>       sun.reflect.GeneratedMethodAccessor74.invoke(java.lang.Object, 
> java.lang.Object[]) line: not available
>       sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, 
> java.lang.Object[]) line: 25
>       java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) 
> line: 324
>       
> sun.rmi.server.UnicastServerRef2(sun.rmi.server.UnicastServerRef).dispatch(java.rmi.Remote,
>  java.rmi.server.RemoteCall) line: 261
>       sun.rmi.transport.Transport$1.run() line: 148
>       
> java.security.AccessController.doPrivileged(java.security.PrivilegedExceptionAction,
>  java.security.AccessControlContext) line: not available [native method]
>       
> sun.rmi.transport.tcp.TCPTransport(sun.rmi.transport.Transport).serviceCall(java.rmi.server.RemoteCall)
>  line: 144
>       
> sun.rmi.transport.tcp.TCPTransport.handleMessages(sun.rmi.transport.Connection,
>  boolean) line: 460
>       sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run() line: 701
>       java.lang.Thread.run() line: 534

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to