7 Replies Latest reply on Nov 13, 2006 6:32 AM by chrismm

    DeploymentException: Trying to install an already registered

      Hi,

      I have been deploying a web-app on JBoss 4.0.2 installation on Linux for a while with no problems. The web-app uses a datasource defined in a mysql-ds.xml file in the deploy dir /usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml.

      At one point, after stopping and restarting JBoss (after a new web-app deployment), the server throws the exception:
      ERROR [MainDeployer] could not create deployment: file:/usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml
      org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=LocalTxCM,name=jdbc/dna_ds

      Even with this error, the server finally does startup and the application ran ok.

      Then, i removed the mysql-ds.xml from the deploy dir and restarted. Application still ran ok. So it seems like the datasource info is somehow "cached" somewhere.

      I tried to fix this be cleaning the tmp and work dirs, but it made no difference.

      Can someone please suggest what to do to fix it and where the datasource info may be getting picked up from when the mysql-ds.xml is removed?

      Thanks

      11:35:50,830 ERROR [MainDeployer] could not create deployment: file:/usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml
      org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=LocalTxCM,name=jdbc/dna_ds
       at org.jboss.system.ServiceCreator.install(ServiceCreator.java:70)
       at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:153)
       at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
       at org.jboss.system.ServiceController.install(ServiceController.java:202)
       at sun.reflect.GeneratedMethodAccessor50.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:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.install(Unknown Source)
       at org.jboss.deployment.SARDeployer.create(SARDeployer.java:220)
       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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:273)
       at $Proxy35.create(Unknown Source)
       at org.jboss.deployment.XSLSubDeployer.create(XSLSubDeployer.java:224)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor51.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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
       at sun.reflect.GeneratedMethodAccessor2.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:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:418)
       at sun.reflect.GeneratedMethodAccessor12.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:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:273)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:722)
       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.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:434)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:315)
       at org.jboss.Main.boot(Main.java:195)
       at org.jboss.Main$1.run(Main.java:463)
       at java.lang.Thread.run(Thread.java:595)
      
      
      
      --- Incompletely deployed packages ---
      org.jboss.deployment.DeploymentInfo@15199ce5 { url=file:/usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml }
       deployer: org.jboss.deployment.XSLSubDeployer@6a6014f7
       status: Deployment FAILED reason: Trying to install an already registered mbean: jboss.jca:service=LocalTxCM,name=jdbc/dna_ds
       state: FAILED
       watch: file:/usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml
       altDD: null
       lastDeployed: 1148582150825
       lastModified: 1148582150000
       mbeans:
      
      


        • 1. Re: DeploymentException: Trying to install an already regist
          peterj

          You wrote that this happened after your deployed a second web app. Did that second app have a data source deployed along with the app? If so, is it named jdbc/dna_ds?

          • 2. Re: DeploymentException: Trying to install an already regist

            No, I just redeployed a new release for the same web-app. There is only one application web-app war deployed.

            Anyway, I think I found the cause of this problem but still don't know how it happened. I browsed the JBoss web console and found that there was an entry under JMX MBeans / jboss.jca for a ManagedConnectionPool for jdbc/dna_ds with the same settings as those from the mysql-ds.xml file.

            So, somehow, it landed up in JMX. Now its there even if I shutdown and restart JBoss. I don't see this situation happening in other instances of JBoss on other servers. Don't know what caused this to happen? How does one remove the entry from JMX and allow JBoss to pick up the datasource configuration from the xml file?

            • 3. Re: DeploymentException: Trying to install an already regist
              peterj

              MBeans related to a data source show up only if a -ds.xml file defines the data source, so you have one somewhere.

              Try this. In jmx-console, click the jboss.system:service=MainDeployer MBean, and on the MBean property page scroll down to, and click the listDeployed operation. Search the resulting web page for your data source. That should lead you to the set of 5 or so MBeans for the data source. A few lines before that there is a "watch:" property with file URL, which identifies that file that defined your data source.

              • 4. Re: DeploymentException: Trying to install an already regist

                Peter, thank you very much for your help.

                I found the file as per your instructions. In the JMX MBean View, I found what you described. I'll try remove that file and try again with the mysql-ds.xml in the deploy dir as before.

                One more question: So is this normal for JBoss to pick up the file /usr/local/jboss-4.0.2/server/default/deploy/mysql-ds.xml, register Mbeans for it automatically and copy the file to /usr/local/jboss-4.0.2/server/default/deploy/jboss-hibernate.deployer/mysql-ds.xml? It seems it should not do that, because then the server complains on the next restart. I am just trying to see what I can do prevent such a situation from arising again.

                JMX MBean View:

                ...
                watch: file:/usr/local/jboss-4.0.2/server/default/deploy/jboss-hibernate.deployer/mysql-ds.xml
                 altDD: null
                 lastDeployed: 1148673053342
                 lastModified: 1148673048000
                 mbeans:
                 jboss.jca:service=LocalTxCM,name=jdbc/dna_ds state: Started
                 jboss.jca:service=ManagedConnectionPool,name=jdbc/dna_ds state: Started
                 jboss.jca:service=ManagedConnectionFactory,name=jdbc/dna_ds state: Started
                 jboss.jca:service=DataSourceBinding,name=jdbc/dna_ds state: Started
                 jboss.jdbc:service=metadata,datasource=jdbc/dna_ds state: Started
                ...
                
                


                • 5. Re: DeploymentException: Trying to install an already regist
                  peterj

                  My first question on reading your post was: are you using Hibernate? But whether you are or not, I have never noticed the behavior you have documented. And I have deployed both applications that have used Hibernate and those that have used straight JDBC.

                  One way to track it down is to set the jboss-hibernate.deployer directory to read-only, then whatever is trying to copy the mysql-ds.xml file there will probably generate a stack trace.

                  • 6. Re: DeploymentException: Trying to install an already regist

                    I removed the offending mysql-ds.xml file from the jboss-hibernate.deployer dir and restarted the server. It now picks up the file from the deploy dir as expected. I have not yet seen the file getting copied into the jboss-hibernate.deployer this time, but I'll lookout for it in case it happens again to find what causes that (if it does again).

                    Once again, thanks for your very useful help.

                    • 7. Re: DeploymentException: Trying to install an already regist
                      chrismm

                      I have had exactly the same problem with Oracle, on following the instructions above I discovered the file MQ.oracle-ds.xml as well as the oracle-ds.xml file. Deleting the MQ.oracle-ds.xml file solved the problem but where it came from, who knows ?