james not picking up mysql connector jar
-
12-06-2021 - |
Вопрос
I've tried doing a james [1] install on my amazon instance with MySQLas a back-end. I've MySQL connector mysql-connector-java-5.1.20.zip,unzipped and copied it to conf/lib and lib/ but when I start james with: $ sudo bin/james start it stops. Wrapper log shows: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
My james-database.properties looks like this:
database.driverClassName=com.mysql.jdbc.Driverdatabase.url=jdbc:mysql://localhost:3306/jamesdatabase.username= ** user name **
database.password= ** secret **vendorAdapter.database=MYSQL openjpa.streaming=false
I didn't change anything else.but james is not work.
Any helps ,Thanks!
Решение
The wiki says:
Using MySQL instead of Derby
Download the MySQL driver JAR from http://dev.mysql.com/downloads/connector/j/3.1.html, and put the JAR file into your ./conf/lib folder. Change the database settings in ./conf/database.properties to the following values:
# MySQL JDBC database properties
database.driverClassName=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost/james
database.username=jamesuser
database.password=password_for_jamesuser
vendorAdapter.database=MYSQL
openjpa.streaming=false
To add the JAR to the classpath, edit ./bin/setenv.sh as shown here:
# Add every needed extra jar to this
CLASSPATH_PREFIX=../conf/lib/mysql-connector-java-5.1.13-bin.jar
However, their versioning seems off, and, admittedly, these directions don't work for me.
Другие советы
I've managed to get mine apache-james-3.0-beta4 working setting database.url=jdbc:mysql://127.0.0.1/james?create=true
I know this reply comes a little bit late but I just ran into this issue.
According to Eric Charles answer:
The conf/lib/*.jar loading in beta4 is buggy.
You need to edit the conf/wrapper.conf and change
'wrapper.java.classpath...=../conf/lib' to
'wrapper.java.classpath...=../conf/lib/*' (add a /* after lib).
You can use a text editor or if you are using a script or something similar (Dockerfile in my case) to install James you can also edit it by going to the directory where wrapper.conf is located and execute:
sed -i "s/wrapper\.java\.classpath\.2=\.\.\/conf/wrapper\.java\.classpath\.2=\.\.\/conf\/lib\/\*/g" wrapper.conf
After this all jars in conf/lib should be loaded to the classpath next time James is started.