-
Oct 13th, 2007, 07:53 PM
#1
Deploying webapp with multiple instances
I have a webapp that defines jmx name using annotations, example
@ManagedResource(objectName="bean:name=threadPool" ,description="A pool of threads")
I start the webapp and jconsole and I can successfully view my jmx bean yeah!
I then deploy the webapp's ear again under a new name and path, example
first: /myapp
second: /yourapp
both myapp and yourapp are either the exact same webapp code (or one is using newer code ie one is last weeks and one is this weeks code) and both are pointing to separate databases.
When the myapp comes up, no problem the jmx bean comes up and is seen by jconsole as expected
But when yourapp comes up it dies because myapp is already using the desired name:
javax.management.InstanceAlreadyExistsException: bean:name=threadPool
What I would like is to have each webapps come up and have both sets of threadpool jmx beans available from jconsole.
What is the spring recommended way to handling this?
-
Oct 14th, 2007, 02:44 PM
#2
To provide more control over MBean naming, you can plug a different implementation of ObjectNamingStrategy into your MBeanExporter:
http://static.springframework.org/sp...tml#jmx-naming
Out of the box, Spring provides an IdentityNamingStrategy implementation which might help to avoid the sort of naming conflicts you describe, but if you want to have more meaningful names, you can implement your own. See the following thread for more discussion on this topic, and an example of a custom ObjectNamingStrategy which includes the servlet context name in the MBean object name:
http://forum.springframework.org/showthread.php?t=37091
Mike Bingham
-
Oct 15th, 2007, 05:44 PM
#3
Thanks that was just what I was looking for
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules