6 Replies Latest reply on Mar 31, 2006 1:05 PM by Jerry Gauthier

    InstanceAlreadyExistsException

    Michael Sorg Newbie

      Hello,
      I'm doing my first steps with JBoss Cache at the moment (in stand-alone-mode) and I have the following problem when I try to run some simple Unit-Tests:

      I create a single TreeCache object in JUnit's setUp()-method and stop the service with a stopService()-call in tieDown().

      When I run only one test of the test-suite everything works fine. But when I try to execute the whole test-suite the first test works and the whole rest fails and a InstanceAlreadyExistsException is thrown (stack-trace is listed below).

      It seems that there is a problem with the registration/de-registration of the MBean-server. When the second test is executed and the MBean tries to register the 'old one' is obviously still registered. How can this happen?
      Did I forget something?

      Thanks in advance

      Michael




      javax.management.InstanceAlreadyExistsException: jboss.cache:service=TreeCache-Cluster
      at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(Unknown Source)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(Unknown Source)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(Unknown Source)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(Unknown Source)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(Unknown Source)
      at org.jboss.cache.util.MBeanConfigurator.registerInterceptors(MBeanConfigurator.java:67)
      at org.jboss.cache.TreeCache._createService(TreeCache.java:1229)
      at org.jboss.cache.TreeCache.startService(TreeCache.java:1286)
      at de.innosystec.io.filemanagement.cache.TreeCacheFactory.getTreeCache(TreeCacheFactory.java:75)
      at de.innosystec.io.filemanagement.cache.server.TreeCacheServer.initialize(TreeCacheServer.java:135)
      at de.innosystec.io.filemanagement.cache.server.TreeCacheServer.(TreeCacheServer.java:104)
      at de.innosystec.io.filemanagement.cache.server.TreeCacheServerTest.testIfWrongPropertyDetected(TreeCacheServerTest.java:174)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)