22
votes


I'm using JBoss 4.0.5 GA on Windows 7 with Java version 1.5 (I have to use older java version and a JBoss because I'm working with a legacy system). And when I'm starting the server I get the following error:

java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind  

And I believe this causes many other exceptions:

11:09:26,925 WARN  [ServiceController] Problem starting servicejboss.cache:service=TomcatClustering Cache
java.lang.NullPointerException
    at org.jgroups.protocols.FD_SOCK.down(FD_SOCK.java:235)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FD.down(FD.java:278)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.stack.Protocol.down(Protocol.java:540)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.NAKACK.down(NAKACK.java:297)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.UNICAST.down(UNICAST.java:262)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:292)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.GMS.down(GMS.java:605)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FC.down(FC.java:122)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.FRAG2.down(FRAG2.java:146)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.Protocol.passDown(Protocol.java:510)
    at org.jgroups.protocols.pbcast.STATE_TRANSFER.down(STATE_TRANSFER.java:217)
    at org.jgroups.stack.Protocol.receiveDownEvent(Protocol.java:467)
    at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:331)
    at org.jgroups.JChannel.down(JChannel.java:1035)
    at org.jgroups.JChannel.connect(JChannel.java:374)
    at org.jboss.cache.TreeCache.startService(TreeCache.java:1424)
    at org.jboss.cache.aop.PojoCache.startService(PojoCache.java:94)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:417)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy8.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)

    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:417)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy5.deploy(Unknown Source)
    at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
    at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
    at org.jboss.Main.boot(Main.java:200)
    at org.jboss.Main$1.run(Main.java:490)
    at java.lang.Thread.run(Thread.java:619)  

I greatly appreciate if anyone could help. At least to figure out where I should look for the solution (e.g. Is this an error related to windows 7 and JBoss clustering incompatability? Is this because of a wrong port configuration? etc.)

Thanks.

11
I had to swtich my OS to find a quick solution. So if someone could please point me out if there's a solution among the current answers. then I'll mark it as the answer for the benefit of the community.Shamal Karunarathne
I have the same error, but it has appeared by itself. Selenium used to work, and now it fails to start. Surely a reboot of Windows will fix this, but I am looking for a nicer solution. Relaunching Eclipse was not enough.Nicolas Barbulesco

11 Answers

32
votes

This problem occurs on some Windows systems that have the IPv6 TCP Stack installed. If both IPv4 and IPv6 are installed on the computer, the Java Virtual Machine (JVM) may have problems closing or opening sockets at the operating system level.

Add the following JVM option: -Djava.net.preferIPv4Stack=true

I've seen this happen on Windows 7 and Windows 2008 systems which have both IPv4 and IPv6 stacks installed by default.

15
votes

You have very likely another process already bound on a port that JBoss is using (8080?) and this prevent JBoss from starting correctly (see this page for a list of ports used by JBoss).

Either find the conflicting process and shut it down:

  • use netstat -a -o -n and look for ports used by JBoss (e.g. 8080) and the corresponding pid
  • then use tasklist /FI "PID eq <pid>" to find the process

Or change JBoss defaults ports. There are several ways to do that but the best way is to use the Service Binding Manager (see detailed instructions in Configuring Multiple JBoss Instances On One Machine).

3
votes

I ran into the same issue on Win7 trying to implement the example here: http://download.oracle.com/javase/tutorial/networking/sockets/clientServer.html

The default port in the example code is 4444. Using this port I got "Unrecognized Windows Sockets error: 0: JVM_Bind"

I changed the port to 44444 and tried again. I got a popup from the Windows Firewall service asking me if this application had permission to access the network. Selecting OK I no longer get the error message when I launch my server.

After some experimenting I found that with a port of 5000 or less I would get the JVM_Bind error. Any port of 5001 or above would bind without issue.

3
votes

I had similar problem. I used process-xp and kill javaw.exe, then restart the application. It works for me.

2
votes

It's problem of JAVA 32/64 bit. try run your jar with 32 bit JVM

2
votes

I was having this issue with my Tomcat and it turned to be a port conflict with Skype. In my Skype->Options->Advanced->Connection I unchecked the following "Use port 80 and 443 as alternatives for incoming connections". This solved the problem completely.

2
votes

this solved my problem :) Add the following JVM option: -Djava.net.preferIPv4Stack=true

2
votes

I had the same issue with Tomcat on Windows 10. Added this to the catalina.bat file near the top:

SET JAVA_OPTS=-Djava.net.preferIPv4Stack=true
1
votes

I know this is an old issue, but I've just recently figured out one cause of the issue, as well as the solution. My server socket program worked fine until I put the code into a loop, then I got the error Unrecognized Windows Sockets error: 0: JVM_Bind on every attempt to accept() after the first attempt. I had code like this:

ServerSocket ssock = null;
Socket sock = null;

while (loopCount < loopLimit) {
    ssock = new ServerSocket(port);
    ssock.setSOLimit(millis);
    sock = ssock.accept();
    // some code here...
    loopCount++;
}

It was only when I put ssock = new ServerSocket(port) and ssock.setSOLimit(millis); above the loop that I eliminated the error.

0
votes

open command prompt as administrator. Then do a netsh winsock reset

0
votes

I hade to add SystemRoot parameter in java parameters. I dont don't know why java doesn't have this parameter. It was working before. With

SystemRoot=C:\Windows

it works. I execute the java as Windows service nssm.