• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB remote interface problem over internet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .


 
Tejas Nitya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Greenhorn
Posts: 12
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic