Hi all,
I have installed XWiki 2.2.3 in a Tomcat 6.0.20 servlet container using
Oracle 10g as database. The database connection settings are done on the
default way in the WEB-INF/hibernate.cfg.xml file. XWIKI is running
without any problems or exceptions.
Now I want to "replace" the database settings in hibernate.cfg.xml by
using a Tomcat container managed JNDI data source. The advantage for us
is the usage of Tomcat's server.xml as a central place where we can
manage all data sources of every webbapp within Tomcat.
I have red the articles under
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstallan…
and
http://java.dzone.com/articles/xwiki-installation-jboss-using
(it's a JBoss relatet documentation but many information pieces are
usefull for Tomcat too).
My JNDI configuration is as following:
a) definition of the JNDI datasource in Tomcat's server.xml
(defining the Oracle JNDI resource can't be the problem
because we use other Oracle JNDI data sources without any
problems)
<Resource name="jdbc/XWikiDS" auth="Container"
type="javax.sql.DataSource"
username="XWIKI"
password="*************"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@myoraserver:1521:MYORAINSTANCE"
connectionProperties="useUnicode=true;characterEncoding=utf8;"
maxActive="10"
maxIdle="2"
maxWait="5000"
testOnBorrow="true"
validationQuery="SELECT 1 FROM DUAL"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
/>
b) settings in xwiki/WEB-INF/hibernate.cfg.xml
<property
name="connection.datasource">java:/comp/env/jdbc/XWikiDS</property>
<property
name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="statement_cache.size">2</property>
<property
name="hibernate.connection.SetBigStringTryClob">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<mapping resource="xwiki.oracle.hbm.xml"/>
<mapping resource="feeds.oracle.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
c) settings in xwiki/WEB-INF/web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/XWikiDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
(using
<ResourceLink name="jdbc/XWikiDS" global="jdbc/XWikiDS"
type="javax.sql.DataSource" />
instead wan't help)
********************************************
Using this JNDI configuration causes the following errors:
2010-04-28 12:55:25,071 ERROR [org.hibernate.util.JDBCExceptionReporter]
Cannot create JDBC driver of class '' for connect URL 'null'
2010-04-28 12:55:25,072 ERROR
[com.xpn.xwiki.store.XWikiHibernateBaseStore] Failed creating schema
update script
org.hibernate.exception.GenericJDBCException: Cannot open connection
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:749)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:674)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.getSchemaUpdateScript(XWikiHibernateBaseStore.java:419)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.updateSchema(XWikiHibernateBaseStore.java:287)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.updateSchema(XWikiHibernateBaseStore.java:257)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.checkHibernate(XWikiHibernateBaseStore.java:566)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1057)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:1101)
at
com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager.getDBVersion(XWikiHibernateMigrationManager.java:68)
at
com.xpn.xwiki.store.migration.AbstractXWikiMigrationManager.<init>(AbstractXWikiMigrationManager.java:68)
at
com.xpn.xwiki.store.migration.hibernate.XWikiHibernateMigrationManager.<init>(XWikiHibernateMigrationManager.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.xpn.xwiki.XWiki.createClassFromConfig(XWiki.java:1070)
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:772)
at com.xpn.xwiki.XWiki.<init>(XWiki.java:717)
at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:354)
at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:435)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:135)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
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:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
JDBC driver of class '' for connect URL 'null'
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1150)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 59 more
Caused by: java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
at java.sql.DriverManager.getDriver(DriverManager.java:253)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)
*******************************************************
Very probably XWIKI can not resolve the connection settings defined as
JNDI data source in Tomcat's server.xml.
But where is my mistake or my misunderstanding regarding the XWIKI JNDI
settings?
Kind regards
Thomas