unniks
unniks

Reputation: 166

Solr Jetty Bitnami MySQL Driver Configuration

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

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

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:

  1. put the mysql-connector-java-5.1.31-bin.jar in ${jetty.base}/lib/ext directory
  2. add --module=ext the ${jetty.base}/start.ini
  3. 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:

  1. put the mysql-connector-java-5.1.31-bin.jar in the ${jetty.home}/lib/ext directory
  2. open up the ${jetty.home}/start.ini and ensure that the OPTIONS line has ext in it
  3. test that it shows up on the server classpath

    $ java -jar start.jar --version
    

Upvotes: 4

Related Questions