tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: DBCP
Date Fri, 25 May 2007 15:46:35 GMT
Hi Mohammed

1. There should only be one copy of the driver jar file and it's only 
home should be CATALINA_HOME/lib if you are implementing the tomcat 
managed database pool (and you are).

2. If you define your datasource in <GlobalNamingResources> in the 
server.xml, you'll need to put a <ResourceLink> element in your 
context.xml file.  See the docs at

http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html

in the section titled "Configuring JNDI Resources".  My preference would 
be to drop the def in <GlobalNamingResources> and just have the 
<Resource> element in the webapp's context.xml file.

--David



Mohammed Zabin wrote:

> I put the jar file in my WEB-INF/lib and CATALINA_HOME/lib and CLASSPATH,
> but nothing changed, I got the same error
>
> On 5/25/07, Mohammed Zabin <jotnarta@gmail.com> wrote:
>
>>
>> Thank you Pid
>>
>> > Yeah, where exactly in the server.xml did you put this?
>>
>> I put it in <GlobalNamingResources> tag in server.xml
>>
>>
>>  On 5/25/07, Pid <p@pidster.com> wrote:
>> >
>> > Mohammed Zabin wrote:
>> > > Hello Geeks
>> >
>> > I'm not sure what the appropriate response is but I'll try to sneak
>> > something passed my language filter:
>> >
>> > Hello XXXXX,
>> >
>> > > Following is my problem, I am trying to configure my Tomcat 6 to
>> > connect to
>> > > my localhost Oracle 10g Database, following is my server.xml file :
>> > >
>> > > <Resource name="jdbc/myoracle" auth="Container"
>> > >                  type="javax.sql.DataSource" driverClassName="
>> > > oracle.jdbc.OracleDriver"
>> > >                  url=" jdbc:oracle:thin:@127.0.0.1:1521:orcldb"
>> > >                  username="hr" password="hr" maxActive="20"
>> > maxIdle="10"
>> > >                  maxWait="-1"/>
>> >
>> > Yeah, where exactly in the server.xml did you put this?
>> >
>> > Tomcat is now telling you that it can't even find the name of the
>> > driver, which I think you told us in your previous thread it could, 
>> but
>> > couldn't find the class.
>> >
>> > All you had to do was add the oracle driver to CATALINA_HOME/lib or 
>> your
>> > WEB-INF/lib and you should have been done...
>> >
>> >
>> > p
>> >
>> >
>> >
>> > > and i put the following in web.xml:
>> > >
>> > > <resource-ref>
>> > > <description>Oracle Datasource example</description>
>> > > <res-ref-name>jdbc/myoracle</res-ref-name>
>> > > <res-type>javax.sql.DataSource</res-type>
>> > > <res-auth>Container</res-auth>
>> > > </resource-ref>
>> > > and the following is code is the JSP code:
>> > >
>> > >
>> > > <%@ page import="javax.naming.Context,javax.naming.InitialContext,
>> > > javax.naming.NamingException,javax.sql.DataSource , java.sql.*" %>
>> > >
>> > > <%
>> > >  Context initContext = new InitialContext();
>> > >  Context envContext  = 
>> (Context)initContext.lookup("java:/comp/env");
>> > >  DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
>> > >  Connection conn = ds.getConnection();
>> > >
>> > >  out.println( "Connection Established" );
>> > > %>
>> > >
>> > > After running the jsp page, i got the following error:
>> > >
>> > > org.apache.jasper.JasperException : javax.servlet.ServletException:
>> > > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
>> > > driver of class '' for connect URL 'null'
>> > >     org.apache.jasper.servlet.JspServletWrapper.handleJspException (
>> > JspServletWrapper.java:532)
>> > >
>> > >     org.apache.jasper.servlet.JspServletWrapper.service(
>> > JspServletWrapper.java:408)
>> > >
>> > >     org.apache.jasper.servlet.JspServlet.serviceJspFile(
>> > JspServlet.java:320)
>> > >
>> > >     
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
>> > >     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>> > >
>> > > i have downloaded JDBC driver from otn.oracle classes12.zip and i
>> > > changed it to classes12.jar, and put it in CLASSPATH.
>> > >
>> > > I am working on this problem almost from 2 weeks, i didn't know what
>> > > the problem is, any help plzzzzzzzzzz
>> > >
>> >
>> >
>> >
>>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message