You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jann VanOver <Ja...@loudeye.com> on 2001/05/15 00:59:52 UTC

Redirects when mailing to this list RE: tomcat, JNDI naming, and OracleDataSource

Kevin, and others.

When you see messages like this, it means that the list tried to send email
to that person (in your case janirautiainen.com@namezero.com) and that email
address was no good.  This does NOT mean that the rest of the list didn't
get your email.  There is no need to post a second time.   I just delete all
the bounce/redirect messages that I get after sending to this list.


-----Original Message-----
From: Kevin HaleBoyes [mailto:kcboyes@yahoo.com]
Sent: Monday, May 14, 2001 3:35 PM
To: tomcat-user@jakarta.apache.org
Subject: tomcat, JNDI naming, and OracleDataSource


I don't know if my original message made it to the list yet.  I received the
following error when I tried to send a question to tomcat-user list:

   ----- The following addresses had permanent fatal errors -----
<ja...@namezero.com>
    (reason: 550 User unknown)

I'm not sure why it redirected to namezero.com.  Hope this one makes it!

I'm trying to get a JNDI example of my own working - the one in the example
context works fine.  I originally wrote because I couldn't even get an
IntialContext instantiation to work.  I solved that by making sure the
naming.jar file was in my application-context classpath.  Actually, I hope
the
first message didn't make it to the list!

Anyway, here's the problem.  In my code, I instantiate an InitialContext
and then do a lookup for a DataSource (connection factory).  The lookup
fails with the following exception:

javax.servlet.ServletException: NamingNotFound Exception while looking up
java:comp/env/jdbc/NamingDataSource:
Name java:comp is not bound in this Context
        at NamingServlet.init(NamingServlet.java:39)
        at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:802)
        at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:583)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:231)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:225)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2175)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:162)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at
org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java
:219)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
827)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:904)
        at java.lang.Thread.run(Thread.java:484)


I'm at home right now so I don't have the code in fron of me but it is
basically as follows (with the naming exceptions caught and turned into
ServletExceptions):

import javax.naming.*;
import javax.sql.*;

public void init( ServletConfig config ) throws ServletException
{
  super.init(config);

  InitialContext ic = new InitialContext();
  DataSource ds =
        (DataSource)ic.lookup("java:comp/env/jdbc/NamingDataSource");
}


and here is my web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
  <display-name>Naming Test</display-name>
  <description>Test JNDI Naming</description>
  <servlet>
    <servlet-name>naming</servlet-name>
    <servlet-class>NamingServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>naming</servlet-name>
    <url-pattern>/naming</url-pattern>
  </servlet-mapping>
  <resource-ref>
    <res-ref-name>jdbc/NamingDataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</web-app>


So the exception says:
    Name java:comp is not bound in this Context
but isn't it enough to declare/define it in my web.xml file.
I'm going to look through the ejb specification tomorrow in case it sheds
any light (since the servlet spec says naming and resource references are
described in the ejb spec).

As an aside, what I'm actually trying to do is get an
OraclePooledConnectionDataSource (I think that's the class name?)
with the base class OracleDataSource in the oracle.jdbc.pool package but
I thought I'd start with a simpler case.  I'm also waiting to see if anyone
responds to "Andrew" <as...@ezan.ac.ru> as he has just asked a question very
similar to what I'm trying to do.

All help is appreciated,
Thanks,
Kevin


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie