-
1. Re: Can a remote client call a bean on a private network?
adamwynne Mar 15, 2006 8:11 PM (in response to adamwynne)I tried port forwarding again on the head node from the external to internal NIC for all the ports listed in one of the firewall docs:
http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch8.chapter.html#d0e21126
But, still no luck. However, now the client is hanging during the ctx.lookup(...) call. Running netstat -n on the server shows that I am connected to port 1099 on the internal interface (in state FIN_WAIT_1). Any ideas? -
2. Re: Can a remote client call a bean on a private network?
raist_majere Mar 16, 2006 4:18 AM (in response to adamwynne)In your first post it syas on the error log that you're trying to connect to 192.168.10.1, but that's the private IP, so you cannot access it from the public side of the net. You have to change it for the public IP of the "head" node.
-
3. Re: Can a remote client call a bean on a private network?
adamwynne Mar 16, 2006 5:31 PM (in response to adamwynne)Hi,
Thanks for your response :)
Actually, I am attempting to connect to the public interface(by using jnp://public.address.of.headnode in my jndi.properties). However, the initial error message I posted references the private address because that is the interface jboss is deployed to. I now believe that error was coming from the client machine, who was refusing to accept the response from the internal interface of the head node.
I have since gotten one step further by following the steps in the wiki firewall article (although mine isn't exactly a firewall issue): http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall.
Specifically, I followed the steps in that wiki which say to add the following to my run.bat script:-Djava.rmi.server.hostname=<external_host_name> -Djava.rmi.server.useLocalHostname=false
This allows me to to a jnp lookup from the client and to receive the EJB stub from the server. However, now my problem is that the subsequent call to the EJB method fails due to a failed connection to a socke. This is the stack trace I get when the client fails:[java] Exception in thread "main" java.lang.RuntimeException: cluster invoc ation failed, last exception was: [java] at org.jboss.aspects.remoting.ClusterChooserInterceptor.invoke(C lusterChooserInterceptor.java:129) [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv ocation.java:98) [java] at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(Cl ientTxPropagationInterceptor.java:61) [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv ocation.java:98) [java] at org.jboss.aspects.security.SecurityClientInterceptor.invoke(S ecurityClientInterceptor.java:55) [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv ocation.java:98) [java] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInte rceptor.java:65) [java] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInv ocation.java:98) [java] at org.jboss.ejb3.stateless.StatelessClusteredProxy.invoke(State lessClusteredProxy.java:100) [java] at $Proxy0.test(Unknown Source) [java] at clustering.client.StatelessRun.main(StatelessRun.java:20) [java] Caused by: org.jboss.remoting.CannotConnectException: Can not get co nnection to server. Problem establishing socket connection.
I have read elsewhere that RMI will use a random port (besides the ones configured in server/all/conf/jboss-service.xml). Is this the case? How can I cause that port to be fixed or to learn which port this is at runtime?
In another forum message (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=78833), it was suggested to implement my own RMISocketFactory. Is this what I need to do? -
4. Re: Can a remote client call a bean on a private network?
adamwynne Mar 16, 2006 5:55 PM (in response to adamwynne)Here is another recent thread with someone having the same problem. I am running the same version of JBOSS and EJB3RC5. There must be a solution for this.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=79325&start=0 -
5. Re: Can a remote client call a bean on a private network?
adamwynne Mar 16, 2006 6:54 PM (in response to adamwynne)FIXED!
The solution is to use the following annotation in your bean:@RemoteBinding(clientBindUrl="socket://public.host.address:3873")
The port 3873 is defined in the file server/all/deploy/ejb3.deployer/META-INF/jboss-service.xml:<server> <mbean code="org.jboss.remoting.transport.Connector" xmbean-dd="org/jboss/remoting/transport/Connector.xml" name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler= ejb3"> <depends>jboss.aop:service=AspectDeployer</depends> <!-- attribute name="InvokerLocator">socket://0.0.0.0:3873</attribute --> <attribute name="InvokerLocator">socket://0.0.0.0:3873</attribute> <attribute name="Configuration"> <handlers> <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvoc ationHandler</handler> </handlers> </attribute> </mbean> ...
The following is the best thread I found on this topic is here: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3877360. However, in contrast to that thread, I found that I did not need to explicitly state the external ip address in the above file. The default setting of 0.0.0.0:3873 works, which is good.