Do you have firewall enabled on w$?

On Mon, Jan 31, 2011 at 2:17 PM, jb <[email protected]> wrote:
> Hi,
>
> I encounter an error using MINA 2, and I can't find any solution, the error
> message is
> "org.apache.mina.core.RuntimeIoException: Failed to initialize"
> Caused by
> "java.io.IOException: Unable to establish loopback connection"
>
> I searched a lot on google, and did a lot of experiment, but can't find any
> solution, so I'm wondering if someone could give me idea of new things to
> look for (even if you don't have answer, ideas are welcome), or someone
> already encountered this error and solved it.
>
> The application is quite complex, but to sum up, it's a server/client
> architecture, there is usually on one JVM (OSGi framework):
> - 2 servers
> - 1 client
> And a second JVM usually connects to the first as a client (to get its
> status)
>
> In a real case there are other hosts with clients that connect to the first,
> but here it doesn't matter.
>
> The problem happens when I close the server and reopen it, sometimes (it's
> random, it usually happens 1 time for 3 tries) one of the server fails to
> start, displaying this error:
> org.apache.mina.core.RuntimeIoException: Failed to initialize.
>  org.apache.mina.core.polling.AbstractPollingIoAcceptor.<init>(AbstractPollingIoAcceptor.java:207)
>  org.apache.mina.core.polling.AbstractPollingIoAcceptor.<init>(AbstractPollingIoAcceptor.java:104)
>  org.apache.mina.transport.socket.nio.NioSocketAcceptor.<init>(NioSocketAcceptor.java:66)
>  com.xx.backbone.communication.AbstractServer.createServer(AbstractServer.java:163)
>  com.xx.backbone.communication.BackboneManagerAPI.bind(BackboneManagerAPI.java:76)
>  com.xx.backbone.agent.BackboneAgent.<init>(BackboneAgent.java:57)
>  com.xx.backbone.osgi.agent.AgentActivator.start(AgentActivator.java:58)
>  org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
>  org.apache.felix.framework.Felix.activateBundle(Felix.java:1827)
>  org.apache.felix.framework.Felix.startBundle(Felix.java:1744)
>  org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
>  org.apache.felix.framework.BundleImpl.start(BundleImpl.java:909)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1133)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1119)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1112)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:430)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:238)
> Caused by : java.io.IOException: Unable to establish loopback connection
>  sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
>  java.security.AccessController.doPrivileged(Native Method)
>  sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
>  sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
>  java.nio.channels.Pipe.open(Pipe.java:133)
>  sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:104)
>  sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
>  java.nio.channels.Selector.open(Selector.java:209)
>  org.apache.mina.transport.socket.nio.NioSocketAcceptor.init(NioSocketAcceptor.java:110)
>  org.apache.mina.core.polling.AbstractPollingIoAcceptor.<init>(AbstractPollingIoAcceptor.java:199)
>  org.apache.mina.core.polling.AbstractPollingIoAcceptor.<init>(AbstractPollingIoAcceptor.java:104)
>  org.apache.mina.transport.socket.nio.NioSocketAcceptor.<init>(NioSocketAcceptor.java:66)
>  com.xx.backbone.communication.AbstractServer.createServer(AbstractServer.java:163)
>  com.xx.backbone.communication.BackboneManagerAPI.bind(BackboneManagerAPI.java:76)
>  com.xx.backbone.agent.BackboneAgent.<init>(BackboneAgent.java:57)
>  com.xx.backbone.osgi.agent.AgentActivator.start(AgentActivator.java:58)
>  org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
>  org.apache.felix.framework.Felix.activateBundle(Felix.java:1827)
>  org.apache.felix.framework.Felix.startBundle(Felix.java:1744)
>  org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
>  org.apache.felix.framework.BundleImpl.start(BundleImpl.java:909)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1133)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.start(DirectoryWatcher.java:1119)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1112)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:430)
>  org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:238)
>
> Searching Google tells me there could be error when initializing
> NioSocketAcceptor/NioSocketConnector, but I think I did the things correct,
> the NioSocketConnector is instantiated only once (in a thread safe context)
> and disposed only at the end of the application.
> The NioSocketAcceptor is instantiated twice, because the handler and bind
> ports are different (<-- maybe I'm wrong here, but I can't see an other way
> to do it). The 2 NioSocketAcceptor are thread safe too (they can't be
> instantiated at the same time)
>
> I'm using a TextLineCodecFactory and a sslFilter.
>
> The initialization code is (simplified):
> acceptor = new NioSocketAcceptor(); // <--- Error happears here !
> acceptor.getFilterChain().addFirst("sslFilter",
> SslConfiguration.getSslFilter(false));
> acceptor.getFilterChain().addLast("codec", new
> ProtocolCodecFilter(ProtocolCodec.getTextCodec()));
> acceptor.setReuseAddress(true);
> acceptor.getSessionConfig().setTcpNoDelay(true);
> acceptor.setHandler(abstractServerHandler);
> acceptor.bind(new InetSocketAddress(port));
>
> Futhermore the problem happears only on windows (sun jvm 1.6, last version),
> I tested on other OS (linux, aix (ibm jvm), hpux, solaris) they are all
> perfect, it's a windows specific problem.
>
> I hope I gave you enough details. All ideas/remarks are welcome, because I'm
> lost and don't know what to do.
>
> Thanks,
> Regards,
> jb
>



-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal

Reply via email to