You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Tim Cronin <ti...@outboundengine.com> on 2017/11/16 20:54:19 UTC

prevent registering JCSAdminBean multiple times

we have a few webapps running on the same server that use JCS.

when moving the 2.x we started getting the following error on tomcat startup



javax.management.InstanceAlreadyExistsException:
org.apache.commons.jcs:type=JCSAdminBean
    at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
    at
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.initialize(CompositeCacheManager.java:271)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:185)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.getInstance(CompositeCacheManager.java:161)
    at org.apache.commons.jcs.JCS.getCacheManager(JCS.java:172)
    at org.apache.commons.jcs.JCS.getInstance(JCS.java:190)
    at com.outboundengine.cache.Cache.<init>(Cache.java:42)
    at com.outboundengine.cache.CacheManager.<init>(CacheManager.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

Re: prevent registering JCSAdminBean multiple times

Posted by Thomas Vandahl <tv...@apache.org>.
On 16.11.17 21:54, Tim Cronin wrote:
> we have a few webapps running on the same server that use JCS.
> 
> when moving the 2.x we started getting the following error on tomcat startup
> 
> 
> 
> javax.management.InstanceAlreadyExistsException:

It looks like you load multiple instances of CompositeCacheManager from
different class loaders. Setting the jmxName to different values is not
possible at the moment. This should be configurable. Would you please
open an issue on this.

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: prevent registering JCSAdminBean multiple times

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Tim

Setting the jmxName to null on the composite cache manager should do the
trick but depending the api you use is more or less easy. Can you have a
look?

Le 16 nov. 2017 21:54, "Tim Cronin" <ti...@outboundengine.com> a écrit :

we have a few webapps running on the same server that use JCS.

when moving the 2.x we started getting the following error on tomcat startup



javax.management.InstanceAlreadyExistsException:
org.apache.commons.jcs:type=JCSAdminBean
    at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.
registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(
DefaultMBeanServerInterceptor.java:966)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(
DefaultMBeanServerInterceptor.java:900)
    at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(
DefaultMBeanServerInterceptor.java:324)
    at
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(
JmxMBeanServer.java:522)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.initialize(
CompositeCacheManager.java:271)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:185)
    at
org.apache.commons.jcs.engine.control.CompositeCacheManager.getInstance(
CompositeCacheManager.java:161)
    at org.apache.commons.jcs.JCS.getCacheManager(JCS.java:172)
    at org.apache.commons.jcs.JCS.getInstance(JCS.java:190)
    at com.outboundengine.cache.Cache.<init>(Cache.java:42)
    at com.outboundengine.cache.CacheManager.<init>(CacheManager.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:62)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)