1

Hi I am trying to deploy two war files on JBOSS EAP 7.1. Both of these are spring boot Applications for which i have configured JNDI Look up. My Standalone.xml file looks like something like this..

 <datasources>
            <datasource jndi-name="java:/JNDI1" pool-name="JNDIPool1" enabled="true" use-java-context="true">
                <connection-url>jdbc:mysql://localhost:3306/test_schema</connection-url>
                <driver>mysql</driver>
                <security>
                    <user-name>test1</user-name>
                    <password>test1</password>
                </security>
            </datasource>
            <datasource jndi-name="java:/JNDI2" pool-name="JNDIPool2" enabled="true" use-java-context="true">
                <connection-url>jdbc:mysql://localhost:3306/test_schema_2</connection-url>
                <driver>mysql</driver>
                <security>
                    <user-name>test2</user-name>
                    <password>test2</password>
                </security>
            </datasource>
            <drivers>
                <driver name="mysql" module="com.mysql"/>
            </drivers>
        </datasources>

Each of thes war files uses different JNDI look up.When I deploy them at the same time One of the War gets deployed where as the other gets failed with the following error. Any help would be appreciated. Thanks.

     ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."Test.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."TEST.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "TEST.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.undertow.deployment.default-server.default-host./.session is already registered
    at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158)
    at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235)
    at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:768)
    at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223)
    at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555)
    at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223)
    at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555)
    at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.lambda$processDeployment$0(UndertowDeploymentProcessor.java:405)
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
    at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.processDeployment(UndertowDeploymentProcessor.java:405)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentProcessor.deploy(UndertowDeploymentProcessor.java:190)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
    ... 5 more
Madhu Reddy
  • 371
  • 1
  • 4
  • 12
  • Did my provided solution resolve you query ? Were you able to achieve the desired result ? Please see [What should I do when someone answers my question?](https://stackoverflow.com/help/someone-answers). As the asker, you have a special privilege: you may accept the answer that you believe is the best solution to your problem. – Amith Kumar Mar 20 '19 at 00:25
  • Hi @AmithKumar yes that did solve my issue. Thanks :) – Madhu Reddy Mar 21 '19 at 02:52
  • Great, glad I was able to help. Please accept the [answer](https://stackoverflow.com/help/accepted-answer). – Amith Kumar Mar 21 '19 at 03:12

1 Answers1

2

Please allocate different context-root for each application in web.xml. I am guessing you are using default <context-root>/</context-root>, causing DuplicateServiceException for second war. Change it to <context-root>/app1</context-root> & <context-root>/app2</context-root>

Amith Kumar
  • 4,400
  • 1
  • 21
  • 28