"java.net.BindException: Address already in use: JVM_Bind"

Have you got "java.net.BindException: Address already in use: JVM_Bind" when you start JBoss ?  Here's how to solve it.  

The most likely option is that you have still one instance of JBoss running, maybe because of an unclean shutdown. Verify from the Windows Task Manager or (Unix User) with a ps -ef that you don't have any JBoss server running.

In the unfortunate circumstance that jboss is not active then there's a process which has stolen some of JBoss default ports. The Ports number used by JBoss / WildFly are quite different, depending on the version of the application server you are using. The following section will list all the ports open by each application server version:
Ports used by WildFly / EAP 7

Port
    

Description

8080
    

HTTP Service

9080
    

Management Service

8009
    

AJP protocol (For HA Profiles)
Ports used by JBoss AS 7 / EAP 6

Port
    

Description

8080
    

HTTP Service

9080
    

Management Service (Admin Console)

9999
    

Management Service (CLI)

4447
    

Remoting

5445
    

Messaging ( Full Profile)

8009
    

AJP protocol (For HA Profiles)
Ports used by JBoss AS 5

Port
    

Description

1098,1099
    

HTTP Naming

3873
    

DefaultEjb3Connector

4444,4445,4446
    

EJB RMIObjectPort

8080
    

HTTP Service

8009
    

AJP protocol

8009
    

AJP protocol (Not active by default)

8083
    

Web services

8090,8092,8093
    

JMS ServerBindPort

Unix users:
In most Linux distributions you can use the following command to find PID-Process Name information for one user:
1
2
    
$ netstat -tulpn | grep 8080
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      22005/java

Another powerful tool is fuser which can check the processes using TCP/UDP sockets. Here is how to check which process binds a TCP Socket on port 8080:
1
    
$ fuser -v -n tcp 8080

Windows users:

You can use netstat to get network information for all processes. In the following example we make a filter on port 8080:
1
    
netstat -ano | find "8080"

You will be able to detect the process that is engaging your Port. Assuming that your PID is 1234, in order to kill it you can execute:
1
    
taskkill -pid 1234 /f

You can also use the TaskManager to kill your process. Mind it: by default the Task Manager doesn't show the PID. You have to add it from the menu View | Select columns)

If you are using older versions of JBoss, chances are that MS Office or MS OfficeCommunicator are engaging port 1098 and 1099. If you don't want to shut down these tools then your only option is using a different bind address

Mac Users:

Find pid by executing from the Terminal:
1
    
lsof -i:

Kill the process with:
1
    
kill
java.net.BindException: Cannot assign requested address:

This means that you probably are not using a correct address for one of your network interfaces configured in the application server. If you boot the application server assigning an host name
1
    
$ ./standalone.sh -b hostname

Then the file /etc/host in both Windows and Linux is used to resolve domain name into IP address, if this mapping is incorrect than you will get java.net.BindException: Cannot assign requested address: JVM_Bind.

See also this tutorial for more information about JBoss port configuration.




你可能感兴趣的:(java)