tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "lydie soler" <solerly...@hotmail.com>
Subject help on JDNI , DBCP with oracle
Date Fri, 26 Nov 2004 11:02:10 GMT
Hi,

I am quite new at tomcat so I am asking for your help.

I am trying to make tomcat deal with connection to my oracle database

Here is what I do:

1. I added the classes12.jar in the CATALINA_HOME\common\lib

2. in the server.xml, I added the following code

<Context path="/BaseDeDonnees" reloadable="true" 
docBase="C:\Dev\eclipse\workspace\BaseDeDonnees" 
workDir="C:\Dev\eclipse\workspace\BaseDeDonnees\work" >
	<Logger className="org.apache.catalina.logger.SystemOutLogger" 
verbosity="4" timestamp="true"/>
	<!-- Test pour faire gerer les connexions Oracle par Tomcat -->
	<Resource name="jdbc/BaseDeDonnees" scope="Shareable" 
type="javax.sql.DataSource"/>
	<ResourceParams name="jdbc/BaseDeDonnees">
		<parameter>
			<name>factory</name>
			<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
		</parameter>
		<parameter>
			<name>driverClassName</name>
			<value>oracle.jdbc.driver.OracleDriver</value>
		</parameter>
		<parameter>
			<name>url</name>
			<value>jdbc:oracle:thin:@bia:1521:symp</value>
		</parameter>
		<parameter>
			<name>username</name>
			<value>symprevius</value>
		</parameter>
		<parameter>
			<name>password</name>
			<value>symp</value>
		</parameter>

	</ResourceParams>
</Context>

3. I created a web.xml file that looks like this:
<web-app>

    <display-name>Base de donnees</display-name>
    <description>
	appli pour tester la gestion de connection par tomcat
    </description>
	<resource-ref>
	       <description>Oracle Datasource</description>
	       <res-ref-name>jdbc/BaseDeDonnees</res-ref-name>
	       <res-type>javax.sql.DataSource</res-type>
	       <res-auth>Container</res-auth>
	</resource-ref>
</web-app>

4. I want to execute the following code:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource) envContext.lookup("jdbc/BaseDeDonnees");
Connection conn = ds.getConnection();

but I get this error:

javax.servlet.ServletException: Invoker service() exception
	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:524)
	org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


cause

java.lang.NoClassDefFoundError: 
org/apache/commons/collections/CursorableLinkedList
	org.apache.commons.pool.impl.GenericObjectPool.(GenericObjectPool.java:392)
	org.apache.commons.pool.impl.GenericObjectPool.(GenericObjectPool.java:258)
	org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:765)
	org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
	fr.tomcat.IdentificationServlet.doPost(IdentificationServlet.java:45)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:466)
	org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

this error occures when I try to get the connection before it seems to work 
fine

I anyone can help...

Thanks a lot

Lydie



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message