我已经(据我所知)正确地遵循了 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 示例文件(位于在同一个目录中)工作正常......
我有点担心,即使我可以通过 Tomcat 让 XWiki 正常工作,我仍然会遇到我稍后在尝试连接 MySQL 数据库时提到的第一个错误。
旁注:我怀疑在 XWiki 中发现的文件与在 Tomcat 中发现的文件之间可能存在 Java 文件冲突,这是我在玩弄并试图使事情正常工作时看到的其他错误......但我可能错了,因为我目前有对Java知之甚少。我已经看到了几个 servlet 错误并且找不到类/文件错误,根据我发现的论坛,这些错误是属于jasper.jar
和 的常见错误jsp-api.jar
,两者都在 Tomcat 中找到。
无论如何,我愿意尝试涉及或不涉及 Tomcat 的安装选项。如果有人成功地在 Windows 上使用 MySQL 数据库安装 XWiki,我们将不胜感激!