Results 1 to 7 of 7

Thread: How to deploy two different Spring Batch wars to one Tomcat?

  1. #1
    Join Date
    Aug 2010
    Posts
    9

    Default How to deploy two different Spring Batch wars to one Tomcat?

    Hi,

    I’m using Spring Batch 2.1.5, Spring Batch Admin 1.2.0, Spring Batch Infrastructure 2.1.1 and Tomcat 6.0.32.

    I want to deploy two different Spring Batch WAR applications on same Tomcat. And I get following exception:

    Caused by: org.springframework.jmx.export.UnableToRegisterMBe anException: Unable to register MBean [org.springframework.batch.admin.jmx.BatchMBeanExpo rter@1c70e21] with key 'batchMBeanExporter'; nested exception is javax.management.InstanceAlreadyExistsException: spring.application:name=batchMBeanExporter,type=Ba tchMBeanExporter


    I have defined beans of type BatchMBeanExporter in both applications (beans ids are changed).

    Somebody had similar problems?
    Could someone give me some advice about this?

    Thanks in advance.

  2. #2
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    looks like a conflict, did you try the domainName property in BatchMBeanExporter?

    BTW, you should use the same version for all your Spring Batch dependencies.

  3. #3
    Join Date
    Aug 2010
    Posts
    9

    Default How to deploy two different Spring Batch wars to one Tomcat?

    Hi Arno,
    Thanks for the answer.

    I change values of Spring Batch core and Spring Batch Infrastructure to 2.1.8 and try to change value of property 'domain', but problem is not solved.

    Here is the BatchMBeanExporter bean definition:
    Code:
    <bean id="customBatchMBeanExporter" class="org.springframework.batch.admin.jmx.BatchMBeanExporter"
            p:jobService-ref="jobService"
            p:defaultDomain="com.telegraaf.relatieplanet.findmatches" />
    I got the same exception after these changes:
    Code:
    Caused by: org.springframework.jmx.export.UnableToRegisterMBe anException: Unable to register MBean [org.springframework.batch.admin.jmx.BatchMBeanExpo rter@1c70e21] with key 'batchMBeanExporter'; nested exception is javax.management.InstanceAlreadyExistsException: spring.application:name=batchMBeanExporter,type=Ba tchMBeanExporter
    Should I re-define some more beans? Or, should I change some more properties in BatchMBeanExporter bean definition?


    Quote Originally Posted by arno View Post
    looks like a conflict, did you try the domainName property in BatchMBeanExporter?

    BTW, you should use the same version for all your Spring Batch dependencies.

  4. #4
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    is there's a <context:mbean-export/> somewhere?

  5. #5
    Join Date
    Aug 2010
    Posts
    9

    Default

    Yes, there is a <context:mbean-export /> at the begin of spring batch context file.
    I'm getting the same exception with and without this.

    Quote Originally Posted by arno View Post
    is there's a <context:mbean-export/> somewhere?

  6. #6
    Join Date
    Dec 2005
    Location
    Lyon, France
    Posts
    311

    Default

    try to set the default-domain attribute of mbean-export to a different value in each web app.

  7. #7
    Join Date
    Aug 2010
    Posts
    9

    Default How to deploy two different Spring Batch wars to one Tomcat?

    Hi,
    I try following things:
    Code:
    <context:mbean-export default-domain="test.mbean.bean1" registration="ignoreExisting" />
    and
    Code:
    <context:mbean-export default-domain="test.mbean.bean1" registration="replaceExisting" />
    with and without custom definition of
    org.springframework.batch.admin.jmx.BatchMBeanExpo rter

    But, it didn't help...

    I decide to change implementation of these background services (they will be run as command line services).

    Thanks for your help.

    Quote Originally Posted by arno View Post
    try to set the default-domain attribute of mbean-export to a different value in each web app.
    Last edited by piffta; Jun 29th, 2011 at 08:57 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •