aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Servlet  fails to connect to EJB using ProviderURL property in Initial context  look Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Servlet  fails to connect to EJB using ProviderURL property in Initial context  look " Watch "Servlet  fails to connect to EJB using ProviderURL property in Initial context  look " New topic
Author

Servlet fails to connect to EJB using ProviderURL property in Initial context look

Ajay Kumar bathula
Greenhorn

Joined: Jul 13, 2004
Posts: 9
Hi,

I have a web application for which i am using spring MVC. The requirement is that i need to connect to a stateless session EJB using the provider URL property. Both the servlet and the EJB are deployed using a single EAR file. The Ejb basically checks that the application is working fine. The function of the servlet is to verify that RMI, DB, LDAP are working properly and to convey this information to the user logged in through browser. So the servlet MUST make an RMI call to EJB through Look up using "Provider URL" param in the initial context.

Now the problem is when the EAR is deployed and when i make the call to servlet from browser i get an Exception with the following stack Trace. But if i run an JUNIT Integration test on the EJB and again retry for the servlet It works fine. I use "Sun Java System Application Server Enterprise Edition 8.1 (build Jes4RR_Build8)"

Now Here is the stack trace



Here is the Code that i use in the Controller class.


The client spcifically asks for a configurable ProviderURL so that in the production environment the client will deploy the EJB and Servlet seperatly
Ajay Kumar bathula
Greenhorn

Joined: Jul 13, 2004
Posts: 9
I found the Solution for this..The problem was with the initial context factory class. The following code change did the trick.

Now I want to know what is the difference in using "S1ASCtxFactory" against
"com.sun.jndi.cosnaming.CNCtxFactory"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet fails to connect to EJB using ProviderURL property in Initial context look