WSO2Con 2013 CFP Banner

java.net.BindException: "Address already in use: JVM_Bind" while trying to start the server. Why?

By Deepal Jayasingha
Date: Tue, 13th Jun, 2006
Level:
Reads: 31937 Discuss this article on Stack Overflow

Q : When I run my client I got java.net.BindException: "Address already in use: JVM_Bind" while trying to start the server.

Deepal Jayasingha

WSO2 Inc.
A : When you invoke a service using two channels, service client start up SimpleHTTPServer in port 6060 (this is the default port specified in axis2.xml), the server will not stop unless you call serviceClent.finalizeInvoke();

So when you try to invoke the service a second time in the same manner, you will get the above mentioned exception as Axis2 tries to start up SimpleHTTPServer in the same port (6060).

There are two solutions to this problem:

1.Reuse service client for all invocation

2.First create configuration context and then create any number of service clients using the created configuration context.

WSO2Con 2014