Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-7643

JAX-WS Webservice endpoint naming conflict between different virtual hosts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 10.1.0.Final, 11.0.0.Alpha1
    • Web Services
    • None
    • Hide

      1. Start with a default wildfly 11 Alpha install ( the bug affects 10.1 as well)
      2. Create aliases for two different hostnames on localhost. I am using hosta and hostb in this case.
      3. Add the virtualhost elements to the config according to config-fragment.xml
      4. Build a WAR from the attached Hello.java and jboss-web.xml
      5. Build another war, this time changing the value of the virtualhost element in jboss-web.xml to hostb
      6. Deploy the first WAR
      7. Deploy the second WAR, get the following exception:

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."ws-virtualhost-testcase2.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ws-virtualhost-testcase2.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "ws-virtualhost-testcase2.war"  
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)  
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1963)  
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1896)  
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
          at java.lang.Thread.run(Thread.java:745)  
      Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ws.endpoint.context=."helloservice.endpoint.Hello" is already registered  
          at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158)  
          at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:239)  
          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:2416)  
          at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223)  
          at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2416)  
          at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317)  
          at org.jboss.as.webservices.service.EndpointService.install(EndpointService.java:228)  
          at org.jboss.as.webservices.deployers.EndpointServiceDeploymentAspect.start(EndpointServiceDeploymentAspect.java:50)  
          at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)  
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)  
          ... 5 more  
      
      Show
      1. Start with a default wildfly 11 Alpha install ( the bug affects 10.1 as well) 2. Create aliases for two different hostnames on localhost. I am using hosta and hostb in this case. 3. Add the virtualhost elements to the config according to config-fragment.xml 4. Build a WAR from the attached Hello.java and jboss-web.xml 5. Build another war, this time changing the value of the virtualhost element in jboss-web.xml to hostb 6. Deploy the first WAR 7. Deploy the second WAR, get the following exception: ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit. "ws-virtualhost-testcase2.war" .INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit. "ws-virtualhost-testcase2.war" .INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "ws-virtualhost-testcase2.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1963) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1896) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang. Thread .run( Thread .java:745) Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.ws.endpoint.context=. "helloservice.endpoint.Hello" is already registered at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158) at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:239) 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:2416) at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2416) at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317) at org.jboss.as.webservices.service.EndpointService.install(EndpointService.java:228) at org.jboss.as.webservices.deployers.EndpointServiceDeploymentAspect.start(EndpointServiceDeploymentAspect.java:50) at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) ... 5 more

    Description

      When deploying identically named POJO JAX-WS webservice endpoints into different virtualhosts with the same context, the ServiceName generated for the second deployment conflicts with the first one, and the deployment fails with org.jboss.msc.service.DuplicateServiceException.

      This can be worked around by defining the endpoint as a servlet, and giving globally distinct <servlet-name> s to them.

      I think the cause for the bug is that the ServiceName for the Endpoint is in a server instance namespace, but the the name is generated from only the endpoint name, and the context, which is not unique among deployments on different virtual hosts.

      Adding the virtual host to the generated name would make the service name unique, and should also allow routing to it based on virtualhost info by web server.

      In the test case the names could be for example jboss.ws.endpoint.vhost="hosta".context=."helloservice.endpoint.Hello" and jboss.ws.endpoint.vhost="hostb".context=."helloservice.endpoint.Hello" .

      Attachments

        1. Hello.java
          0.3 kB
        2. jboss-web.xml
          0.4 kB
        3. vhost-config-fragment.xml
          0.6 kB

        Activity

          People

            rhn-engineering-ema Jim Ma
            stoty2 István Tóth (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: