XWiki + MySQL数据库:错误

时间:2013-10-24 10:59:09

标签: mysql http xampp tomcat7 xwiki

我(据我所知)正确地遵循xwiki.org上的所有说明,我也搜索了我的错误的答案,但遗憾的是我自己无法解决这些问题。

我已经以两种不同的格式下载了XWiki。第一个是.exe安装程序,第二个是建议的.xar程序包,两者都可以在Windows 8,64位计算机上使用。

第一个在“独立”模式下运行完美,但是一旦hibernate.cfg.xml文件更改为预设的MySQL设置(对我的数据库准确),我会收到很长的HTTP 500错误。 (这是在我添加MySQL Connection Java文件,并根据xwiki.org上的说明创建了一个MySQL数据库之后)似乎主要问题是它无法找到com.mysql.jdbc.Driver以及我得到的事实页面上稍后出现错误,指出它无法创建数据库连接池。

与错误有关的代码是:

<!-- DBCP Connection Pooling configuration
-->
<property name="dbcp.defaultAutoCommit">false</property>
<property name="dbcp.maxActive">50</property>
<property name="dbcp.maxIdle">5</property>
<property name="dbcp.maxWait">30000</property>
<property name="dbcp.whenExhaustedAction">1</property>
<property name="dbcp.ps.whenExhaustedAction">1</property>
<property name="dbcp.ps.maxWait">120000</property>
<property name="dbcp.ps.maxIdle">20</property>
<property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>

和这个

<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
-->
<property name="connection.url">jdbc:mysql://localhost/xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="dbcp.ps.maxActive">20</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>

错误本身如下:

HTTP ERROR 500 

Problem accessing /xwiki/bin/view/Main/. Reason: 

Error number 3 in 0: Could not initialize main XWiki context 

Caused by: 

com.xpn.xwiki.XWikiException: Error number 3 in 0: Could not initialize main XWiki context 
at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:422) 
at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:491) 
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:152) 
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:128) 
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) 
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) 
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) 
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1448) 
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:121) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter
(SavedRequestRestorerFilter.java:208) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter
(SetCharacterEncodingFilter.java:111) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) 
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) 
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) 
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle
(ContextHandlerCollection.java:255) 
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
at org.eclipse.jetty.server.Server.handle(Server.java:368) 
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
(AbstractHttpConnection.java:488) 
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete  
(AbstractHttpConnection.java:932) 
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete 
(AbstractHttpConnection.java:994) 
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640) 
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628) 
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
at java.lang.Thread.run(Unknown Source) 
Caused by: com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading  
document [xwiki:XWiki.XWikiServerClass] 
at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:916) 
at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:290) 
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1515) 
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1558) 
at com.xpn.xwiki.XWiki.initializeMandatoryClasses(XWiki.java:885) 
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:855) 
at com.xpn.xwiki.XWiki.<init>(XWiki.java:792) 
at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:402) 
... 45 more 
Caused by: org.hibernate.HibernateException: Could not create a DBCP pool. There is an error     
in the hibernate configuration file, please review it. 
at com.xpn.xwiki.store.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:215) 
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider
(ConnectionProviderFactory.java:143) 
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider  
(ConnectionProviderFactory.java:84) 
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:459) 
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90) 
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863) 
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859) 
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) 
at com.xpn.xwiki.store.XWikiHibernateBaseStore.initHibernate(XWikiHibernateBaseStore.java:223) 
at com.xpn.xwiki.store.XWikiHibernateBaseStore.checkHibernate(XWikiHibernateBaseStore.java:640) 
at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:789) 
... 52 more 
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver 
class 'com.mysql.jdbc.Driver' 
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429) 
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) 
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) 
at com.xpn.xwiki.store.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:197) 
... 62 more 
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 
at java.net.URLClassLoader$1.run(Unknown Source) 
at java.net.URLClassLoader$1.run(Unknown Source) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(Unknown Source) 
at java.lang.ClassLoader.loadClass(Unknown Source) 
at java.lang.ClassLoader.loadClass(Unknown Source) 
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430) 
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383) 
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420) 
... 65 more 

Caused by: 

