--- [EMAIL PROTECTED] skrev: > I am trying to call Oracle CMP from a
jboss/tomcat servlet and I get this
> error:
>
> javax.naming.NameNotFoundException: jdbc not bound
>
>
> The call I am using looks like this:
>
> InitialContext ic = new InitialContext();
> DataSource ds = (DataSource) ic.lookup("java:/jdbc/APConnectionPool");
>
> The same lookup works when I do it from within an EJB.
>
> I was reading the "jBoss 2.0: Third-Party Software" section in the User
> Manual and I followed the recomendation to check if I have the same class
> loader:
>
> System.out.println ("Class Loader:" +
> Thread.currentThread().getContextClassLoader());
>
> In the servlet this produces:
>
> Class Loader:AdaptiveClassLoader( )
>
>
> In the EJB this produces:
>
> Class Loader:java.net.URLClassLoader@721b0
>
It seems that you get an InitialContext, but that jdbc is not defined in it.
So, maybe your EJB uses a different context than your JSP, possibly because the
two classloaders find different jndi.properties files?
Try listing the names in ic with this code:
try
{
NamingEnumeration enum = ic.list("java");
while (enum.hasMoreElements())
{
out.println("next name in context="+enum.nextElement());
}
}
catch (Exception x){}
There is an issue regarding where to place the class-files when accessing EJB's
from Tomcat. They have to be in the classpath when Tomcat is started.
java.net.URLClassLoader will not find them if they are placed in the WEB-INF
dir of the web app. Same goes for the jndi.properties file, if you use this to
specify java.naming.provider.url etc. But I'm not sure if this is your problem.
erik.
_______________________________________________________
Do You Yahoo!?
Del dine bilder med andre på http://no.photos.yahoo.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]