5 Replies Latest reply on Sep 29, 2009 9:25 PM by pavnesh

    InstanceAlreadyExistsException During hot deployment

      I am currently using JBOSS Cache v3.3.1GA with Websphere 6.1.0.21, JPA, Hibernate3.3, Spring 2.5.6. During development, we have hot deployed the application. So whever I make any change in the java code, code gets hot deployment on the server and I get the exception javax.management.InstanceAlreadyExistsException.

       javax.management.InstanceAlreadyExistsException: jboss.cache:service=TreeCache-Cluster,cell=TD2471Node01Cell,node=TD2471Node01,process=server1
       at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:470)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1428)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:954)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:355)
       at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:515)
       at com.ibm.ws.management.PlatformMBeanServer.registerMBean(PlatformMBeanServer.java:472)
       at org.jboss.cache.util.MBeanConfigurator.registerInterceptors(MBeanConfigurator.java:72)
       at org.jboss.cache.TreeCache._createService(TreeCache.java:1385)
       at org.jboss.cache.TreeCache.startService(TreeCache.java:1463)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
       at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:173)
       at org.hibernate.cache.TreeCacheProvider.start(TreeCacheProvider.java:75)
      


      When I restart the server, it starts working fine. This process goes on whever we make any code change. Any help/clue with be highly appreciated.

        • 1. Re: InstanceAlreadyExistsException During hot deployment
          mircea.markus

          you can disable the jmx statistics in JBossCache, but that would rather be a workaround.

          <jmxStatistics
           enabled="false"/>


          You should check why the MBean with the given name doesn't get unregistered.

          • 2. Re: InstanceAlreadyExistsException During hot deployment

            Disabling jmxStatistics does not help. I still got the same issue. But after doing more research, I came to know that this is the problem (or feature not sure :) ) with Websphere AS.

            I am trying to find out the solutions. If in the mean time, someone comes across some solution/workaround, please post here.

            Thanks,

            • 3. Re: InstanceAlreadyExistsException During hot deployment

              Thanks Mircea.Markus.

              Some more information:
              Websphere appends cellName, nodeName and server name (node1) to whever ClusterName I specify in the treecache.xml. During hot deployment, jboss cache jars try to find if there is any MBean with name TreeCache-Cluster. It does not find any and tries to create a new MBean with Name TreeCache-Cluster. In the process, websphere again appends the same information (cellName, nodeName ...etc) and it finds that there is bean with this name already exists and hence I get the exception.

              For the sake of experiment: I gave the name to ClusterName attribute as

              TreeCache-Cluster,cell=TD2471N
              ode01Cell,node=TD2471Node01,process=server1
              , which Websphere was complaining. And it all started working OK.

              But this definitely not a solution because this information is machine specific.

              Let me know how to fix it.

              Thanks,

              • 4. Re: InstanceAlreadyExistsException During hot deployment
                mircea.markus

                Once you disabled the jmxStats, JBossCache does not try to bind anything to the mbean server. Even more, the mbean object name for JBC3.0.0 or greater should be jboss.cache:service=JBossCache, and not jboss.cache:service=TreeCache. Can you double check the JBC version you are using?

                • 5. Re: InstanceAlreadyExistsException During hot deployment

                  Thanks Mircea.Markus for pointing me in right direction.

                  I am able to fix the problem. I upgraded my cache jars to 'Malagueta' version of JBC 3.2.0GA. Also there was one old jar file of JBC which was creating the conflict. Then I also tested the cluster name other than jboss.cache:service=TreeCache and that worked all well, no issues. :)[/img]