prevent registering JCSAdminBean multiple times

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

prevent registering JCSAdminBean multiple times

Tim Cronin
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)
Reply | Threaded
Open this post in threaded view
|

Re: prevent registering JCSAdminBean multiple times

Romain Manni-Bucau
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" <[hidden email]> 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)
Reply | Threaded
Open this post in threaded view
|

Re: prevent registering JCSAdminBean multiple times

Thomas Vandahl
In reply to this post by Tim Cronin
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: [hidden email]
For additional commands, e-mail: [hidden email]