I've been successfully using Apache Jackrabbit 2.4.3 and now 2.6.0 (standalone server in both cases) using the default configuration, so the repository is stored on the filesystem.
How can I make it connect to a MySQL back end instead? I don't need to worry about migration, just set it up as a fresh install.
After trying the steps below, Jackrabbit fails to start correctly or populate the DATASTORE table in the database, and I find this error in the logs:
ERROR [main] RepositoryImpl.java:366 failed to start Repository: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager
javax.jcr.RepositoryException: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager
[... oodles of backtrace cut ...]
[edit: here's the full backtrace]
2013-03-04 10:59:27.526 WARN [main] Slf4jLog.java:89 unavailable
javax.jcr.RepositoryException: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager
at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1353) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.RepositoryImpl.createVersionManager(RepositoryImpl.java:486) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:311) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.RepositoryContext.create(RepositoryContext.java:149) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.servlet.jackrabbit.JackrabbitRepositoryServlet.init(JackrabbitRepositoryServlet.java:109) ~[jackrabbit-standalone-2.6.0.jar:na]
at javax.servlet.GenericServlet.init(GenericServlet.java:241) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.jetty.Server.doStart(Server.java:224) [jackrabbit-standalone-2.6.0.jar:na]
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) [jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.standalone.Main.run(Main.java:173) [jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.standalone.Main.main(Main.java:60) [jackrabbit-standalone-2.6.0.jar:na]
Caused by: javax.jcr.RepositoryException: Could not load JDBC driver class org.gjt.mm.mysql.Driver
at org.apache.jackrabbit.core.util.db.ConnectionFactory.getDriverClass(ConnectionFactory.java:265) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.util.db.ConnectionFactory.createDataSource(ConnectionFactory.java:233) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:169) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.getDataSource(BundleDbPersistenceManager.java:569) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.persistence.pool.BundleDbPersistenceManager.init(BundleDbPersistenceManager.java:537) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager.init(MySqlPersistenceManager.java:51) ~[jackrabbit-standalone-2.6.0.jar:na]
at org.apache.jackrabbit.core.RepositoryImpl.createPersistenceManager(RepositoryImpl.java:1349) ~[jackrabbit-standalone-2.6.0.jar:na]
... 23 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217) ~[na:1.6.0_27]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_27]
at java.net.URLClassLoader.findClass(URLClassLoader.java:205) ~[na:1.6.0_27]
at java.lang.ClassLoader.loadClass(ClassLoader.java:321) ~[na:1.6.0_27]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) ~[na:1.6.0_27]
at java.lang.ClassLoader.loadClass(ClassLoader.java:266) ~[na:1.6.0_27]
at java.lang.Class.forName0(Native Method) ~[na:1.6.0_27]
at java.lang.Class.forName(Class.java:188) ~[na:1.6.0_27]
at org.apache.jackrabbit.core.util.db.ConnectionFactory.getDriverClass(ConnectionFactory.java:260) ~[jackrabbit-standalone-2.6.0.jar:na]
... 29 common frames omitted
What I've done so far:
I've created the Jackrabbit database/user, which I can connect to no problem:
mysql -D jackrabbit -u jackrabbit -h localhost -pjackrabbit
I started with a clean slate (empty /var/jackrabbit directory), except the configuration file comes from here: https://raw.github.com/wiki/jackalope/jackalope/files/repository.xml
Here's the startup script I'm using: https://github.com/sixty-nine/Jackrabbit-startup-script
And here's the java process that runs:
java -XX:MaxPermSize=128m -Xmx512M -Xms128M -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1111 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=/opt/jackrabbit/startup/jmx.user -Dcom.sun.management.jmxremote.access.file=/opt/jackrabbit/startup/jmx.role -jar /opt/jackrabbit/jackrabbit-standalone-2.6.0.jar -h 127.0.0.1 -p 8080
I don't think I get far enough for it to matter, but I'm using MySQL 5.5.28-1.
I'm having the above problem with both 2.4.3 and 2.6.0.
Also:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Plus I subsequently installed the MySQL JDBC library on Debian:
apt-get install libmysql-java
[... oodles of backtrace cut ...]
? – Thomas Muellerorg.gjt.mm.mysql.Driver
(orcom.mysql.jdbc.Driver
which I've also tried), despite the fact that I can see those classes in the jar file, and have tried the classpath option-cp /usr/share/java/mysql-connector-java-5.1.16.jar
– fazy