Announcement Announcement Module
Collapse
No announcement yet.
How to deploy two different Spring Batch wars to one Tomcat? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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?


      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.

      Comment


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

        Comment


        • #5
          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.

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

          Comment


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

            Comment


            • #7
              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.

              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, 09:57 AM.

              Comment

              Working...
              X