You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Williamson <ch...@wolfram.com> on 2001/12/07 15:33:54 UTC
InitialContext in a JSP
I am trying to create an InitialContext in a JSP I have created.
The code looks like this...
KernelService ms = null;
try
{
InitialContext jndiContext = new InitialContext();
Context envCtx = (Context)jndiContext.lookup("java:comp/env");
ms = (KernelService)envCtx.lookup("bean/KernelServiceFactory");
}
catch(Exception e)
{
e.printStackTrace();
}
The web.xml looks like this...
<web-app>
<resource-env-ref>
<description>WebMathematica MBean</description>
<resource-env-ref-name>bean/KernelServiceFactory</resource-env-ref-name>
<resource-env-ref-type>
com.wolfram.mathserver.mbean.KernelService
</resource-env-ref-type>
</resource-env-ref>
</web-app>
However I receive this exception which appears to be coming from the first
line in the try block of the java code...
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory. Root Exception is
java.lang.ClassCastException: org.apache.naming.java.javaURLContextFactory.
I have tried setting the properties for the InitialContext with no luck.
This is exactly how the example does it in the JndiServlet.
I just want to do a simple jndi lookup of a bean resource I provide. Anyone
know what I am doing wrong?
--
To unsubscribe: <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>