Announcement Announcement Module
No announcement yet.
Deploying webapp with multiple instances Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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: 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?

  • #2
    To provide more control over MBean naming, you can plug a different implementation of ObjectNamingStrategy into your MBeanExporter:

    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:


    • #3
      Thanks that was just what I was looking for