Problem

In Java web service development, JAX-WS, when an end point is published,

public static void main(String[] args) {
   Endpoint.publish("http://localhost:8080/ws/hello", new WallStreetImpl());
}

It hits the following error message.

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

Solution

A very common error message, it mean your address (usually it is the port number) is already in used by other application. Try change your port number for the end point publisher.

public static void main(String[] args) {
   Endpoint.publish("http://localhost:1234/ws/hello", new WallStreetImpl());
}
Tags :
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.
My website mkyong.com is hosted by Liquid Web, I really like their fast and helpful support, it saved me a lot of time. Furthermore, their servers are extremely reliable, fast and stable, I don't remember when was the last time we had server downtime. Btw, they're offering $100 Coupon now, if you are sourcing for great hosting provider, go grab it.

Related Posts

Popular Posts