Reputation: 166
the jetty.xml is as follows
<New id="SomeID" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/MyDB</Arg>
<Arg>
<New class="com.mysql.jdbc.Driver">
<Set name="Url">jdbc:mysql://some_connectoin/mydb</Set>
<Set name="User">user Name</Set>
<Set name="Password">PAssword</Set>
</New>
</Arg>
</New>
But on running it gives error "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" "org.eclipse.jetty.xml.XmlConfiguration – Config error at
"mysql-connector-java-5.1.31-bin.jar" has been placed in ./lib folder of jetty
What could be wrong?
Upvotes: 1
Views: 555
Reputation: 49525
Just placing the jar in the ${jetty.base}/lib
(or ${jetty.home}/lib
if using versions of Jetty older than Jetty 9), will not make it available for the server to use.
If you have a Jetty 9:
mysql-connector-java-5.1.31-bin.jar
in ${jetty.base}/lib/ext
directory--module=ext
the ${jetty.base}/start.ini
test that it shows up on the server classpath
$ java -jar /path/to/jetty.home/start.jar --list-classpath
If you are using Jetty 7 or Jetty 8:
mysql-connector-java-5.1.31-bin.jar
in the ${jetty.home}/lib/ext
directory${jetty.home}/start.ini
and ensure that the OPTIONS
line has ext
in ittest that it shows up on the server classpath
$ java -jar start.jar --version
Upvotes: 4