JAX-WS – java.net.BindException:すでに使用中のアドレス:bind
JAX-WSを使用してJava Webサービス開発を開発し、エンドポイントを公開する…
public static void main(String[]args) { Endpoint.publish("http://localhost:8080/ws/hello", new WallStreetImpl()); }
1.問題
次のエラーメッセージが表示されます。
Exception in thread "main" com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.BindException: Address already in use: bind ... Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind(Native Method) ...
2.解決策
非常に一般的なエラーメッセージです。つまり、アドレス(通常はポート番号)がすでに別のアプリケーションによって使用されています。
public static void main(String[]args) { Endpoint.publish("http://localhost:1234/ws/hello", new WallStreetImpl()); }