-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry,

On 3/18/2010 1:16 PM, Propes, Barry L wrote:
> <Resource name="jdbc/myoracle" 

> In web.xml, located in.../webapps/chngctrl/WEB-INF/web.xml 
> (for what it's worth, and I think it's immaterial, this at the top-)
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
>    version="2.5"> 
> 
> <resource-ref>

The <resource-ref> element should be at the bottom of web.xml: check the
schema definition. I'm not sure this is causing your error, but you
ought to make web.xml conform to the schema.

>     <description>Change Ctrl App</description>
>     <res-ref-name>jdbc/myoracle</res-ref-name>
>     <res-ref-type>javax.sql.DataSource</res-ref-type>
>     <res-auth>Container</res-auth>

...actually, I checked
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; and I can't find an
allowed element <resource-ref> in the 2.5 schema (which certainly is
surprising to me). Try taking-out your <resource-ref> element entirely
and see what happens.

> Context initCtx = new InitialContext();
> Context envCtx = (Context) initCtx.lookup("java:comp/env");
> 
> // Look up our data source
> DataSource ds = (DataSource) envCtx.lookup("jdbc/myoracle");

I have my JNDI path as "java:/comp/env/jdbc/[dbname]". IIRC, the leading
'/' is optional, so you should be good.

> // Allocate and use a connection from the pool
> Connection connection = ds.getConnection();
> 
> All this has worked fine in 4.1.31 -- the two different versions of TC 6 
> (.0.18 and 0.24) I've not had any luck with it.

Note that you updated your web.xml to use the new 2.5 Schema instead of
sticking with the 2.3 DTD that you were using: that changes some of the
rules by which Tomcat plays. You might consider using this header instead:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>


- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuieOEACgkQ9CaO5/Lv0PAXkwCfVwIqaMa/Lj+Ob7lDt/LEt7hs
Ia4AoMFL9IrRrH1HtnF14mlUFQwgsf2C
=4d0W
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to