Apache JNDI dbcp connection pool working w/ GWT 1.6 and Oracle

125 views
Skip to first unread message

simon

unread,
May 20, 2009, 11:02:20 AM5/20/09
to Google Web Toolkit
I hope i can save some people a little time...

below is what is required to get Jetty and Apache JNDI dbcp connection
pool working w/ GWT 1.6 and Oracle

1) these 2 jars are needed in the WEB-INF/lib directory, :
jetty-plus-6.1.11.jar
jetty-naming-6.1.11.jar

2) for the Apache dbcp connection pool these 2 files are needed in WEB-
INF directory:
commons-dbcp-1.2.jar
commons-pool-1.2.jar

3) for oracle, add this to WEB-INF/lib directory,
odbc14.jar

4) this <Arg>jdbc/database</Arg>
:: has to match :: ^^^^^^^^^^^^^
DataSource lDataSource = (DataSource) lContext.lookup("jdbc/
database");

^^^^^^^^^^^^^^^
5) no changes to the web.xml file...

#common errors#

if you copy the jetty-web.xml into the WEB-INF/ from
http://humblecode.blogspot.com/2009/05/gwt-16-using-jndi-datasource.html
be very carefule that of the double quotes, they are slanted double
quotes which the sax parser does not like.

***********************************errors
**********************************
if you get the below error, you do not have jetty-naming-6.1.11.jar on
your classpath
[WARN] Config error at <New id="website"
class="org.mortbay.jetty.plus.naming.Resource">
java.lang.ClassNotFoundException:
org.mortbay.jetty.plus.naming.Resource

if you get the below error, you do not have jetty-plus-6.1.11.jar on
your classpath
[WARN] Config error at <New id="website"
class="org.mortbay.jetty.plus.naming.Resource"><Arg>jdbc/database</
Arg><Arg>
java.lang.ClassNotFoundException:
org.mortbay.jetty.plus.naming.Resource


********** here is my \WEB-INF\jetty-web.xml *********
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="website" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/database</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">oracle.jdbc.OracleDriver</
Set>
<Set
name="url">jdbc:oracle:thin:@192.142.49.8:1521:xe</Set>
<Set name="username">user</Set>
<Set name="password">pass</Set>
</New>
</Arg>
</New>
</Configure>



these are specific to the drive used, if you have "user" instead of
"username"
<Set name="driverClassName">oracle.jdbc.OracleDriver</
Set>
<Set
name="url">jdbc:oracle:thin:@192.142.49.8:1521:xe</Set>
***** <Set name="user">user</Set> *****
<Set name="password">pass</Set>

java.lang.NoSuchMethodException:
class org.apache.commons.dbcp.BasicDataSource.setUser(class
java.lang.String)

JETTY docs
http://docs.codehaus.org/display/JETTY/JNDI
http://docs.codehaus.org/display/JETTY/DataSource+Examples

barcla...@gmail.com

unread,
Jun 5, 2009, 5:14:22 AM6/5/09
to Google Web Toolkit
In step 3, for MySQL, use mysql-connector-java?

Thank you

barcla...@gmail.com

unread,
Jun 9, 2009, 6:31:25 PM6/9/09
to Google Web Toolkit
How do you add jetty-plus-6.1.11.jar and jetty-naming-6.1.11.jar to
class path so that stand alone jetty can see it? I keep getting:

[WARN] Config error at <New id="website"
class="org.mortbay.jetty.plus.naming.Resource">
java.lang.ClassNotFoundException:
org.mortbay.jetty.plus.naming.Resource



On May 20, 8:02 am, simon <simons...@yahoo.com> wrote:
Reply all
Reply to author
Forward
0 new messages