File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes EJB remote interface problem over internet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "EJB remote interface problem over internet" Watch "EJB remote interface problem over internet" New topic
Author

EJB remote interface problem over internet

Tejas Nitya
Greenhorn

Joined: Jan 16, 2011
Posts: 4
I have an EJB container that is deployed on JBoss 5.1 on to a Amazon AWS Fedora 8 virtual machine. I have another application which I want to access this EJB container remotely over the internet. But I am getting the following exception

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

Here xxx.xxx.xx.x is the internal IP of the machine running the EJB.

Here is the code I used to access it



I have also edited the /etc/hosts file like

127.0.0.1 localhost.localdomain localhost
xxx.xxx.xx.x hostname alias

and started JBoss with
-Djboss.bind.address=0.0.0.0 -Djava.rmi.server.hostname=xxx.xxx.xx.x -Dremoting.bind_by_host=false

I guess I have done all the necassary configurations and correct code for this but doesn't seems to work. Please help me solving this issue it has been bugging me for over a week now. And sorry for hiding the actual ips for security reasons.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi , As far as i understood , you have a EJB Application already running fine under JBoss 5.1 Server .

I have another application which I want to access this EJB container remotely over the internet.


What is this new Application and how it is calling that EJB Remote Interface ?? Please elobrate .



Save India From Corruption - Anna Hazare.
Tejas Nitya
Greenhorn

Joined: Jan 16, 2011
Posts: 4
I have two EJB applications (EJB1.jar and EJB2.jar) running on two different machines, one machine is a virtual Amazon AWS machine and other is standalone machine. Both are deployed on JBoss 5. The EJB1.jar is deployed on the Amazon AWS machine. The EJB2.jar wants to calls a remote method which resides in the Stateless Session bean of the EJB1.jar. I use the Initial Context lookup for getting the remote EJB. This is the code



The client gets the Naming stub but when tried to connect throws exception
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]

Where xxx.xxx.xx.x is the internal IP.

I have tried to explain my problem...I guess its helpful.
Tejas Nitya
Greenhorn

Joined: Jan 16, 2011
Posts: 4
Tejas Nitya wrote:I have two EJB applications (EJB1.jar and EJB2.jar) running on two different machines, one machine is a virtual Amazon AWS machine and other is standalone machine. Both are deployed on JBoss 5. The EJB1.jar is deployed on the Amazon AWS machine. The EJB2.jar wants to calls a remote method which resides in the Stateless Session bean of the EJB1.jar. I use the Initial Context lookup for getting the remote EJB. This is the code

This is the Stateless session bean of the remote EJB in EJB1.jar


Inside the above class is a method that I want to call remotely

This is how I initialized the remote interface


The EJB2.jar has the following methods to access the remote EJB


The client gets the Naming stub but when tried to connect throws exception

Where xxx.xxx.xx.x is the internal IP.

I have tried to explain my problem...I guess its helpful.
Dhiraj Mahapatro
Greenhorn

Joined: Oct 28, 2007
Posts: 12

Hi Tejas

I would suggest you to refer the absolute path for the Remote Interface you are looking up in the Context.

You used:
MyBeanRemote myBean = (MyBeanRemote) ic.lookup("MyBeanName");

Actual:
MyBeanRemote myBean = (MyBeanRemote) ic.lookup("@Project/@Package/MyBeanName");

I hope this would help eliminating the communication exception. In addition, make sure the stubs for EJB1.jar is shared across properly in the second machine where EJB2.jar resides.

Best of Luck!!!


Grails & Groovy Evangelist | SCBCD | SCJP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB remote interface problem over internet
 
Similar Threads
invoke EJB on a remote machine with dynamic IP
rmi connection refused
Error for EJB jndi lookup ip farwrding issue
JNDI Connection refused
remote JNDI lookup fails