JBoss, eclipse and port bindings

please close the door

via Flickr by Aeioux

Starting JBoss (5.1.x) from eclipse (3.5.x) it could happen that you get an exception like the following:

15:26:51,530 ERROR [Naming] Could not start on port 1099
java.net.BindException: Address already in use: JVM_Bind
 at java.net.PlainSocketImpl.socketBind(Native Method)
 at java.net.PlainSocketImpl.bind(Unknown Source)
 at java.net.ServerSocket.bind(Unknown Source)
 at java.net.ServerSocket.<init>(Unknown Source)
 at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown Source)
 at org.jnp.server.Main.initBootstrapListener(Main.java:480)
 at org.jnp.server.Main.start(Main.java:427)
 ...

It’s because you have a port already in use. In this case it the port used for Naming service. While changing port from the eclipse editor didn’t work, you can (after stopping the server), open the file

$JBOSS_HOME/server/$PROFILE/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

search for the desired port (in this case 1099) and then change it to a new value (in my case 1199 was free).

<!-- Naming Service -->
 <bean>
 <property name="serviceName">jboss:service=Naming</property>
 <property name="bindingName">Port</property>
 <property name="port">1199</property>
 <property name="description">The listening socket for the Naming service</property>
 </bean>

save and start the server.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s