How to use my datasource into my portlet?
Patrick Gelin <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.devel |
|---|---|
| Organization | OSIS |
| Message-ID | <[email protected]> |
Hi,
I made a J2EE1 webapp using datasource and it's working fine into TOMCAT
4.3.31. Now I want to run it as a portlet into my jahia web application.
I followed te documentation "web application developer guide" writed by
Serge Huber but there is some problem to solve...
One is how to parameter my DataSource into TOMCAT so that my portlet can use
it. To do this I'm trying to parameter a jahia context containing my
Datasource like this:
file:/opt/jahia4.1.0_01_b6070/tomcat/conf/server.xml
---------------------------------------------------
(...)
<DefaultContext crossContext="true"/>
(...)
<Context path="/jahia" docBase="jahia" debug="5" reloadable="true"
crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="rpn_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/rpn_database"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/rpn_database">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value>#####</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://www.rpn.ch:3306/rpn?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
</Host>
But this doesn't work... I'm wondering if I need to use the defaultContext
in place to create a jahia context?
Any help is welcome.
Thanks.
--