Search code examples
mysqlhttpxampptomcat7xwiki

XWiki + MySQL Database: Errors


I have (as far as I know) properly followed all of the instructions on xwiki.org, and I have also searched high and low for answers to my errors, but have unfortunately been unable to resolve them by myself.

I have downloaded XWiki in two different formats. The first is the .exe installer, and the second is the suggested .xar package, both for using on a Windows 8, 64 bit machine.

The first runs perfectly in "standalone" mode, but once the hibernate.cfg.xml file is changed to the preset MySQL Settings (which are accurate to my database), I get a very long HTTP 500 error. (This is after I added the MySQL Connection Java file, and created a MySQL database according to the instructions on xwiki.org) It seems that the primary issue is that it cannot find the com.mysql.jdbc.Driver along with the fact that I get an error later on the page saying that it cannot create a database connection pool.

The code pertaining to the error is this:

<!-- 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>

and this

<!-- 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"/>

And the error itself looks like this:

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 

Do I have to use the .xar installation version to properly connect to a database? I tried that way also, with Xampp and Tomcat. Tomcat installed fine and I can easily access it through localhost:(port). However, when I try to access my xwiki, I get a HTTP 404 error saying that the reference cannot be found, which is odd since it shows up with the other files in the deployment list included in Tomcat, and the Tomcat example file shown there (located in the same Directory) works fine...

I'm a bit concerned that even if I could get the XWiki to work properly through Tomcat, I would still get the first error that I mentioned later when I try to connect the MySQL database.

Side Note: I have suspicions that there may be Java file conflicts between those found in XWiki and those in Tomcat from other errors that I have seen while playing around and trying to make things work... but I could be wrong as I currently have very little knowledge of Java. I've seen several servlet errors and could not find class/file errors that according to a Forum that I found, are common errors belonging to the jasper.jar and the jsp-api.jar, both are found in Tomcat.

Regardless, I am open to trying installation options that do or do not involve Tomcat. If anyone has had success with installing XWiki on Windows with a MySQL database, your help would be much appreciated!


Solution

  • This was resolved some months ago. I was missing some vital information in the set-up, but it works fine now.