Hi,
I'm new at
xwiki.org and I want to use it with an external datasource in jboss seam
with Oracle 10g Database.
I have done the tasks that paged on
http://www.xwiki.org/xwiki/bin/view/AdminGuide/InstallationJBoss
I.) I've uncomment the resource-ref section in web.xml and copied the jboss-web.xml
from
XWiki.org in the WEB-INF dir.
<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>
II.) I' create a datasource (xwiki_ds.xml) that is similar to this one:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/XWikiDS</jndi-name>
<connection-url>jdbc:oracle:thin:@myserver.net:1521:XWIKITEST</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>myname</user-name>
<password>mypass</password>
<metadata>
<type-mapping>Oracle10g</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
III.) JBoss load and found the datasource via JNDI and I can get connection to it -
I've testet it with JBossTest.jsp (fragment shown below)
<%@ page import="javax.naming.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%! private String connectionInfo = null; %>
<%! private Connection con = null; %>
<%! private Statement stmt = null; %>
<%! private ResultSet resultSet = null; %>
<%
try {
InitialContext ctxt = new InitialContext();
DataSource ds = (DataSource) ctxt.lookup("java:/jdbc/XWikiDS");
con = ds.getConnection();
DatabaseMetaData metaData = con.getMetaData();
connectionInfo = "Database Name: " + metaData.getDatabaseProductName() +
"<BR>" +
"Database Version: " + metaData.getDatabaseProductVersion() +
"<BR>" +
"Driver Name: " + metaData.getDriverName() + "<BR>" +
"Driver Version: " + metaData.getDriverVersion() +
"<BR>" +
"URL: " + metaData.getURL();
%>
<H1>Connected to Database</H1>
<P><%= connectionInfo%></P>
IV.) I've modified the hibernate.cfg.xml to
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<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.maxActive">20</property>
<property name="dbcp.ps.maxWait">120000</property>
<property name="dbcp.ps.maxIdle">20</property>
<property
name="connection.datasource">java:/jdbc/XWikiDS</property>
<property
name="dialect">org.hibernate.dialect.OracleDialect</property>
<property
name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
<property name="connection.pool_size">2</property>
<property name="statement_cache.size">2</property>
<mapping resource="xwiki.oracle.hbm.xml"/>
<mapping resource="feeds.oracle.hbm.xml"/>
</session-factory>
</hibernate-configuration>
but that didn't work. How I've to change the hibernate.cfg.xml the xwiki found the
jndi external datasource?
I use another databaseuser than xwiki and that works if I put the database connection
parameter in the hibernate.cfg.xml directly.
I get the following ErrorMessage:
09:13:33,000 INFO [STDOUT] 09:13:33,000 FATAL http-127.0.0.1-8080-1
http://localhost:8080/xwiki/bin/view/Main/ DBCPConnectionProvider:configure:189 -
Could not create a DBCP pool
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at
com.xpn.xwiki.store.DBCPConnectionProvider.configure(DBCPConnectionProvider.java:100)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at
org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.initHibernate(XWikiHibernateBaseStore.java:140)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.checkHibernate(XWikiHibernateBaseStore.java:408)
at
com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentsNames(XWikiHibernateStore.java:1747)
at
com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentsNames(XWikiHibernateStore.java:2114)
at
com.xpn.xwiki.store.XWikiCacheStore.searchDocumentsNames(XWikiCacheStore.java:200)
at com.xpn.xwiki.plugin.lucene.IndexRebuilder.indexWiki(IndexRebuilder.java:116)
at
com.xpn.xwiki.plugin.lucene.IndexRebuilder.rebuildIndex(IndexRebuilder.java:92)
at
com.xpn.xwiki.plugin.lucene.IndexRebuilder.<init>(IndexRebuilder.java:57)
at com.xpn.xwiki.plugin.lucene.LucenePlugin.init(LucenePlugin.java:361)
at
com.xpn.xwiki.plugin.XWikiPluginManager.initPlugin(XWikiPluginManager.java:130)
at com.xpn.xwiki.plugin.XWikiPluginManager.addPlugin(XWikiPluginManager.java:69)
at com.xpn.xwiki.plugin.XWikiPluginManager.addPlugins(XWikiPluginManager.java:95)
at com.xpn.xwiki.XWiki.preparePlugins(XWiki.java:754)
at com.xpn.xwiki.XWiki.initXWiki(XWiki.java:708)
at com.xpn.xwiki.XWiki.<init>(XWiki.java:611)
at com.xpn.xwiki.XWiki.getMainXWiki(XWiki.java:238)
at com.xpn.xwiki.XWiki.getXWiki(XWiki.java:397)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:94)
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:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:117)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
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:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
09:13:33,015 INFO [STDOUT] 09:13:33,015 ERROR http-127.0.0.1-8080-1
http://localhost:8080/xwiki/bin/view/Main/ IndexRebuilder:indexWiki:118 - error g
etting document names for wiki xwiki
09:13:33,015 ERROR [STDERR] com.xpn.xwiki.XWikiException: Error number 3223 in 3:
Exception while searching documents with sql []
Wrapped Exception: Could not create a DBCP pool
Thanks for helping
Christian
_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen.
http://www.pc-sicherheit.web.de/startseite/?mc=022220