Hi Hans, yes seems like I've got all the I's dotted and the t's
crossed...but still can't get the damn thing to load...I've got all the
Jars in the tomcat/common/lib and in the classpath and the following are
my 3 files. Let me know if you see anything I may have missed:
Server.xml:
<!-- Define the top level container in our container hierarchy -->
<Engine name="Standalone" defaultHost="epdata02.elps.bna.boeing.com"
debug="0">
<Context path="/examples" docBase="examples"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/paso2d" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/paso2d">
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d</value>
</parameter>
<parameter>
<name>username</name>
<value>tracks_adm</value>
</parameter>
<parameter>
<name>password</name>
<value>eporaadm</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30000</value>
Web.xml:
<resource-ref>
<res-ref-name>jdbc/paso2d</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Java code:
# cat JDBCTest.jsp
<html>
<head>
<%@ page errorPage="errorpg.jsp"
import="java.sql.*,
javax.sql.*,
oracle.jdbc.*,
java.io.*,
javax.naming.InitialContext,
javax.servlet.*,
javax.servlet.http.*,
java.util.*,
javax.naming.Context" %>
</head>
<body>
<h1>JDBC JNDI Resource Test</h1>
<%
Context initContext = new InitialContext();
Context envContext =
(Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource) envContext.lookup("jdbc/paso2d");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select * from employee_info;");
%>
<table width='600' border='1'>
<tr>
<th align='left'>bems_id</th>
<th align='left'>last_name</th>
</tr>
<%
while (rset.next()) {
%>
<tr><td> <%= rset.getString(1) %></td>
<td> <%= rset.getString(2) %></td>
</tr>
<% }
conn.close();
initContext.close();
%>
</table>
</body>
</html>
Chris Bliesner
Lead Oracle DBA/Unix admin
Wk Phone 915-834-1757
-----Original Message-----
From: Hans Wichman [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 1:14 PM
To: Tomcat Users List
Subject: RE: DBCP pooling error
Hi,
there are 4 parts to this,
a pool definition in your server.xml
a resource ref in your web.xml
a snippet of java code to get the datasource.
a bunch of drivers (probably something like classes12.jar)
Did you specify the first three of them and included the last one?
grtz
Hans
At 11:23 AM 6/17/2004 -0500, you wrote:
>Still having trouble with getting the DBCP working with Oracle. I have
>seemingly followed the link below but I am still getting that NULL
error
>below. Any ideas?
>
>
>
>Chris Bliesner
>
>Lead Oracle DBA/Unix admin
>
>Wk Phone 915-834-1757
>
>
>
>-----Original Message-----
>From: David Short [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 16, 2004 2:52 PM
>To: Bliesner, Christopher P
>Subject: RE: DBCP pooling error
>
>
>
>Try this:
>
>
>
>Web.xml
>
>
>
><resource-ref>
>
> <res-ref-name>jdbc/paso2d</res-ref-name>
>
> <res-type>javax.sql.DataSource</res-type>
>
> <res-auth>Container</res-auth>
>
></resource-ref>
>
>
>
>Check this link out:
>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example
s
>-howto.html
>
>-----Original Message-----
>From: Bliesner, Christopher P
[mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 16, 2004 12:46 PM
>To: [EMAIL PROTECTED]
>Subject: RE: DBCP pooling error
>
>Well...good news is were getting a new error:
>
>
>
>Name paso2d is not bound in this Context
>
>
>
>Chris Bliesner
>
>Lead Oracle DBA/Unix admin
>
>Wk Phone 915-834-1757
>
>
>
>-----Original Message-----
>From: David Short [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 16, 2004 12:52 PM
>To: Bliesner, Christopher P
>Subject: RE: DBCP pooling error
>
>
>
>Try this:
>
>
>
>DataSource ds = (DataSource)
>initContext.lookup("java:comp/env/jdbc/paso2d");
>
>
>
>
>
>-----Original Message-----
>From: Bliesner, Christopher P
[mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 16, 2004 11:45 AM
>To: [EMAIL PROTECTED]
>Subject: RE: DBCP pooling error
>
>Shouldn't need the Factory Tyrex stuff for the 4.12 version but didn't
>work anyway...but here is what the logs are saying in Catalina.out:
>
>
>
>Cannot load JDBC driver class 'null'
>
>java.lang.NullPointerException
>
> at java.lang.Class.forName0(Native Method)
>
> at java.lang.Class.forName(Class.java:115)
>
> at
>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc
e
>.java:523)
>
> at
>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j
a
>va:312)
>
> at
org.apache.jsp.JDBCTest_jsp._jspService(JDBCTest_jsp.java:57)
>
> at
>org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
>
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> at
>org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j
a
>va:204)
>
> at
>org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289
)
>
> at
>org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
>
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> at
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
a
>tionFilterChain.java:247)
>
> at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
t
>erChain.java:193)
>
> at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
v
>e.java:260)
>
> at
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
i
>nvokeNext(StandardPipeline.java:643)
>
> at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
4
>80)
>
> at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>
> at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
v
>e.java:191)
>
> at
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
i
>nvokeNext(StandardPipeline.java:643)
>
> at
>org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticato
r
>Base.java:471)
>
> at
>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.
i
>nvokeNext(StandardPipeline.java:641)
>
> at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
4
>80)
>
> at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>
> at org.apache.catalina.core.StandardContext.invoke(St
>
>
>
>Chris Bliesner
>
>Lead Oracle DBA/Unix admin
>
>Wk Phone 915-834-1757
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]