[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-users] Jetty-8.1.1 - JNDI DB Resource not working with jetty-env.xml, works in jetty-web.xml
|
Hi there,
New Jetty user here and I'm having a problem with Jetty not being able
to find my JNDI pooled database connection
when it is configured in WEB-INF/jetty-env.xml
I get an exception in Jetty-8.1.1-v20120215:
javax.naming.NameNotFoundException; remaining name 'env/jdbc/MyDB'
(Note: JNDI does work if I change the name to jetty-web.xml and specify
the the full name of "java:comp/env/jdbc/MyDB" in the Resource)
Can anyone shed any light or point out what I'm doing wrong, or is
jetty-env.xml not supported anymore in 8.1.1?
I've looked through the Eclipse Wiki and can't seem to figure out what's
going wrong.
See below for my setup..
Thanks,
Jamie
------------------------
setup:
start.ini contains the following OPTIONS:
OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations
jetty.xml - added the following just above "extra options"
<!-- =========================================================== -->
<!-- Support jetty-env.xml in webapps -->
<!-- =========================================================== -->
<Call name="setAttribute">
<Arg>org.eclipse.jetty.webapp.configuration</Arg>
<Arg>
<Array type="java.lang.String">
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
</Arg>
</Call>
The jetty-env.xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<New id="DpsDB" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/MyDB</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://192.168.1.1:3306/MyDB</Set>
<Set name="username">myuser</Set>
<Set name="password">mypw</Set>
</New>
</Arg>
</New>
</Configure>
web.xml file contains:
<resource-ref>
<description>MyDB datasource reference</description>
<res-ref-name>jdbc/MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>