Monday, December 23, 2013

Glassfish unable to start in Windows 8 with "Unable to establish loopback connection" Error

I was trying to run Glassfish from windows 8 machine. Every time it starts it was throwing following error

Shutting down server due to startup exception
java.io.IOException: Unable to establish loopback connection
        at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
        at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.nio.ch.PipeImpl.(Unknown Source)
        at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
        at java.nio.channels.Pipe.open(Unknown Source)
        at sun.nio.ch.WindowsSelectorImpl.(Unknown Source)
        at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
        at org.glassfish.grizzly.nio.Selectors.newSelector(Selectors.java:62)
        at org.glassfish.grizzly.nio.SelectorRunner.create(SelectorRunner.java:110)
        at org.glassfish.grizzly.nio.NIOTransport.startSelectorRunners(NIOTransport.java:136)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.start(TCPNIOTransport.java:272)
        at org.glassfish.grizzly.config.GenericGrizzlyListener.start(GenericGrizzlyListener.java:169)
        at com.sun.enterprise.v3.services.impl.GlassfishNetworkListener.start(GlassfishNetworkListener.java:94)
        at com.sun.enterprise.v3.services.impl.GrizzlyProxy.start(GrizzlyProxy.java:230)
        at com.sun.enterprise.v3.services.impl.GrizzlyService.createNetworkProxy(GrizzlyService.java:470)
        at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:393)
        at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:281)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:328)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:163)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:673)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:660)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneJob.run(CurrentTaskFuture.java:490)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpAllTheWay.go(CurrentTaskFuture.java:362)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpAllTheWay.access$100(CurrentTaskFuture.java:279)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture.go(CurrentTaskFuture.java:113)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.proceedTo(AsyncRunLevelContext.java:296)
        at org.glassfish.hk2.runlevel.internal.RunLevelControllerImpl.proceedTo(RunLevelControllerImpl.java:66)
        at com.sun.enterprise.v3.server.AppServerStartup.proceedTo(AppServerStartup.java:532)
        at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:329)
        at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:226)
        at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:217)
        at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
        at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
        at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl.start(EmbeddedOSGiGlassFishImpl.java:75)
        at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
        at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:71)
        at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
        at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: java.net.ConnectException: Connection timed out: connect
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at java.nio.channels.SocketChannel.open(Unknown Source)

After 30-45 mins of Google and Struggle I understood that  it is the problem with IPV6.

So It got fixed when I following lines in



glassfish\domains\domain1\config\domain.xml
-Djava.net.preferIPv4Stack=true
I have suggested this answer in stack overflow as well http://stackoverflow.com/questions/16859411/glassfish-server-started-failed-in-netbeans-6-9?answertab=active#tab-top

1 comment:

Udaya Sri Sri Kariyawasam (උදය ශ්‍රී) said...

HELP ME TO SOLVE THIS ERROR
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
2014-04-21T23:52:04.482-0700|SEVERE: Application previously deployed is not at its original location any more: file:/D:/glassfish-4.0/glassfish4/glassfish/domains/domain1//eclipseApps/lol/
2014-04-21T23:52:04.599-0700|INFO: GlassFish Server Open Source Edition 4.0 (89) startup time : Felix (4,764ms), startup services(2,283ms), total(7,047ms)
2014-04-21T23:52:04.599-0700|SEVERE: Shutting down server due to startup exception
java.lang.NullPointerException
at org.glassfish.grizzly.config.GenericGrizzlyListener.configureProtocol(GenericGrizzlyListener.java:323)
at org.glassfish.grizzly.config.GenericGrizzlyListener.configure(GenericGrizzlyListener.java:243)
at com.sun.enterprise.v3.services.impl.GrizzlyProxy.initialize(GrizzlyProxy.java:120)
at com.sun.enterprise.v3.services.impl.GrizzlyService.createNetworkProxy(GrizzlyService.java:442)
at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:393)