com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document   
[xwiki:XWiki.XWikiServerClass] 
at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:916) 
at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:290) 
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1515) 
at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1558) 
at com.xpn.xwiki.XWiki.initializeMandatoryClasses(XWiki.java:885) 
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:855) 
at com.xpn.xwiki.XWiki.<init>(XWiki.java:792) 
at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:402) 
at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:491) 
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:152) 
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:128) 
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) 
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) 
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) 
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1448) 
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:121) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter
(SavedRequestRestorerFilter.java:208) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter
(SetCharacterEncodingFilter.java:111) 
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) 
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) 
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) 
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) 
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) 
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle
(ContextHandlerCollection.java:255) 
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
at org.eclipse.jetty.server.Server.handle(Server.java:368) 
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
(AbstractHttpConnection.java:488) 
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
(AbstractHttpConnection.java:932) 
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
(AbstractHttpConnection.java:994) 
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640) 
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) 
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628) 
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
at java.lang.Thread.run(Unknown Source) 
Caused by: org.hibernate.HibernateException: Could not create a DBCP pool. There is an error     
in the hibernate configuration file, please review it. 
at com.xpn.xwiki.store.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:215) 
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider
(ConnectionProviderFactory.java:143) 
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider  
(ConnectionProviderFactory.java:84) 
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:459) 
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90) 
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863) 
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859) 
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) 
at com.xpn.xwiki.store.XWikiHibernateBaseStore.initHibernate(XWikiHibernateBaseStore.java:223) 
at com.xpn.xwiki.store.XWikiHibernateBaseStore.checkHibernate
(XWikiHibernateBaseStore.java:640) 
at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:789) 
... 52 more 
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver   
class 'com.mysql.jdbc.Driver' 
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory   
(BasicDataSource.java:1429) 
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) 
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) 
at com.xpn.xwiki.store.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:197) 
... 62 more 
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 
at java.net.URLClassLoader$1.run(Unknown Source) 
at java.net.URLClassLoader$1.run(Unknown Source) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(Unknown Source) 
at java.lang.ClassLoader.loadClass(Unknown Source) 
at java.lang.ClassLoader.loadClass(Unknown Source) 
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430) 
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383) 
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory 
(BasicDataSource.java:1420) 
... 65 more 

我是否必须使用.xar安装版本才能正确连接到数据库?我也尝试过这种方式,使用Xampp和Tomcat。 Tomcat安装正常,我可以通过localhost:(port)轻松访问它。但是,当我尝试访问我的xwiki时,我收到HTTP 404错误,指出无法找到引用,这很奇怪,因为它显示了Tomcat中包含的部署列表中的其他文件,以及Tomcat示例那里显示的文件(位于同一目录中)工作正常...

我有点担心,即使我能让XWiki通过Tomcat正常工作,我仍会得到我后来在尝试连接MySQL数据库时提到的第一个错误。

Side注意:我怀疑在XWiki中发现的那些与Tomcat中的那些之间可能存在Java文件冲突,这些错误是我在玩游戏时尝试使用的其他错误...但我可以是错的,因为我目前对Java知之甚少。我已经看到了几个servlet错误,并且根据我发现的论坛找不到属于jasper.jarjsp-api.jar的常见错误的类/文件错误,两者都在Tomcat中找到。< / em>的

无论如何,我愿意尝试使用或不涉及Tomcat的安装选项。如果有人在Windows上使用MySQL数据库安装XWiki取得了成功,那么非常感谢您的帮助!

3 个答案:

答案 0 :(得分:1)

看起来你错过了mysql驱动程序。由于您将默认分发转换为使用mysql,因此您需要下载mysql driver jar并将其部署到'webapps \ xwiki \ WEB-INF \ lib'目录。

关于第二个问题,数据库驱动程序错误,xar和tomcat 404之间可能没有任何关联.xar只是用于导入或导出内容和功能的页面集合,但通常不会处理低数据库连接等级别的东西。 Tomcat中的404可能是因为您访问了无效的URL。可能需要更多关于那个的细节。

答案 1 :(得分:1)

首先关于与Tomcat的潜在冲突,我可以向你保证这是不可能的,因为Tomcat是XWiki团队一直在生产中使用的。

现在对于MySQL来说,错误非常明显,如果你真的把MySQL连接器放在了正确的位置,那么你就没有把它放到正确的地方。你放了什么版本的版本,是#xwiki folder#/WEB-INF/lib/

XAR包不是安装XWiki的另一种方式,它是一个包含wiki页面的包,可以在XWiki运行时导入。也许你的意思是WAR包?

答案 2 :(得分:-6)

几个月前就解决了这个问题。我在设置中遗漏了一些重要信息,但现在工作正常。