4 Replies Latest reply on Jan 26, 2006 1:50 AM by mkelc

    Patch fixing a Nullpointer in dependency-triggered redeploym

    mkelc

      Hi there!

      I have a Web-Application with dependencies to a Datasource and want the WebApp
      to be redeployed when the *-ds.xml file is changed.

      So I injected the Dependencies in the jboss-web.xml:

      <jboss-web>
       <depends>jboss.jca:name=TranstoolDS,service=DataSourceBinding</depends>
       <depends>jboss.jca:name=TranstoolDS,service=LocalTxCM</depends>
       <depends>jboss.jca:name=TranstoolDS,service=ManagedConnectionFactory</depends>
       <depends>jboss.jca:name=TranstoolDS,service=ManagedConnectionPool</depends>
      </jboss-web>


      When i change the ds.xml-File Jboss tries to redeploy the war-file, but
      finishes with an exception (stacktrace is appended at the end):

      So i got to have a look to org/jboss/web/WebModule.java and found the lines 63-71

      63: public synchronized void startModule()
      64: throws DeploymentException
      65: {
      66: // Get the war URL
      67: URL warURL = di.localUrl != null ? di.localUrl : di.url;
      68: WebApplication webApp = deployer.start(di);
      69: di.context.put(AbstractWebContainer.WEB_APP, webApp);
      70: container.addDeployedApp(warURL, webApp);
      71: }


      this.di becomes null on destroy in the following piece of code (line 54-59)

      54: protected void destroyService()
      55: {
      56: this.di = null;
      57: this.container = null;
      58: this.deployer = null;
      59: }


      So i commented out the lines 56-58

      54: protected void destroyService()
      55: {
      56:// this.di = null;
      57:// this.container = null;
      58:// this.deployer = null;
      59: }


      and recompile JBoss 4.0.3 RC1. And now, it works like expected!

      And now my question:

      1. Is my solution ok? Must these members be nulled on destroy? Or can the
      while destroyService-Method be removed?
      2. When ok, can my Patch (ID 1259561 at Sourceforge - they said, it would be migrated to Jira :-\) be merged?

      Thanx in advance!

      Greetings

      Marian Kelc

      Stacktrace and logs:
      INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Unbound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=TranstoolDS from JNDI name 'java:TranstoolDS'
      INFO [org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=TranstoolDS to JNDI name 'java:TranstoolDS'
      WARN [org.jboss.system.ServiceController] Problem starting service jboss.web.deployment:war=transtool.war,id=-76125118
      java.lang.NullPointerException
       at org.jboss.web.WebModule.startModule(WebModule.java:67)
       at org.jboss.web.WebModule.startService(WebModule.java:46)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:267)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:217)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:950)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:436)
       at org.jboss.system.ServiceController.start(ServiceController.java:458)
       at org.jboss.system.ServiceController.start(ServiceController.java:458)
       at org.jboss.system.ServiceController.start(ServiceController.java:458)
       at org.jboss.system.ServiceController.start(ServiceController.java:458)
       at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:273)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:273)
       at $Proxy18.start(Unknown Source)
       at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:229)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:973)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:483)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)