Are you running your app using Quickstart's test.Start? That one does not
have Jetty-Plus and does not load your jetty-env.xml and you will get the
error you are seeing. Use 'mvn jetty:run' instead. It does Jetty-Plus and
loads jetty-env.xml from WEBINF all without any additional config.
If you want to use Quickstart's test.Start, you need to add this to your
jetty-env.xml:
<Array id="plusConfig" type="java.lang.String">
<Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
<Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
</Array>
<Set name="configurationClasses"><Ref id="plusConfig"></Ref></Set>
and add a few lines to Start.java:
WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/main/webapp");
+ File configFile = new File(bb.getWar() + "/WEB-INF/jetty-env.xml");
+ if (configFile.exists()) {
+ XmlConfiguration configuration = new XmlConfiguration(
+ new FileInputStream(configFile));
+ configuration.configure(bb);
+ }
I hope this helps.
On Fri, Mar 14, 2008 at 9:45 AM, Kevin Murphy <[EMAIL PROTECTED]>
wrote:
> I'm having difficulty adding database functionality to my Wicket
> QuickStart app by configuring a JNDI data source in Jetty.
>
> I've added jetty-naming, jetty-plus, mysql-connector-java, and
> commons-dbcp to the POM.
>
> I have this in WEB-INF/web.xml:
>
> <resource-ref>
> <description>My DataSource Reference</description>
> <res-ref-name>jdbc/MySqlPool</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> and this in WEB-INF/jetty-env.xml:
>
> <New id="MySqlPool" class="org.mortbay.jetty.plus.naming.Resource">
> <Arg>jdbc/MySqlPool</Arg>
> <Arg>
> <New class="org.apache.commons.dbcp.BasicDataSource">
> <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
> <Set name="url">jdbc:mysql://localhost/mysql</Set>
> <Set name="username">joe</Set>
> <Set name="password">cool</Set>
> </New>
> </Arg>
> </New>
>
>
> I'm now stymied by the following error when my application runs
> '(DataSource) ic.lookup("java:comp/env/jdbc/MySqlPool")':
>
> javax.naming.NameNotFoundException; remaining name 'env/jdbc/MySqlPool'
>
> Thanks for any quick tips.
>
> -Kevin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>