Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146086

Publishing two webservices on same port fails with "java.net.BindException: Address already in use"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b103
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        Problem reported and fix provided by Kubota Yuji:

        Publishing two services:


        Endpoint endPoint1 = Endpoint.publish("http://0.0.0.0:8081/method1",
                                                                        new Method1());
        Endpoint endPoint2 = Endpoint.publish("http://0.0.0.0:8081/method2",
                                                                         new Method2());
         
        ends with exception:
        Exception in thread "main"
        com.sun.xml.internal.ws.server.ServerRtException: Server Runtime
        Error: java.net.BindException: Address already in use
                at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:117)
                at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:64)
                at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:232)
                at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:126)
                at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
                at wstest.WSTest.main(WSTest.java:27)
        Caused by: java.net.BindException: Address already in use
                at sun.nio.ch.Net.bind0(Native Method)
                at sun.nio.ch.Net.bind(Net.java:432)
                at sun.nio.ch.Net.bind(Net.java:424)
                at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
                at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
                at sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:102)
                at sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50)
                at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
                at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130)
                at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:86)
                ... 5 more

        see http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-December/037067.html for more details.

          Activity

          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/daffd583eb35
          User: mkos
          Date: 2016-01-18 14:29:15 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/daffd583eb35 User: mkos Date: 2016-01-18 14:29:15 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/099e432fe59c
          User: mkos
          Date: 2016-01-18 14:30:14 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/099e432fe59c User: mkos Date: 2016-01-18 14:30:14 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/jaxws/rev/daffd583eb35
          User: lana
          Date: 2016-01-27 21:41:42 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jaxws/rev/daffd583eb35 User: lana Date: 2016-01-27 21:41:42 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/099e432fe59c
          User: lana
          Date: 2016-01-27 21:42:04 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/099e432fe59c User: lana Date: 2016-01-27 21:42:04 +0000

            People

            • Assignee:
              mkos Miroslav Kos (Inactive)
              Reporter:
              mkos Miroslav Kos (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: