Create 2 connection pools using c3p0 in Jetty
- by Mike
Hello,
I'm trying to set up a maven web project that runs Jetty. In this project, I need 2 JNDIs... my plan is to configure 2 connection pools using c3p0 in Jetty.
So, I created WEB-INF/jetty-env.xml, and I have the following:-
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="ds1" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/ds1</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
// ... JTDS to SQL Server - omitted for brevity
</New>
</Arg>
</New>
<New id="ds2" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/ds2</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
// ... JTDS to Sybase - omitted for brevity
</New>
</Arg>
</New>
</Configure>
When I run jetty, I get this exception:-
May 14, 2010 1:16:56 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> ...
...
...
Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0" java.lang.LinkageError: net.sourceforge.jtds.jdbc.DefaultProperties
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:258)
It seems to me that I can't create 2 connection pools using c3p0. If I remove either one of the connection pool, it worked.
What am I doing wrong? How do I create 2 connection pools in Jetty?
Thanks much.