Hi William Let's revisit the strategies for naming mbeans in Camel 1.5, considering there are shared endpoints in routes that should only be registered once and then we have individual processors etc in route paths.
The current behavior is to check if the mbean is already registered with the Boolean method for this. I think that is the best solution than catch InstanceAlreadyRegisteredExceptions. But again we should get 1.4 out of the door, and then there is good time to improve the JMX agent even further. Med venlig hilsen Claus Ibsen ...................................... Silverbullet Skovsgårdsvænget 21 8362 Hørning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: William Tam [mailto:[EMAIL PROTECTED] Sent: 17. juli 2008 17:04 To: [email protected] Subject: Re: How can avoid to have such error message "instanceAllreadyExistsException" ? Hi Claus and Charles, 1) Claus, you were right when you said it was a warning. The stack does show where it was logged but here is where it happened. The InstrumentationLifecycleStrategy.onRoutes.Add() method caught the exception (InstanceAlreadyExistsException is a type of JMException) thrown by DefaultInstrumentation.registerMBeanWithServer() and log a warning message. for (Route route : routes) { try { ... agent.register(mr, getNamingStrategy().getObjectName(mr)); } catch (JMException e) { LOG.warn("Could not register Route MBean", e); } } 2) Charles, looking at the message, it failed to register a route that has a duplicated objectname. I am wondering if you have two routes within a CamelContext that have an identiical "from" endpoint uri? (The naming strategy for managed route is in part based on the from endpoint.) If so, I wonder if it could create a race condition between the two route (i.e. both routes listen/poll from the same destination). 3) As the result of the exception, only one of the two routes is registered with the MBean server. If having a common from endpoint within a CamelContext is valid, we should support managing multiple routes that has the same "from" endpoint. So, we need to fix the naming strategy. 4) I'd like to point out that testing for existing objectname in DefaultInstrumentionaAgent is probably not reliable running in WebSphere as as our (intended) objectname will be different than the actual name used in registration. 5) I am not sure I would degrade it to debug level as it (has helped)/helps us to discover real issues (earilier). On Thu, Jul 17, 2008 at 5:49 AM, Claus Ibsen <[EMAIL PROTECTED]> wrote: > Hi Charles > > I have committed a fix. Could you test it? > > Would take 2-3 hours before the CI server has pushed a new 1.4-SNAPSHOT build > today. > > The bug is reported at CAMEL-732 > https://issues.apache.org/activemq/browse/CAMEL-732 > > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > -----Original Message----- > From: Claus Ibsen [mailto:[EMAIL PROTECTED] > Sent: 17. juli 2008 10:30 > To: [email protected] > Subject: RE: How can avoid to have such error message > "instanceAllreadyExistsException" ? > > Hi > > Sorry my bad it used to be a WARN I think, but I can see it's thrown. > I will relax it to a DEBUG message with a hint that this is okay and Camel > will continue. > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: Claus Ibsen [mailto:[EMAIL PROTECTED] > Sent: 17. juli 2008 10:25 > To: [email protected] > Subject: RE: How can avoid to have such error message > "instanceAllreadyExistsException" ? > > Hi > > It's not an ERROR it's a WARN. Camel will work fine. > > As it's the same JMS queue we can not create 3 different mbeans for it in the > JMX tree. We had an issue before where each of them will get their own > instance number 0, 1, 2 etc. But as you write it's the same endpoint. > > Maybe the WARN logging is to aggressive and should just be DEBUG and without > the stacktrace - it's of no use. > > Let me take a look. > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: cmoulliard [mailto:[EMAIL PROTECTED] > Sent: 17. juli 2008 10:14 > To: [email protected] > Subject: How can avoid to have such error message > "instanceAllreadyExistsException" ? > > > Hi, > > I have created different routes hosted in two different packages. > > Package : com.myApplication.routing.in > Class : RouteA > Class : RouteB > ... > > Package : com.myApplication.routing.out > Class : RouteC > > In the RouteB and RouteC, we have a common endpoint which is > "activemq:queue:myqueue". > > During the launch of Camel, I have the following error : > > <camelContext id="camel" > xmlns="http://activemq.apache.org/camel/schema/spring"> > <package>com.myapplication.routing.in</package> > <package>com.myapplication.routing.out</package> > </camelContext> > > 43javax.management.InstanceAlreadyExistsException: > org.apache.camel:context=dell-charles/camel,[EMAIL > PROTECTED],type=route,[EMAIL PROTECTED] > 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) > > How to solve this ? > > Regards, > > Charles Moulliard > > > ----- > Enterprise Architect > > Xpectis > 12, route d'Esch > L-1470 Luxembourg > > Phone +352 25 10 70 470 > Mobile +352 621 45 36 22 > > e-mail : [EMAIL PROTECTED] > web site : www.xpectis.com > -- > View this message in context: > http://www.nabble.com/How-can-avoid-to-have-such-error-message-%22instanceAllreadyExistsException%22---tp18503700s22882p18503700.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
