Pleae let me know how it goes for you as that is my goal for tomcat. However, 
currently I am struggling with mod_jk

Pete
[EMAIL PROTECTED] 


[EMAIL PROTECTED] (Jonathan Pierce) wrote:

>I must still be missing something here. Please help. I'm still not able to get
>an Oracle datasource using JNDI lookup to work. 
>
>The lookup is returning null. Has anyone been successful looking up an Oracle
>datasource resource using Tomcat 4.0b7?
>
>I've placed the following jars in /common/lib
>
>jdbc2_0-stdext.jar
>tyrex-0.9.7.0.jar
>classes12.jar (Oracle driver classes renamed from classes12.zip)
>
>// My lookup code is:
>
>theInitialContext = new InitialContext ();
>DataSource theDataSource = (DataSource) theInitialContext.lookup
>("java:comp/env/jdbc/oradb7");
>out.println ("theDataSource:" + theDataSource);
>
>I've configured server.xml as follows:
>
><Context path="/frn" docBase="frn" debug="0"
>                 reloadable="true">
>...
>          <Resource name="jdbc/oradb7" auth="SERVLET"
>                    type="javax.sql.DataSource" />
>          <ResourceParams name="jdbc/oradb7">
>            <parameter><name>user</name><value>testuser</value></parameter>
>            <parameter><name>password</name><value>testpassword</value></paramet
>er>
>            <parameter><name>driverClassName</name>
>              <value>oracle.jdbc.driver.OracleDriver</value></parameter>
>            <parameter><name>driverName</name>
>              <value>jdbc:oracle:thin:@localhost:1521:ORADB7</value></parameter>
>          </ResourceParams>
>
>I've configured my apps web.xml file as follows:
>
><web-app>
>...
>
>    <resource-ref>
>        <description>Development</description>
>        <res-ref-name>jdbc/oradb7</res-ref-name>
>        <res-type>javax.sql.DataSource</res-type>
>        <res-auth>Container</res-auth>
>        <res-sharing-scope>Sharable</res-sharing-scope>
>    </resource-ref>
>
>I also tried adding a factory parameter but I'm not sure if the value is
>correct. The class oracle.jdbc.pool.OracleDataSourceFactory exists in the
>classes.12.jar but I'm not sure if it is what I should be using as the factory
>class.
>
>          <Context path="/frn" docBase="frn" debug="0"
>                 reloadable="true">
>    ...
>          <Resource name="jdbc/oradb7" auth="SERVLET"
>                    type="javax.sql.DataSource" />
>          <ResourceParams name="jdbc/oradb7">
>      <parameter><name>factory</name>
>              <value>oracle.jdbc.pool.OracleDataSourceFactory</value></parameter
>>
>    ...
>
>
>____________________Reply Separator____________________
>Subject:    RE: tomcat 4 datasource casting
>Author: [EMAIL PROTECTED]
>Date:       8/20/2001 6:42 PM
>
>...and the second example for my "class-not-found" document presents itself
>=)
>
>Thanks guys!
>
>- r
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Craig R.
>> McClanahan
>> Sent: Monday, August 20, 2001 6:16 PM
>> To: [EMAIL PROTECTED]
>> Subject: Re: tomcat 4 datasource casting
>>
>>
>> Where do you have the jdbc2_0-stdext.jar file?  I'm betting that it needs
>> to be in $CATALINA_HOME/common/lib only for this to work -- because JAR
>> files here are on the class loading path for both Catalina internal
>> classes and web application classes.
>>
>> Craig
>>
>>
>> On Mon, 20 Aug 2001 [EMAIL PROTECTED] wrote:
>>
>> > Hello all,
>> >
>> > I read the great message Craig McClanahan posted in the archives  (from
>> > Aug 4) about how to setup and use a tomcat 4 datasource.  All
>> has seemed
>> > to go pretty well, but I'm having a funny problem, which I'm
>> not sure is a
>> > Tyrex problem, a Tomcat 4 problem or a Java education problem
>> on my part
>> > :).  (I'm using Tomcat 4 beta 7)
>> >
>> > When I try to get a DataSource from JNDI, I can retrieve a
>> reference just
>> > fine.  The problem is that I am having trouble casting it to a
>> > javax.sql.DataSource.  It returns an instance of
>> > tyrex.jdbc.xa.EnabledDataSource.  If I try to cast to
>> > javax.sql.DataSource, I get a ClassCastException from the server.  I
>> > looked up this class in the Tyrex API docs, and it does in fact
>> implement
>> > javax.sql.DataSource -- I think I should be able to cast to it
>> because of
>> > that.  If I work with the tyrex implementation directly, all is
>> ok (i.e.,
>> > calling tyrex.jdbc.xa.EnabledDataSource.getConnection()), but I
>> obviously
>> > won't want to care about the particular implementation in this case.
>> >
>> > If it helps, here is the code I'm trying to use:
>> >
>> > --------------------------
>> > ctx = new InitialContext();
>> > ds = (DataSource)ctx.lookup("java:comp/env/jdbc/lis_ds");
>> > --------------------------
>> >
>> > That failed, so I added this for debugging:
>> >
>> > --------------------------
>> > Object o = ctx.lookup("java:comp/env/jdbc/lis_ds");
>> > if (o == null) {
>> >    System.out.println("looked up a null object");
>> > } else {
>> >    System.out.println("o is of type: " + o.getClass().getName()); //<--
>> > prints "tyrex.jdbc.xa.EnabledDataSource"
>> > }
>> > --------------------------
>> >
>> > The exceptions I get are like this:
>> >
>> > --------------------------
>> > java.lang.ClassCastException: tyrex.jdbc.xa.EnabledDataSource
>> >         at report.ReportPrefs.setDateDefaults(ReportPrefs.java:52)
>> >         at report.ReportPrefs.<init>(ReportPrefs.java:16)
>> >         at java.lang.Class.newInstance0(Native Method)
>> >         at java.lang.Class.newInstance(Class.java:237)
>> >         at java.beans.Beans.instantiate(Beans.java:207)
>> >         at java.beans.Beans.instantiate(Beans.java:51)
>> > ........
>> > --------------------------
>> >
>> > Any ideas?
>> >
>> > Thanks,
>> > Jason Vasquez
>> >
>>
>>
>
>


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

Reply via email to