1 Reply Latest reply on Feb 1, 2007 9:04 AM by Adrian Brock

    Not keeping track of deployment class loader

    Scott Stark Master

      I finally looked into a shutdown error I have been seeing with the repository based profile service. There is a CNFE thrown from the deployers/profileservice-beans.xml ProxyFactory due to the incorrect TCL:

      14:12:48,161 WARN [StartStopLifecycleAction] Error during stop for ProfileServiceProxyFactory
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
       at javax.naming.InitialContext.init(InitialContext.java:223)
       at javax.naming.InitialContext.<init>(InitialContext.java:175)
       at org.jboss.profileservice.remoting.ProxyFactory.stop(ProxyFactory.java:150)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
       at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108)
       at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:103)
       at org.jboss.kernel.plugins.dependency.LifecycleAction.uninstallActionInternal(LifecycleAction.java:167)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.uninstallAction(KernelControllerContextAction.java:243)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.uninstall(KernelControllerContextAction.java:180)
       at org.jboss.dependency.plugins.AbstractControllerContextActions.uninstall(AbstractControllerContextActions.java:58)
       at org.jboss.dependency.plugins.AbstractControllerContext.uninstall(AbstractControllerContext.java:240)
       at org.jboss.dependency.plugins.AbstractController.uninstall(AbstractController.java:723)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:685)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:615)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:663)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:615)
       at org.jboss.dependency.plugins.AbstractController.uninstallContext(AbstractController.java:663)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:325)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:190)
       at org.jboss.system.ServiceController.doChange(ServiceController.java:656)
       at org.jboss.system.ServiceController.stop(ServiceController.java:481)
       at org.jboss.system.deployers.ServiceDeployer.stop(ServiceDeployer.java:149)
       at org.jboss.system.deployers.ServiceDeployer.undeploy(ServiceDeployer.java:129)
       at org.jboss.system.deployers.ServiceDeployer.undeploy(ServiceDeployer.java:46)
       at org.jboss.deployers.plugins.deployers.helpers.AbstractSimpleRealDeployer.undeploy(AbstractSimpleRealDeployer.java:64)
       at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.prepareUndeploy(AbstractSimpleDeployer.java:42)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
       at org.jboss.profileservice.aop.DeployerAspects.prepareUndeploy(DeployerAspects.java:203)
       at org.jboss.profileservice.aop.DeployerAspects.invoke(DeployerAspects.java:100)
       at org.jboss.aop.advice.org.jboss.profileservice.aop.DeployerAspects_z_invoke_1601866242.invoke(DeployerAspects_z_invoke_1601866242.java)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at AOPContainerProxy$8.prepareUndeploy(AOPContainerProxy$8.java)
       at org.jboss.deployers.plugins.deployer.DeployerWrapper.prepareUndeploy(DeployerWrapper.java:130)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.prepareUndeploy(MainDeployerImpl.java:517)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.prepareUndeploy(MainDeployerImpl.java:526)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:448)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:406)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.shutdown(MainDeployerImpl.java:634)
       at AOPContainerProxy$6.shutdown(AOPContainerProxy$6.java)
       at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.shutdownDeployments(ServerImpl.java:767)
       at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.shutdown(ServerImpl.java:749)
       at org.jboss.system.server.profileservice.ServerImpl$ShutdownHook.run(ServerImpl.java:716)
      Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
       ... 53 more
      


      On startup we have a hack in the ProfileServiceBootstrap to take the first bootstrap DeploymentContext as the base TCL. I suppose the ShutdownHook should be going through the profile service to shutdown the deployments in phases and employ the same hack, but shouldn't there be an association in the ControllerContext to the install action class loader if it came from the TCL rather than the BeanMetaData?


        • 1. Re: Not keeping track of deployment class loader
          Adrian Brock Master

           

          "scott.stark@jboss.org" wrote:

          On startup we have a hack in the ProfileServiceBootstrap to take the first bootstrap DeploymentContext as the base TCL. I suppose the ShutdownHook should be going through the profile service to shutdown the deployments in phases and employ the same hack, but shouldn't there be an association in the ControllerContext to the install action class loader if it came from the TCL rather than the BeanMetaData?


          The TCL switching does not exist in the Microcontainer (like it does in JMX).

          I always believed this should be in an interceptor rather than in the "container"
          since it should be optional behaviour.

          In fact, this problem comes because of the HACK. What would really be
          required is to inject the classloader into the Profile Service Bootstrap
          deployment.

          <deployment>
           <classloader><inject bean="BootstrapClassLoader>/></classloader>
          
           <!-- More likely a factory! -->
           <bean name="BootstrapClassLoader">
           <!-- Obviously we can't use ourselves so use the caller -->
           <classloader><null/></classloader>
           </bean>
          
           <!-- Other beans heres -->
          
          </deployment>
          


          But that isn't easy to do with the current way the classloaders get constructed
          inside JMX.

          It would however be trivial to remember the TCL that created the kernel controller context
          (if there is nothing explicitly configured on the bean or deployment)
          and switch to it during the (un)install actions.

          This would be similar to the AccessControlContext code that restores the registering
          context's security context for callouts.