JNDI datasources in GWT 2.1.0 M2 hosted mode

506 views
Skip to first unread message

lukateake

unread,
Jul 21, 2010, 11:10:35 AM7/21/10
to Google Web Toolkit
Has anyone successfully got JNDI datasources up and running under
Milestone 2?
The class packages changed from mortbay to eclipse as I understand it.

My jetty-env.xml file (DOES NOT WORK):

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

<New id="MySQLMSA" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/MyDataSource</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc_url</Set>
<Set name="username">db_user</Set>
<Set name="password">db_pass</Set>
</New>
</Arg>
</New>

</Configure>

Under Milestone 1, this jetty-web.xml works:

<Configure class="org.mortbay.jetty.webapp.WebAppContext">

<New id="DS" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/MySQLMSA</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</
Set>
<Set name="url">jdbc_url</Set>
<Set name="username">db_user</Set>
<Set name="password">db_pass</Set>
</New>
</Arg>
</New>
</Configure>

Y2i

unread,
Jul 27, 2010, 3:45:48 PM7/27/10
to Google Web Toolkit
Hi Lukateake,

Have you been able to solve your problem?

I have a simpler problem of configuring JNDI in GWT 2.0.3. My
<Configure class="org.mortbay.jetty.webapp.WebAppContext"/> looks
exactly as yours (that works under M1), except it uses postgresql
driver.

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="DS" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/testDb</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="url">jdbc:postgresql://localhost/testDb</Set>
<Set name="username">user</Set>
<Set name="password">password</Set>
</New>
</Arg>
</New>
</Configure>

When I ran the application in eclipse, I'm getting the following
error:

java.lang.ClassNotFoundException:
org.mortbay.jetty.plus.naming.Resource
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
...

It looks like there is no problem locating
org.mortbay.jetty.webapp.WebAppContext, but
org.mortbay.jetty.plus.naming.Resource cannot be found.

I tried to modify -classpath to point to jetty-plus-6.1.23.jar, but it
didn't help, same error.

Would really appreciate yours or someone else's advice on how to make
JNDI work with GWT 2.0.3.

Thanks in advance!

Y2i

unread,
Jul 28, 2010, 2:08:29 AM7/28/10
to Google Web Toolkit
My simple problem in GWT 2.0.3 is solved: all I had to do is to copy
jetty-naming-6.1.23.jar and jetty-plus-6.1.23.jar into war/WEB-INF/
lib. No modifications to java command line were required.
> org.mortbay.jetty.plus.naming.Resourcecannot be found.
Reply all
Reply to author
Forward
0 new messages