jQuery in Action, 2nd edition*
The moose likes EJB and other Java EE Technologies and the fly likes Accessing EJBs from Tomcat 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 » Java » EJB and other Java EE Technologies
Bookmark "Accessing EJBs from Tomcat" Watch "Accessing EJBs from Tomcat" New topic
Author

Accessing EJBs from Tomcat

forest park
Greenhorn

Joined: Aug 17, 2005
Posts: 3
I have an EJB deployed on JBoss 3.07 server which I need to access from a servlet running on a Tomcat engine on another machine. But when i try to do it, I get a lookup failure on the jndi name. I have set the InitialContext as it should be. Any idea what it could be due to. Is there any other setting required in tomcat to access EJBs.

(The same EJB when accessed from the embedded servlet engine in JBoss works fine)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The Tomcat in JBoss is running in the same JVM as the EJB container. For remote access, you need to pass the environmental entries into the constructor of InitialContext. You will need something like this.



SCJP 1.4, SCWCD 1.3, SCBCD 1.3
forest park
Greenhorn

Joined: Aug 17, 2005
Posts: 3
Hi there, thanks for the post. Actually i did it the same way but its not working. I get the following exception.

- Failed to connect to localhost:1099
javax.naming.CommunicationException: Failed to retrieve stub from server localhost:1099 [Root exception is java.io.EOFException]

I am able to access the same EJB successfully from the Tomcat instance thats running within JBOss. Its only for external clients that its failing
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing EJBs from Tomcat
 
Similar Threads
To get some experience with J2EE.
JBoss-TOmcat Bundle-
Apache Web Server & (Tomcat or JBoss)
Servers supporting EJB 3.0?
Example Context doesnot respond (Jboss With tomcat)