Java 远程EJB接口不能在internet上工作

Java 远程EJB接口不能在internet上工作,java,ejb-3.0,remoting,amazon-web-services,Java,Ejb 3.0,Remoting,Amazon Web Services,我有一个EJB容器,它部署在JBoss5.1上的AmazonAWS Fedora8虚拟机上。我有另一个应用程序,我想通过internet远程访问这个EJB容器。但我得到了以下例外 javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: xxx.xxx.xx.x; nested exception is: java.net.Connec

我有一个EJB容器,它部署在JBoss5.1上的AmazonAWS Fedora8虚拟机上。我有另一个应用程序,我想通过internet远程访问这个EJB容器。但我得到了以下例外

javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: xxx.xxx.xx.x; nested exception is: java.net.ConnectException: Connection timed out]

Caused by: java.rmi.ConnectException: Connection refused to host: xxx.xxx.xx.x; nested exception is: java.net.ConnectException: Connection timed out

Caused by: java.net.ConnectException: Connection timed out
这里
xxx.xxx.xx.x
是运行EJB的机器的内部IP

这是我用来访问它的代码

Properties props = new Properties(); 
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,org.jboss.security.jndi.JndiLoginInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "<external-ip>:1099");
props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
props.put("java.naming.provider.url", "jnp://<external-ip>:1099");
InitialContext ic = new InitialContext(props);
ic.lookup("EJBName");
并以

-Djboss.bind.address=0.0.0.0 -Djava.rmi.server.hostname=xxx.xxx.xx.x -Dremoting.bind_by_host=false
我想我已经完成了所有必要的配置和正确的代码,但似乎不起作用。请帮我解决这个问题,它已经困扰我一个多星期了。出于安全原因,很抱歉隐藏了实际的IP。

连接超时可能是防火墙问题。验证端口是否已打开:


您还可以尝试设置属性:“org.omg.CORBA.ORBInitialHost”和“org.omg.CORBA.ORBInitialPort”。

您可以远程登录:主机地址和orb端口。i、 e.127.0.0.xxx 3700


如果您没有得到答案,那么这肯定是一个首要问题。

我也在客户端使用JBoss 5.1。因此,我认为我不需要ORB端口属性。初始上下文将带有内部ip的命名存根返回给客户端。但是当我尝试查找时,它给了我这个异常。EJB端口3700/33700 2上的telnet。使用wireshark进行嗅探,以确保外部连接正在尝试3。“netstat-na | grep3700”以确保将参数bind.address考虑在内。
-Djboss.bind.address=0.0.0.0 -Djava.rmi.server.hostname=xxx.xxx.xx.x -Dremoting.bind_by_host=false