javax.servlet.ServletException: Unable to get home interface: javax.naming.NameNotFoundException: expected intermediate context in `ejb/HelloHome'
at hello.web.HelloServlet.init(HelloServlet.java:47)
at com.caucho.server.http.Application.loadServlet(Application.java:1504)
at com.caucho.server.http.Invocation.service(Invocation.java:207)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:142)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:211)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:145)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:484)
Servlet code:
public void init(ServletConfig config) throws ServletException {
// Get the initial JNDI context using our settings
Context context;
try {
context = new InitialContext();
}
catch (Throwable exception) {
throw new ServletException(
"Unable to get initial JNDI context: " + exception.toString());
}
// Get a reference to the Hello home interface
HelloHome helloHome;
try {
Object boundObject = context.lookup("java:comp/env/ejb/HelloHome");
helloHome = (HelloHome) PortableRemoteObject.narrow(boundObject,
HelloHome.class);
}
catch (Throwable exception) {
throw new ServletException(
"Unable to get home interface: " + exception.toString());
}
WEB.xml (which resin specifies to add in its app)
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<classpath id='WEB-INF/classes/orion.jar'/>
<classpath id='WEB-INF/classes/mail.jar'/>
<classpath id='WEB-INF/classes/ejb.jar'/>
<jndi-link>
<jndi-name>java:comp/env/ejb</jndi-name>
<jndi-factory>com.evermind.server.rmi.RMIInitialContextFactory
</jndi-factory>
<init-param java.naming.provider.url="ormi://3.209.125.41/orion-primer"/>
<init-param java.naming.security.principal="admin"/>
<init-param java.naming.security.credentials="123"/>
</jndi-link>
</web-app>
at the orion side i have made this change(true -> false) in principal.xml (I am not sure whether i should do this or not)
<user username="admin" password="123" deactivated="false">
<description>The default administrator</description>
<group-membership group="administrators" />
<group-membership group="guests" />
<group-membership group="users" />
</user>
These are the only two things that i have done ..What i dont understand is why am i getting this error
Unable to get home interface:
javax.naming.NameNotFoundException: expected intermediate context in
`ejb/HelloHome'
I think there is some problem in which the initialcontext is
set..probably i should
modify the way InitialContext is
set..
Please Help me!!!
Regards,
Santosh.