JMX issues on WebSphere
-----------------------

                 Key: CAMEL-5187
                 URL: https://issues.apache.org/jira/browse/CAMEL-5187
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.9.1
         Environment: WebSphere 7
            Reporter: christian ohr
            Priority: Minor


While setting up a Camel web application for WebSphere (7) I encountered two 
issues

1. Documentation: the Camel JMX docs proposes the following settings for 
WebSphere:
{code}
<camel:jmxAgent id="agent" createConnector="true" 
mbeanObjectDomainName="org.yourname" mbeanServerDefaultDomain="WebSphere"/>
{code}

This registers the beans with the PlatformMbeanServer instead of the WebSphere 
MBean server. The following setup works better:
{code}
<camel:jmxAgent id="agent" createConnector="false" 
mbeanObjectDomainName="org.yourname" usePlatformMBeanServer="false" 
mbeanServerDefaultDomain="WebSphere"/>
{code}

2. For each Camel route, the same Tracer and DefaultErrorHandler MBeans are 
tried to be registered over and over again. Because WebSphere changes the 
ObjectNames on registration, 

{{server.isRegistered(name);}} in 
{{DefaultManagementAgent#registerMBeanWithServer}} always returns false, which 
causes the MBean to be re-registered, which again cause Exceptions, e.g.

{code}
14:35:48,198 [WebContainer : 4] [] WARN  - 
DefaultManagementLifecycleStrategy.onErrorHandlerAdd(485) | Could not register 
error handler builder: ErrorHandlerBuilderRef[CamelDefaultErrorHandlerBuilder] 
as ErrorHandler MBean.
javax.management.InstanceAlreadyExistsException: 
org.apache.camel:cell=wdf-lap-0319Node01Cell,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)",context=wdf-lap-0319/camelContext,type=errorhandlers,node=wdf-lap-0319Node01,process=server1
        at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:465)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1496)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:975)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:929)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:494)
        at 
com.ibm.ws.management.PlatformMBeanServer.registerMBean(PlatformMBeanServer.java:484)
        at 
org.apache.camel.management.DefaultManagementAgent.registerMBeanWithServer(DefaultManagementAgent.java:320)
        at 
org.apache.camel.management.DefaultManagementAgent.register(DefaultManagementAgent.java:236)
...
{code}

The web application starts up, but with a lot of exceptions in the log.

Proposal:
Instead of using a Set<ObjectName> for mbeansRegistered, use a Map<ObjectName, 
ObjectName> where the key is the "Camel" ObjectName and the value is the 
actually deployed ObjectName.

I will provide a patch that illustrates the idea.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to