Re: cannot access remote server from jclient (standalone app)
Florent BENOIT <[email protected]> Mon, 21 Mar 2011 14:29:04 +0100
| Newsgroups | gmane.comp.java.objectweb.jonas |
|---|---|
| Message-ID | <[email protected]> |
Hi Benjamin, You may check that your "public.address" is not resolving to localhost and 127.0.0.1 Also, you should use in "carol.irmi.url=rmi://public.address:1099" the use of the ip address instead of the hostname. Also, try to run jclient with the "-carolFile" flag so you may check that the correct ip is used. Also, be sure to use also on the server side the "public ip" else the exported object will use 127.0.0.1 and not the public one by default. And the "random" port should be exporting port and on the client side it's used to connect to the server Regards, Florent Benjamin Jailly wrote: > *Hello jonas users,* > * > * > * > * > *I have an ear "myapp.ear" deployed on a remote server.* > *It includes a standalone client application that I am trying to > launch via jclient on my local computer.* > * > * > *so I downloaded the ear on my local machine (which as its own jonas > server) and when I call the jclient script I have the error:* > * > * > *Caused by: javax.naming.ServiceUnavailableException [Root exception > is java.rmi.ConnectException: Connection refused to host: localhost; > nested exception is: * > * > * > *with the associated trace:* > > ClientContainer.error : Can not use the JAAS authentication > There was the following exception : Can not use the JAAS authentication > org.ow2.jonas.client.ClientContainerException: Can not use the JAAS > authentication > at org.ow2.jonas.client.ClientContainer.start(ClientContainer.java:700) > at org.ow2.jonas.client.ClientContainer.main(ClientContainer.java:244) > 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.ow2.jonas.client.boot.Bootstrap.main(Bootstrap.java:103) > Caused by: javax.security.auth.login.LoginException: Error during the > login phase : Cannot retrieve the resource 'jonas_remoteres'. Check > that this resource is bound in the registry and that the server name > is correct > at > org.ow2.jonas.security.auth.spi.JResourceLoginModule.createChainedLoginException(JResourceLoginModule.java:241) > at > org.ow2.jonas.security.auth.spi.JResourceLoginModule.login(JResourceLoginModule.java:228) > 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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769) > at > javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) > at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) > at java.security.AccessController.doPrivileged(Native Method) > at > javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) > at javax.security.auth.login.LoginContext.login(LoginContext.java:579) > at org.ow2.jonas.client.ClientContainer.start(ClientContainer.java:696) > ... 6 more > Caused by: javax.security.auth.login.LoginException: Cannot retrieve > the resource 'jonas_remoteres'. Check that this resource is bound in > the registry and that the server name is correct > at > org.ow2.jonas.security.auth.spi.JResourceLoginModule.createChainedLoginException(JResourceLoginModule.java:241) > at > org.ow2.jonas.security.auth.spi.JResourceLoginModule.login(JResourceLoginModule.java:178) > ... 17 more > Caused by: javax.naming.ServiceUnavailableException [Root exception is > java.rmi.ConnectException: Connection refused to host: localhost; > nested exception is: > java.net.ConnectException: Connection refused] > at > com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101) > at javax.naming.InitialContext.lookup(InitialContext.java:396) > at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142) > at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152) > at javax.naming.InitialContext.lookup(InitialContext.java:392) > at org.ow2.carol.jndi.spi.MultiContext.lookup(MultiContext.java:117) > at javax.naming.InitialContext.lookup(InitialContext.java:392) > at javax.naming.InitialContext.lookup(InitialContext.java:392) > at > org.ow2.jonas.security.auth.spi.JResourceLoginModule.login(JResourceLoginModule.java:170) > ... 17 more > Caused by: java.rmi.ConnectException: Connection refused to host: > localhost; nested exception is: > java.net.ConnectException: Connection refused > at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601) > at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198) > at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184) > at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322) > at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) > at > com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97) > ... 25 more > Caused by: java.net.ConnectException: Connection refused > at > sun.rmi.transport.proxy.RMIMasterSocketFactory.checkConnector(RMIMasterSocketFactory.java:309) > at > sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:174) > at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595) > ... 30 more > > > from Caused by: java.rmi.ConnectException: Connection refused to host: > localhost > > > *it seems it tries to connect to my local computer. while tracing the > traffic, it does connect to the public address and* > *port 1099 (rmi) but then it failes to connect to 127.0.1.1:59354* > * > * > *my questions are * > *- does anyone know about this port ??* > *- what it means ? (obviously the host should be the remote server and > not localhost but I don't know how to set this value).* > * > * > *I tried to launch the application several time, and it is always the > same port which is called.* > * > * > *for information, here is the carol.properties in the ear in the > remote server:* > > > > > # carol.properties 1.0 02/07/15 > # > # Copyright (C) 2002 - INRIA (www.inria.fr <http://www.inria.fr>) > # > # CAROL: Common Architecture for RMI ObjectWeb Layer > # > # This library is developed inside the ObjectWeb Consortium, > # http://www.objectweb.org > # > # This library is free software; you can redistribute it and/or > # modify it under the terms of the GNU Lesser General Public > # License as published by the Free Software Foundation; either > # version 2.1 of the License, or any later version. > # > # This library is distributed in the hope that it will be useful, > # but WITHOUT ANY WARRANTY; without even the implied warranty of > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > # Lesser General Public License for more details. > # > # You should have received a copy of the GNU Lesser General Public > # License along with this library; if not, write to the Free Software > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > # USA > # > > # jonas rmi activation (iiop, jrmp, jeremie, cmi) > # In case of multiprotocols, please keep the order defined above. > carol.protocols=jrmp > > # RMI IRMI URL > carol.irmi.url=rmi://public.address:1099 > > # RMI JRMP URL > carol.jrmp.url=rmi://public.address:1099 > > # RMI IIOP URL > carol.iiop.url=iiop://public.address:2001 > > > ###################################################################### > # Advanced Configuration for IRMI > ###################################################################### > # Exported objects will listen on this port for remote method > # invocations. > #A value of 0 will cause a random port to be selected. > # This is the default value. > # Warning : if the port is set (not 0) with the value 'n', be aware that > # the port 'n + 1' will be used by the JMX server. > # So, for the firewall configuration, you have to open the port > numbers 'n' > # and 'n+1'. > carol.irmi.server.port=0 > > # Use only a single interface when creating the registry > # (specified in carol.irmi.url property) > # Use all interfaces available [default configuration = false] > carol.irmi.interfaces.bind.single=false > > > ###################################################################### > # Advanced Configuration for JRMP > ###################################################################### > # If true, local call with jrmp are optimized. If you get > "ClassCastException > # with 2 beans in different jars, you should set it at "false". > carol.jvm.rmi.local.call=false > > # If true a local Naming context is used (to be used only with a > collocated registry) > carol.jvm.rmi.local.registry=true > > # The value of this port is used to set the port of the objects listener. > # This allow to use this port for a firewall configuration. > # If registry and server are on same host, the two ports to open are > the following and the registry port. > # 0 means random port [default configuration = 0] > carol.jrmp.server.port=0 > > # Use only a single interface when creating the registry > # (specified in carol.jrmp.url property) > # Use all interfaces available [default configuration = false] > carol.jrmp.interfaces.bind.single=false > > > ###################################################################### > # Advanced Configuration for IIOP > ###################################################################### > # The value of this port is used to set the port of the objects listener. > # This allow to use this port for a firewall configuration. > # If registry and server are on same host, the two ports to open are > the following and the registry port. > # 0 means random port [default configuration = 0] > carol.iiop.server.port=0 > > # The value of this port is used to set the SSL port of the objects > listener. > # Note that this port musn't not be set to 0 as it is used for CsiV2. > # but this port is used only if SSL mode is enable. > # So by default, there is no listener on this port > # [default configuration = not used] > carol.iiop.server.sslport=2003 > > # Delegate used by JOnAS for rmi-iiop protocol > carol.iiop.PortableRemoteObjectClass=org.ow2.jonas.registry.carol.delegate.JacORBPRODelegate > > > > ###################################################################### > # Advanced JNDI Configuration > ###################################################################### > carol.jndi.java.naming.factory.url.pkgs=org.ow2.jonas.lib.naming > > > * > * > *thank you in advance for any suggestion.* > * > * > * > * > *Benjamin Jailly* > ----------------------------------------------------- > Benjamin Jailly > > Laboratoire Télécom Claude Chappe > Équipe de recherche SATIN > Bureau I012 > > TELECOM Saint-Etienne > 25 rue du Dr Rémy Annino > 42 000 Saint-Étienne > > [email protected] > <mailto:[email protected]> >