JBoss Port in Use Errors

Sometimes I get errors like this on boot:

ObjectName: jboss:service=Naming
  State: FAILED
  Reason: java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
        java.net.BindException: Address already in use: JVM_Bind
  I Depend On:
    jboss.system:service=ThreadPool
  Depends On Me:
    jboss.ws:service=WebServiceClientDeployer
    jboss.mq:service=DestinationManager
    jboss.mq:service=Invoker
    jboss.mq:service=InvocationLayer,type=UIL
    jboss.mq:service=InvocationLayer,type=UILXA
    jboss.mq:service=InvocationLayer,type=UIL2,alias=UIL2ConnectionFactory
    jboss.mq:service=InvocationLayer,type=UIL2XA,alias=UIL2XAConnectionFactory
    jboss.jms:alias=QueueConnectionFactory
    jboss.jms:alias=TopicConnectionFactory
    jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory
    jboss.jmx:alias=jmx/rmi/RMIAdaptor

If this happens, something else on the box has grabbed that port. Check with netstat:

C:\>netstat

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    AA123:1597          a72-247-242-64.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1599          a72-247-242-200.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1616          a72-247-242-210.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1617          a72-247-242-210.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1620          a72-247-242-147.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1636          a72-247-242-24.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1640          a72-247-242-73.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1644          a72-247-242-33.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1646          a72-247-242-16.deploy.akamaitechnologies.com:http  ESTABLISHED
  TCP    AA123:1668          ar-in-f19.google.com:http  ESTABLISHED
  TCP    AA123:1676          dev02:9080  CLOSE_WAIT
  TCP    AA123:1151          localhost:1152         ESTABLISHED
  TCP    AA123:1152          localhost:1151         ESTABLISHED
  TCP    AA123:1153          localhost:1154         ESTABLISHED
  TCP    AA123:1154          localhost:1153         ESTABLISHED
  TCP    AA123:16386         localhost:1675         TIME_WAIT
  TCP    AA123:16386         localhost:1677         TIME_WAIT

Here, you can see that there is a connection on port 1098 to dev02. Sometimes, Outlook and/or Google Talk try to grab that port, too. Shutting down programs doesn't seem to release it. Only a reboot fixes it.

The solution seems to be either to reboot and hope it doesn't happen the next time, or change the port that JBoss uses. To change the port, edit the jboss-minimal.xml and jboss-service.xml files in the server directories and look for the RmiPort:

    <attribute name="RmiPort">1098</attribute>

I just changed the port to 11098 in both files and rebooted. That solved my problem that day, and I haven't seen it since.

JBossPortInUse (last edited 2008-07-09 06:21:52 by localhost)