java - Configuring Jetty 6 to use commons.dbcp datasource -
hi i'm trying configure jetty 6.1.26 use connection pooling , it's giving me hard time.
i put commons-dbcp-1.4.jar
, commons-pool-1.5.6.jar
, mysql-connector-java-5.1.16
in jetty/lib/ext folder.
i added references jars in jetty/pom.xml
<dependencies> ... <dependency> <groupid>commons-dbcp</groupid> <artifactid>commons-dbcp</artifactid> <version>1.4</version> </dependency> <dependency> <groupid>commons-pool</groupid> <artifactid>commons-pool</artifactid> <version>1.5.6</version> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.16</version> </dependency> </dependencies>
in web project in eclipse, jetty-env.xml (in web-inf) file this:
<configure class="org.mortbay.jetty.webapp.webappcontext"> <new id="mysqldb" class="org.mortbay.jetty.plus.naming.resource"> <arg>mysqldb</arg> <arg> <new class="org.apache.commons.dbcp.basicdatasource"> <set name="driverclassname">com.mysql.jdbc.driver</set> <set name="url">jdbc:mysql://host_ip</set> <set name="username">user</set> <set name="password">pwd</set> <set name="auth">container</set> <set name="maxactive">-1</set> <set name="maxidle">30</set> <set name="maxwait">10000</set> <set name="minevictableidletimemillis">600000</set> <set name="name">mysqldb</set> <set name="removeabandoned">true</set> <set name="removeabandonedtimeout">5000</set> <set name="timebetweenevictionrunsmillis">10000</set> <set name="type">javax.sql.datasource</set> </new> </arg>
</configure>
however, when start jetty (using java -jar start.jar
in jetty directory), exception:
java.lang.nosuchmethodexception: class org.apache.commons.dbcp.basicdatasource.setauth(class java.lang.string)
how can setup jetty correctly? alot!
in code have <set name="auth">container</set> instruction says call method setauth of class. class doesn't have that.
Comments
Post a Comment