我使用默认配置成功使用Apache Jackrabbit 2.4.3和2.6.0(两种情况下都是独立服务器),因此存储库存储在文件系统中。
如何让它连接到MySQL后端呢?我不需要担心迁移,只需将其设置为全新安装。
尝试以下步骤后,Jackrabbit无法正确启动或填充数据库中的DATASTORE表,我在日志中发现此错误:
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 ...]
[编辑:这是完整的回溯]
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
到目前为止我做了什么:
我已经创建了Jackrabbit数据库/用户,我可以连接到没问题:
mysql -D jackrabbit -u jackrabbit -h localhost -pjackrabbit
我开始使用干净的平板(空/ var / jackrabbit目录),但配置文件来自此处:https://raw.github.com/wiki/jackalope/jackalope/files/repository.xml
这是我正在使用的启动脚本:https://github.com/sixty-nine/Jackrabbit-startup-script
这是运行的java进程:
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
我认为我不够重要,但我使用的是MySQL 5.5.28-1。
我在2.4.3和2.6.0都遇到了上述问题。
此外:
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)
另外我随后在Debian上安装了MySQL JDBC库:
apt-get install libmysql-java
答案 0 :(得分:1)
MySqlPersistenceManager
尝试加载驱动程序类org.gjt.mm.mysql.Driver
,这是非常古老的。尝试使用更新的驱动程序类,而不是类com.mysql.jdbc.Driver
。为此,您需要在repository.xml
和所有workspace.xml
文件中配置持久性管理器,如下所示:
<PersistenceManager ...>
...
<param name="driver" value="com.mysql.jdbc.Driver"/>
</PersistenceManager>
答案 1 :(得分:1)
为了使用Apache Jackrabbit-standalone加载MySQL驱动程序。您需要更新MANIFEST.MF中的jackrabbit-stabndalone-x.x.x.jar
。
只需在文件底部添加一个Class-Path语句,例如:
Class-Path:lib / mysql-connector-java-5.1.25-bin.jar
我遇到了和你一样的问题,这是我能够识别MySQL驱动程序类的唯一方法。
答案 2 :(得分:0)
回答我自己的问题,虽然它没有直接回答它:
我没有尝试使用jackrabbit-standalone版本,而是按照此处的说明成功地让它在Tomcat下运行:
https://github.com/jackalope/jackalope/wiki/Running-jackrabbit-in-tomcat-with-mysql
这给了我我需要的东西;一个连接到MySQL数据存储的工作Jackrabbit实例。虽然这对任何碰到这个并且特别需要使用Jackrabbit独立的人没有帮助,但我会说在Tomcat下设置它对我来说更容易,所以值得考虑。
答案 3 :(得分:0)
请进行以下活动。
Un-jar独立服务器jar(在我的例子中是:jackrabbit-standalone-2.8.3)。你会看到很多文件夹。其中你会找到两个文件夹。 1.com 2. org。
Un-jar mysql-connector-java-5.1.30-bin。再次,你会发现上面提到的两个文件夹。进入两个文件夹并复制git(org)和mysql(com)
分别粘贴在步骤1的文件夹中。并重新启动独立服务器。
此致 Nitesh