You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ying Jin <ji...@gmail.com> on 2023/06/11 18:33:01 UTC

Tomcat 9 data source configuration error

Hello,

We have an old java servlet web application which uses the "ojdbc6_g" jar
as Oracle jdbc driver and it works in Weblogic 14 server. Recently, we need
to try to see if this application can be deployed to Tomcat or not.

The JDBC data source has been configured in Tomcat 9.0.75 server according
to instructions below,

https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html

Please see below for the error we encountered in the Tomcat 9 deployment
and help shed some light on this problem. The Oracle database version is
19c.

Error: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for
connect URL 'jdbc:oracle:thin@xxx

java.sql.SQLException: Cannot create JDBC driver of class
'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
<http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>
xxxx'
at
org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
at
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
at
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
at
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)

Your help is much appreciated!

thanks,
Jenny

Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
Great! Thomas, thanks for your clarification. best, Jenny

On Wed, Jun 14, 2023 at 10:13 AM Thomas Hoffmann (Speed4Trade GmbH)
<Th...@speed4trade.com.invalid> wrote:

> Hello Jenny,
>
> yes, endorsed was deprecated and removed from java 11 onwards:
>
> https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-8E83E51A-88A3-4E9A-8E2A-66E1D66A966C
>
> Greetings, Thoma
>
> > -----Ursprüngliche Nachricht-----
> > Von: Ying Jin <ji...@gmail.com>
> > Gesendet: Mittwoch, 14. Juni 2023 17:11
> > An: Tomcat Users List <us...@tomcat.apache.org>
> > Betreff: Re: Tomcat 9 data source configuration error
> >
> > I think I found solution of this problem. It seems that this is a bug of
> older
> > version of eclipse WTP.
> >
> > I removed the endorsed directory argument from the debug configuration
> > and it works now.
> >
> > Thanks,
> > Jenny
> >
> > On Wed, Jun 14, 2023 at 9:43 AM Ying Jin <ji...@gmail.com> wrote:
> >
> > > The tomcat server can’t be started in Eclipse due to following error
> > > when JDK 11 is used:
> > >
> > > -Djava.endorsed.dirs=C:\ApacheTomcat
> > > 9.0.75\apache-tomcat-9.0.75\endorsed
> > > is not supported. Endorsed standards and standalone APIs
> > >
> > > in modular form will be supported via the concept of upgradeable
> modules.
> > >
> > >
> > > Thanks,
> > >
> > > Jenny
> > >
> > > On Wed, Jun 14, 2023 at 3:28 AM Mark Thomas <ma...@apache.org>
> > wrote:
> > >
> > >> On 14/06/2023 00:20, Ying Jin wrote:
> > >> > Mark,
> > >> >
> > >> > Thanks for the tip. I've resolved this error by using the way you
> > >> > suggested along with the newer version of jdbc driver ojdbc8.jar
> > >> > and modified the connection url in the right format.
> > >> >
> > >> > However, I encountered another problem trying to run the
> > >> > application in Eclipse with JDK 11. Please see below for the error
> > message.
> > >> > I didn't have any problem running the application with JDK 8.
> > >> > Any suggestions?
> > >>
> > >> None, since we can't see the error message.
> > >>
> > >> Embedded images don't work. Please paste the full stack trace and/or
> > >> post it online somewhere we can read it.
> > >>
> > >> Mark
> > >>
> > >>
> > >> > image.png
> > >> >
> > >> > Many thanks!
> > >> > Jenny
> > >> >
> > >> >
> > >> > On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <markt@apache.org
> > >> > <ma...@apache.org>> wrote:
> > >> >
> > >> >     On 12/06/2023 16:52, Ying Jin wrote:
> > >> >      > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib
> > >> folder as
> > >> >      > well as in the project's WEB-INF/lib folder.
> > >> >
> > >> >     Don't do that. Put it *only* in $CATALINA_BASE/lib
> > >> >
> > >> >
> > >> >      > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <
> jiny4clt@gmail.com
> > >> >     <ma...@gmail.com>
> > >> >      > <mailto:jiny4clt@gmail.com <ma...@gmail.com>>>
> > wrote:
> > >> >      >
> > >> >      >     Mark,
> > >> >      >
> > >> >      >     Thanks for your reply! Please see below for the details.
> > >> BTW, I
> > >> >      >     removed the database connection info. for security
> reasons.
> > >> >     The same
> > >> >      >     data source configuration and jdbc driver "ojdbc6_g"
> works
> > >> in the
> > >> >      >     Weblogic 14 server.
> > >> >      >
> > >> >      >     web.xml:
> > >> >      >        <resource-ref>
> > >> >      >       <description>project datasource</description>
> > >> >      >       <res-ref-name>jdbc/ariesDS</res-ref-name>
> > >> >      >       <res-type>javax.sql.DataSource</res-type>
> > >> >      >       <res-auth>Container</res-auth>
> > >> >      >
> > >> >      >     Tomcat 9.0.75 conf/context.xml:
> > >> >
> > >> >     Putting it there means you have created one instance of the
> resource
> > >> >     for
> > >> >     each deployed web application. You probably want to put it in:
> > >> >
> > >> >
> > >> > $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-
> > name>.xml
> > >> >
> > >> >     But maybe wait until you have it working before fixing that.
> > >> >
> > >> >      >       <Resource auth="Container"
> > >> >      >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
> > >> >      >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
> > >> >     password="PW"
> > >> >      >     type="javax.sql.DataSource"
> > >> >      >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
> > >> >      >     username="userName"/>
> > >> >      >
> > >> >      >     Datasource lookup code:
> > >> >      >
> > >> >      >         Context initContext = new InitialContext();
> > >> >      >          Context envContext  =
> > >> >      >     (Context)initContext.lookup("java:/comp/env");
> > >> >      >          DataSource ods =
> > >> >     (DataSource)envContext.lookup("jdbc/ariesDS");
> > >> >      >         if (ods==null)
> > >> >      >          {
> > >> >      >             System.out.println("ods = (OracleDataSource)
> > >> >      >     envCtx.lookup('jdbc/ariesDS') is null");
> > >> >      >             throw new Exception ("the data souce is null,
> error
> > >> >     throwed.");
> > >> >      >          }else{
> > >> >      >             conn = ods.getConnection();
> > >> >      >          }
> > >> >      >
> > >> >      >     The database version is Oracle 19C and I found out the
> Oracle
> > >> >     jdbc
> > >> >      >     driver should be ojdbc8.jar. If using this version of jar
> > >> >     file, any
> > >> >      >     code changes need to be done for the data source lookup
> code?
> > >> >
> > >> >     No. The lookup code should be fine.
> > >> >
> > >> >      >     The complete stacktrace:
> > >> >      >     image.png
> > >> >
> > >> >     Embedded images don't work. Please paste the full stack trace
> and/or
> > >> >     post it online somewhere we can read it.
> > >> >
> > >> >     Mark
> > >> >
> > >> >
> > >> >      >
> > >> >      >     Your help is greatly appreciated!
> > >> >      >
> > >> >      >     Thanks,
> > >> >      >     Jenny
> > >> >      >
> > >> >      >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <
> > >> markt@apache.org
> > >> >     <ma...@apache.org>
> > >> >      >     <mailto:markt@apache.org <ma...@apache.org>>>
> > wrote:
> > >> >      >
> > >> >      >         On 11/06/2023 19:33, Ying Jin wrote:
> > >> >      >          > Hello,
> > >> >      >          >
> > >> >      >          > We have an old java servlet web application which
> > >> uses the
> > >> >      >         "ojdbc6_g" jar
> > >> >      >          > as Oracle jdbc driver and it works in Weblogic 14
> > >> server.
> > >> >      >         Recently, we need
> > >> >      >          > to try to see if this application can be deployed
> to
> > >> >     Tomcat
> > >> >      >         or not.
> > >> >      >          >
> > >> >      >          > The JDBC data source has been configured in Tomcat
> > >> 9.0.75
> > >> >      >         server according
> > >> >      >          > to instructions below,
> > >> >      >          >
> > >> >      >          >
> > >> >      >
> > >> >     https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> > howto.html
> > >> >
> > >> > <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> > howto.html
> > >> >
> > >> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> > howto.html
> > >> >
> > >> > <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> > howto.html
> > >> >>
> > >> >      >          >
> > >> >      >          > Please see below for the error we encountered in
> the
> > >> >     Tomcat 9
> > >> >      >         deployment
> > >> >      >          > and help shed some light on this problem. The
> Oracle
> > >> >     database
> > >> >      >         version is
> > >> >      >          > 19c.
> > >> >      >          >
> > >> >      >          > Error: Cannot create JDBC driver of class
> > >> >      >         'oracle.jdbc.OracleDriver' for
> > >> >      >          > connect URL 'jdbc:oracle:thin@xxx
> > >> >      >          >
> > >> >      >          > java.sql.SQLException: Cannot create JDBC driver
> of
> > >> class
> > >> >      >          > 'oracle.jdbc.OracleDriver' for connect URL
> > >> >     'jdbc:oracle:thin@
> > >> >      >          >
> > >> >      >
> > >> >       <
> > >>
> > http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> > >> erbilt
> > >> <
> > >>
> > http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> > >> erbilt>
> > >> <
> > >>
> > http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> > >> erbilt
> > >> <
> > >>
> > http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> > >> erbilt
> > >> >>>
> > >> >      >          > xxxx'
> > >> >      >          > at
> > >> >      >          >
> > >> >      >
> > >> >
> > >>
> > >> org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory
> > >> .java:74)
> > >> >      >          > at
> > >> >      >          >
> > >> >      >
> > >> >
> > >>
> > >>
> > org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(
> > >> BasicDataSource.java:465)
> > >> >      >          > at
> > >> >      >          >
> > >> >      >
> > >> >
> > >>
> > >>
> > org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDa
> > >> taSource.java:529)
> > >> >      >          > at
> > >> >      >          >
> > >> >      >
> > >> >
> > >>
> > >>
> > org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataS
> > >> ource.java:710)
> > >> >      >
> > >> >      >         And the rest of the stack trace is?
> > >> >      >
> > >> >      >         ojdbc6_g.jar has been placed where in the file
> system?
> > >> >      >
> > >> >      >         That is a *very* old Oracle JDBC driver. It is also
> the
> > >> debug
> > >> >      >         version of
> > >> >      >         the JAR. You might want to think about using the
> latest
> > >> >     one for
> > >> >      >         Oracle 19c.
> > >> >      >
> > >> >      >         The changes to the configuration are? (Yes, I know
> you
> > >> >     said you
> > >> >      >         followed
> > >> >      >         the docs but we still need to know what you actually
> > >> >     changed. Not
> > >> >      >         everyone follows the docs correctly.)
> > >> >      >
> > >> >      >         Mark
> > >> >      >
> > >> >      >
> > >> >
> > >>
> > >> ---------------------------------------------------------------------
> > >> >      >         To unsubscribe, e-mail:
> > >> >     users-unsubscribe@tomcat.apache.org
> > >> >     <ma...@tomcat.apache.org>
> > >> >      >         <mailto:users-unsubscribe@tomcat.apache.org
> > >> >     <ma...@tomcat.apache.org>>
> > >> >      >         For additional commands, e-mail:
> > >> >     users-help@tomcat.apache.org <mailto:users-
> > help@tomcat.apache.org>
> > >> >      >         <mailto:users-help@tomcat.apache.org
> > >> >     <ma...@tomcat.apache.org>>
> > >> >      >
> > >> >
> > >> >
> > >>
> > >> ---------------------------------------------------------------------
> > >> >     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> >     <ma...@tomcat.apache.org>
> > >> >     For additional commands, e-mail: users-help@tomcat.apache.org
> > >> >     <ma...@tomcat.apache.org>
> > >> >
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
>

AW: Tomcat 9 data source configuration error

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.
Hello Jenny,

yes, endorsed was deprecated and removed from java 11 onwards:
https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-8E83E51A-88A3-4E9A-8E2A-66E1D66A966C

Greetings, Thoma

> -----Ursprüngliche Nachricht-----
> Von: Ying Jin <ji...@gmail.com>
> Gesendet: Mittwoch, 14. Juni 2023 17:11
> An: Tomcat Users List <us...@tomcat.apache.org>
> Betreff: Re: Tomcat 9 data source configuration error
> 
> I think I found solution of this problem. It seems that this is a bug of older
> version of eclipse WTP.
> 
> I removed the endorsed directory argument from the debug configuration
> and it works now.
> 
> Thanks,
> Jenny
> 
> On Wed, Jun 14, 2023 at 9:43 AM Ying Jin <ji...@gmail.com> wrote:
> 
> > The tomcat server can’t be started in Eclipse due to following error
> > when JDK 11 is used:
> >
> > -Djava.endorsed.dirs=C:\ApacheTomcat
> > 9.0.75\apache-tomcat-9.0.75\endorsed
> > is not supported. Endorsed standards and standalone APIs
> >
> > in modular form will be supported via the concept of upgradeable modules.
> >
> >
> > Thanks,
> >
> > Jenny
> >
> > On Wed, Jun 14, 2023 at 3:28 AM Mark Thomas <ma...@apache.org>
> wrote:
> >
> >> On 14/06/2023 00:20, Ying Jin wrote:
> >> > Mark,
> >> >
> >> > Thanks for the tip. I've resolved this error by using the way you
> >> > suggested along with the newer version of jdbc driver ojdbc8.jar
> >> > and modified the connection url in the right format.
> >> >
> >> > However, I encountered another problem trying to run the
> >> > application in Eclipse with JDK 11. Please see below for the error
> message.
> >> > I didn't have any problem running the application with JDK 8.
> >> > Any suggestions?
> >>
> >> None, since we can't see the error message.
> >>
> >> Embedded images don't work. Please paste the full stack trace and/or
> >> post it online somewhere we can read it.
> >>
> >> Mark
> >>
> >>
> >> > image.png
> >> >
> >> > Many thanks!
> >> > Jenny
> >> >
> >> >
> >> > On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <markt@apache.org
> >> > <ma...@apache.org>> wrote:
> >> >
> >> >     On 12/06/2023 16:52, Ying Jin wrote:
> >> >      > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib
> >> folder as
> >> >      > well as in the project's WEB-INF/lib folder.
> >> >
> >> >     Don't do that. Put it *only* in $CATALINA_BASE/lib
> >> >
> >> >
> >> >      > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com
> >> >     <ma...@gmail.com>
> >> >      > <mailto:jiny4clt@gmail.com <ma...@gmail.com>>>
> wrote:
> >> >      >
> >> >      >     Mark,
> >> >      >
> >> >      >     Thanks for your reply! Please see below for the details.
> >> BTW, I
> >> >      >     removed the database connection info. for security reasons.
> >> >     The same
> >> >      >     data source configuration and jdbc driver "ojdbc6_g" works
> >> in the
> >> >      >     Weblogic 14 server.
> >> >      >
> >> >      >     web.xml:
> >> >      >        <resource-ref>
> >> >      >       <description>project datasource</description>
> >> >      >       <res-ref-name>jdbc/ariesDS</res-ref-name>
> >> >      >       <res-type>javax.sql.DataSource</res-type>
> >> >      >       <res-auth>Container</res-auth>
> >> >      >
> >> >      >     Tomcat 9.0.75 conf/context.xml:
> >> >
> >> >     Putting it there means you have created one instance of the resource
> >> >     for
> >> >     each deployed web application. You probably want to put it in:
> >> >
> >> >
> >> > $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-
> name>.xml
> >> >
> >> >     But maybe wait until you have it working before fixing that.
> >> >
> >> >      >       <Resource auth="Container"
> >> >      >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
> >> >      >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
> >> >     password="PW"
> >> >      >     type="javax.sql.DataSource"
> >> >      >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
> >> >      >     username="userName"/>
> >> >      >
> >> >      >     Datasource lookup code:
> >> >      >
> >> >      >         Context initContext = new InitialContext();
> >> >      >          Context envContext  =
> >> >      >     (Context)initContext.lookup("java:/comp/env");
> >> >      >          DataSource ods =
> >> >     (DataSource)envContext.lookup("jdbc/ariesDS");
> >> >      >         if (ods==null)
> >> >      >          {
> >> >      >             System.out.println("ods = (OracleDataSource)
> >> >      >     envCtx.lookup('jdbc/ariesDS') is null");
> >> >      >             throw new Exception ("the data souce is null, error
> >> >     throwed.");
> >> >      >          }else{
> >> >      >             conn = ods.getConnection();
> >> >      >          }
> >> >      >
> >> >      >     The database version is Oracle 19C and I found out the Oracle
> >> >     jdbc
> >> >      >     driver should be ojdbc8.jar. If using this version of jar
> >> >     file, any
> >> >      >     code changes need to be done for the data source lookup code?
> >> >
> >> >     No. The lookup code should be fine.
> >> >
> >> >      >     The complete stacktrace:
> >> >      >     image.png
> >> >
> >> >     Embedded images don't work. Please paste the full stack trace and/or
> >> >     post it online somewhere we can read it.
> >> >
> >> >     Mark
> >> >
> >> >
> >> >      >
> >> >      >     Your help is greatly appreciated!
> >> >      >
> >> >      >     Thanks,
> >> >      >     Jenny
> >> >      >
> >> >      >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <
> >> markt@apache.org
> >> >     <ma...@apache.org>
> >> >      >     <mailto:markt@apache.org <ma...@apache.org>>>
> wrote:
> >> >      >
> >> >      >         On 11/06/2023 19:33, Ying Jin wrote:
> >> >      >          > Hello,
> >> >      >          >
> >> >      >          > We have an old java servlet web application which
> >> uses the
> >> >      >         "ojdbc6_g" jar
> >> >      >          > as Oracle jdbc driver and it works in Weblogic 14
> >> server.
> >> >      >         Recently, we need
> >> >      >          > to try to see if this application can be deployed to
> >> >     Tomcat
> >> >      >         or not.
> >> >      >          >
> >> >      >          > The JDBC data source has been configured in Tomcat
> >> 9.0.75
> >> >      >         server according
> >> >      >          > to instructions below,
> >> >      >          >
> >> >      >          >
> >> >      >
> >> >     https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> howto.html
> >> >
> >> > <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> howto.html
> >> >
> >> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> howto.html
> >> >
> >> > <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-
> howto.html
> >> >>
> >> >      >          >
> >> >      >          > Please see below for the error we encountered in the
> >> >     Tomcat 9
> >> >      >         deployment
> >> >      >          > and help shed some light on this problem. The Oracle
> >> >     database
> >> >      >         version is
> >> >      >          > 19c.
> >> >      >          >
> >> >      >          > Error: Cannot create JDBC driver of class
> >> >      >         'oracle.jdbc.OracleDriver' for
> >> >      >          > connect URL 'jdbc:oracle:thin@xxx
> >> >      >          >
> >> >      >          > java.sql.SQLException: Cannot create JDBC driver of
> >> class
> >> >      >          > 'oracle.jdbc.OracleDriver' for connect URL
> >> >     'jdbc:oracle:thin@
> >> >      >          >
> >> >      >
> >> >       <
> >>
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> >> erbilt
> >> <
> >>
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> >> erbilt>
> >> <
> >>
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> >> erbilt
> >> <
> >>
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vand
> >> erbilt
> >> >>>
> >> >      >          > xxxx'
> >> >      >          > at
> >> >      >          >
> >> >      >
> >> >
> >>
> >> org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory
> >> .java:74)
> >> >      >          > at
> >> >      >          >
> >> >      >
> >> >
> >>
> >>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(
> >> BasicDataSource.java:465)
> >> >      >          > at
> >> >      >          >
> >> >      >
> >> >
> >>
> >>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDa
> >> taSource.java:529)
> >> >      >          > at
> >> >      >          >
> >> >      >
> >> >
> >>
> >>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataS
> >> ource.java:710)
> >> >      >
> >> >      >         And the rest of the stack trace is?
> >> >      >
> >> >      >         ojdbc6_g.jar has been placed where in the file system?
> >> >      >
> >> >      >         That is a *very* old Oracle JDBC driver. It is also the
> >> debug
> >> >      >         version of
> >> >      >         the JAR. You might want to think about using the latest
> >> >     one for
> >> >      >         Oracle 19c.
> >> >      >
> >> >      >         The changes to the configuration are? (Yes, I know you
> >> >     said you
> >> >      >         followed
> >> >      >         the docs but we still need to know what you actually
> >> >     changed. Not
> >> >      >         everyone follows the docs correctly.)
> >> >      >
> >> >      >         Mark
> >> >      >
> >> >      >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> >      >         To unsubscribe, e-mail:
> >> >     users-unsubscribe@tomcat.apache.org
> >> >     <ma...@tomcat.apache.org>
> >> >      >         <mailto:users-unsubscribe@tomcat.apache.org
> >> >     <ma...@tomcat.apache.org>>
> >> >      >         For additional commands, e-mail:
> >> >     users-help@tomcat.apache.org <mailto:users-
> help@tomcat.apache.org>
> >> >      >         <mailto:users-help@tomcat.apache.org
> >> >     <ma...@tomcat.apache.org>>
> >> >      >
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> >     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> >     <ma...@tomcat.apache.org>
> >> >     For additional commands, e-mail: users-help@tomcat.apache.org
> >> >     <ma...@tomcat.apache.org>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>

Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
I think I found solution of this problem. It seems that this is a bug of
older version of eclipse WTP.

I removed the endorsed directory argument from the debug configuration and
it works now.

Thanks,
Jenny

On Wed, Jun 14, 2023 at 9:43 AM Ying Jin <ji...@gmail.com> wrote:

> The tomcat server can’t be started in Eclipse due to following error when
> JDK 11 is used:
>
> -Djava.endorsed.dirs=C:\ApacheTomcat 9.0.75\apache-tomcat-9.0.75\endorsed
> is not supported. Endorsed standards and standalone APIs
>
> in modular form will be supported via the concept of upgradeable modules.
>
>
> Thanks,
>
> Jenny
>
> On Wed, Jun 14, 2023 at 3:28 AM Mark Thomas <ma...@apache.org> wrote:
>
>> On 14/06/2023 00:20, Ying Jin wrote:
>> > Mark,
>> >
>> > Thanks for the tip. I've resolved this error by using the way you
>> > suggested along with the newer version of jdbc driver ojdbc8.jar and
>> > modified the connection url in the right format.
>> >
>> > However, I encountered another problem trying to run the application in
>> > Eclipse with JDK 11. Please see below for the error message.
>> > I didn't have any problem running the application with JDK 8.
>> > Any suggestions?
>>
>> None, since we can't see the error message.
>>
>> Embedded images don't work. Please paste the full stack trace and/or
>> post it online somewhere we can read it.
>>
>> Mark
>>
>>
>> > image.png
>> >
>> > Many thanks!
>> > Jenny
>> >
>> >
>> > On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <markt@apache.org
>> > <ma...@apache.org>> wrote:
>> >
>> >     On 12/06/2023 16:52, Ying Jin wrote:
>> >      > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib
>> folder as
>> >      > well as in the project's WEB-INF/lib folder.
>> >
>> >     Don't do that. Put it *only* in $CATALINA_BASE/lib
>> >
>> >
>> >      > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com
>> >     <ma...@gmail.com>
>> >      > <mailto:jiny4clt@gmail.com <ma...@gmail.com>>> wrote:
>> >      >
>> >      >     Mark,
>> >      >
>> >      >     Thanks for your reply! Please see below for the details.
>> BTW, I
>> >      >     removed the database connection info. for security reasons.
>> >     The same
>> >      >     data source configuration and jdbc driver "ojdbc6_g" works
>> in the
>> >      >     Weblogic 14 server.
>> >      >
>> >      >     web.xml:
>> >      >        <resource-ref>
>> >      >       <description>project datasource</description>
>> >      >       <res-ref-name>jdbc/ariesDS</res-ref-name>
>> >      >       <res-type>javax.sql.DataSource</res-type>
>> >      >       <res-auth>Container</res-auth>
>> >      >
>> >      >     Tomcat 9.0.75 conf/context.xml:
>> >
>> >     Putting it there means you have created one instance of the resource
>> >     for
>> >     each deployed web application. You probably want to put it in:
>> >
>> >     $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-name>.xml
>> >
>> >     But maybe wait until you have it working before fixing that.
>> >
>> >      >       <Resource auth="Container"
>> >      >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
>> >      >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
>> >     password="PW"
>> >      >     type="javax.sql.DataSource"
>> >      >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
>> >      >     username="userName"/>
>> >      >
>> >      >     Datasource lookup code:
>> >      >
>> >      >         Context initContext = new InitialContext();
>> >      >          Context envContext  =
>> >      >     (Context)initContext.lookup("java:/comp/env");
>> >      >          DataSource ods =
>> >     (DataSource)envContext.lookup("jdbc/ariesDS");
>> >      >         if (ods==null)
>> >      >          {
>> >      >             System.out.println("ods = (OracleDataSource)
>> >      >     envCtx.lookup('jdbc/ariesDS') is null");
>> >      >             throw new Exception ("the data souce is null, error
>> >     throwed.");
>> >      >          }else{
>> >      >             conn = ods.getConnection();
>> >      >          }
>> >      >
>> >      >     The database version is Oracle 19C and I found out the Oracle
>> >     jdbc
>> >      >     driver should be ojdbc8.jar. If using this version of jar
>> >     file, any
>> >      >     code changes need to be done for the data source lookup code?
>> >
>> >     No. The lookup code should be fine.
>> >
>> >      >     The complete stacktrace:
>> >      >     image.png
>> >
>> >     Embedded images don't work. Please paste the full stack trace and/or
>> >     post it online somewhere we can read it.
>> >
>> >     Mark
>> >
>> >
>> >      >
>> >      >     Your help is greatly appreciated!
>> >      >
>> >      >     Thanks,
>> >      >     Jenny
>> >      >
>> >      >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <
>> markt@apache.org
>> >     <ma...@apache.org>
>> >      >     <mailto:markt@apache.org <ma...@apache.org>>> wrote:
>> >      >
>> >      >         On 11/06/2023 19:33, Ying Jin wrote:
>> >      >          > Hello,
>> >      >          >
>> >      >          > We have an old java servlet web application which
>> uses the
>> >      >         "ojdbc6_g" jar
>> >      >          > as Oracle jdbc driver and it works in Weblogic 14
>> server.
>> >      >         Recently, we need
>> >      >          > to try to see if this application can be deployed to
>> >     Tomcat
>> >      >         or not.
>> >      >          >
>> >      >          > The JDBC data source has been configured in Tomcat
>> 9.0.75
>> >      >         server according
>> >      >          > to instructions below,
>> >      >          >
>> >      >          >
>> >      >
>> >     https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>> >
>> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>> >>
>> >      >          >
>> >      >          > Please see below for the error we encountered in the
>> >     Tomcat 9
>> >      >         deployment
>> >      >          > and help shed some light on this problem. The Oracle
>> >     database
>> >      >         version is
>> >      >          > 19c.
>> >      >          >
>> >      >          > Error: Cannot create JDBC driver of class
>> >      >         'oracle.jdbc.OracleDriver' for
>> >      >          > connect URL 'jdbc:oracle:thin@xxx
>> >      >          >
>> >      >          > java.sql.SQLException: Cannot create JDBC driver of
>> class
>> >      >          > 'oracle.jdbc.OracleDriver' for connect URL
>> >     'jdbc:oracle:thin@
>> >      >          >
>> >      >
>> >       <
>> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
>> <
>> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>
>> <
>> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
>> <
>> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
>> >>>
>> >      >          > xxxx'
>> >      >          > at
>> >      >          >
>> >      >
>> >
>>  org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
>> >      >          > at
>> >      >          >
>> >      >
>> >
>>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
>> >      >          > at
>> >      >          >
>> >      >
>> >
>>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
>> >      >          > at
>> >      >          >
>> >      >
>> >
>>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
>> >      >
>> >      >         And the rest of the stack trace is?
>> >      >
>> >      >         ojdbc6_g.jar has been placed where in the file system?
>> >      >
>> >      >         That is a *very* old Oracle JDBC driver. It is also the
>> debug
>> >      >         version of
>> >      >         the JAR. You might want to think about using the latest
>> >     one for
>> >      >         Oracle 19c.
>> >      >
>> >      >         The changes to the configuration are? (Yes, I know you
>> >     said you
>> >      >         followed
>> >      >         the docs but we still need to know what you actually
>> >     changed. Not
>> >      >         everyone follows the docs correctly.)
>> >      >
>> >      >         Mark
>> >      >
>> >      >
>> >
>>  ---------------------------------------------------------------------
>> >      >         To unsubscribe, e-mail:
>> >     users-unsubscribe@tomcat.apache.org
>> >     <ma...@tomcat.apache.org>
>> >      >         <mailto:users-unsubscribe@tomcat.apache.org
>> >     <ma...@tomcat.apache.org>>
>> >      >         For additional commands, e-mail:
>> >     users-help@tomcat.apache.org <ma...@tomcat.apache.org>
>> >      >         <mailto:users-help@tomcat.apache.org
>> >     <ma...@tomcat.apache.org>>
>> >      >
>> >
>> >
>>  ---------------------------------------------------------------------
>> >     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >     <ma...@tomcat.apache.org>
>> >     For additional commands, e-mail: users-help@tomcat.apache.org
>> >     <ma...@tomcat.apache.org>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>

Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
The tomcat server can’t be started in Eclipse due to following error when
JDK 11 is used:

-Djava.endorsed.dirs=C:\ApacheTomcat 9.0.75\apache-tomcat-9.0.75\endorsed
is not supported. Endorsed standards and standalone APIs

in modular form will be supported via the concept of upgradeable modules.


Thanks,

Jenny

On Wed, Jun 14, 2023 at 3:28 AM Mark Thomas <ma...@apache.org> wrote:

> On 14/06/2023 00:20, Ying Jin wrote:
> > Mark,
> >
> > Thanks for the tip. I've resolved this error by using the way you
> > suggested along with the newer version of jdbc driver ojdbc8.jar and
> > modified the connection url in the right format.
> >
> > However, I encountered another problem trying to run the application in
> > Eclipse with JDK 11. Please see below for the error message.
> > I didn't have any problem running the application with JDK 8.
> > Any suggestions?
>
> None, since we can't see the error message.
>
> Embedded images don't work. Please paste the full stack trace and/or
> post it online somewhere we can read it.
>
> Mark
>
>
> > image.png
> >
> > Many thanks!
> > Jenny
> >
> >
> > On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <markt@apache.org
> > <ma...@apache.org>> wrote:
> >
> >     On 12/06/2023 16:52, Ying Jin wrote:
> >      > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib folder
> as
> >      > well as in the project's WEB-INF/lib folder.
> >
> >     Don't do that. Put it *only* in $CATALINA_BASE/lib
> >
> >
> >      > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com
> >     <ma...@gmail.com>
> >      > <mailto:jiny4clt@gmail.com <ma...@gmail.com>>> wrote:
> >      >
> >      >     Mark,
> >      >
> >      >     Thanks for your reply! Please see below for the details. BTW,
> I
> >      >     removed the database connection info. for security reasons.
> >     The same
> >      >     data source configuration and jdbc driver "ojdbc6_g" works in
> the
> >      >     Weblogic 14 server.
> >      >
> >      >     web.xml:
> >      >        <resource-ref>
> >      >       <description>project datasource</description>
> >      >       <res-ref-name>jdbc/ariesDS</res-ref-name>
> >      >       <res-type>javax.sql.DataSource</res-type>
> >      >       <res-auth>Container</res-auth>
> >      >
> >      >     Tomcat 9.0.75 conf/context.xml:
> >
> >     Putting it there means you have created one instance of the resource
> >     for
> >     each deployed web application. You probably want to put it in:
> >
> >     $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-name>.xml
> >
> >     But maybe wait until you have it working before fixing that.
> >
> >      >       <Resource auth="Container"
> >      >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
> >      >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
> >     password="PW"
> >      >     type="javax.sql.DataSource"
> >      >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
> >      >     username="userName"/>
> >      >
> >      >     Datasource lookup code:
> >      >
> >      >         Context initContext = new InitialContext();
> >      >          Context envContext  =
> >      >     (Context)initContext.lookup("java:/comp/env");
> >      >          DataSource ods =
> >     (DataSource)envContext.lookup("jdbc/ariesDS");
> >      >         if (ods==null)
> >      >          {
> >      >             System.out.println("ods = (OracleDataSource)
> >      >     envCtx.lookup('jdbc/ariesDS') is null");
> >      >             throw new Exception ("the data souce is null, error
> >     throwed.");
> >      >          }else{
> >      >             conn = ods.getConnection();
> >      >          }
> >      >
> >      >     The database version is Oracle 19C and I found out the Oracle
> >     jdbc
> >      >     driver should be ojdbc8.jar. If using this version of jar
> >     file, any
> >      >     code changes need to be done for the data source lookup code?
> >
> >     No. The lookup code should be fine.
> >
> >      >     The complete stacktrace:
> >      >     image.png
> >
> >     Embedded images don't work. Please paste the full stack trace and/or
> >     post it online somewhere we can read it.
> >
> >     Mark
> >
> >
> >      >
> >      >     Your help is greatly appreciated!
> >      >
> >      >     Thanks,
> >      >     Jenny
> >      >
> >      >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <markt@apache.org
> >     <ma...@apache.org>
> >      >     <mailto:markt@apache.org <ma...@apache.org>>> wrote:
> >      >
> >      >         On 11/06/2023 19:33, Ying Jin wrote:
> >      >          > Hello,
> >      >          >
> >      >          > We have an old java servlet web application which uses
> the
> >      >         "ojdbc6_g" jar
> >      >          > as Oracle jdbc driver and it works in Weblogic 14
> server.
> >      >         Recently, we need
> >      >          > to try to see if this application can be deployed to
> >     Tomcat
> >      >         or not.
> >      >          >
> >      >          > The JDBC data source has been configured in Tomcat
> 9.0.75
> >      >         server according
> >      >          > to instructions below,
> >      >          >
> >      >          >
> >      >
> >     https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html>
> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
> >     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
> >>
> >      >          >
> >      >          > Please see below for the error we encountered in the
> >     Tomcat 9
> >      >         deployment
> >      >          > and help shed some light on this problem. The Oracle
> >     database
> >      >         version is
> >      >          > 19c.
> >      >          >
> >      >          > Error: Cannot create JDBC driver of class
> >      >         'oracle.jdbc.OracleDriver' for
> >      >          > connect URL 'jdbc:oracle:thin@xxx
> >      >          >
> >      >          > java.sql.SQLException: Cannot create JDBC driver of
> class
> >      >          > 'oracle.jdbc.OracleDriver' for connect URL
> >     'jdbc:oracle:thin@
> >      >          >
> >      >
> >       <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>
> <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> >>>
> >      >          > xxxx'
> >      >          > at
> >      >          >
> >      >
> >
>  org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
> >      >          > at
> >      >          >
> >      >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
> >      >          > at
> >      >          >
> >      >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
> >      >          > at
> >      >          >
> >      >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
> >      >
> >      >         And the rest of the stack trace is?
> >      >
> >      >         ojdbc6_g.jar has been placed where in the file system?
> >      >
> >      >         That is a *very* old Oracle JDBC driver. It is also the
> debug
> >      >         version of
> >      >         the JAR. You might want to think about using the latest
> >     one for
> >      >         Oracle 19c.
> >      >
> >      >         The changes to the configuration are? (Yes, I know you
> >     said you
> >      >         followed
> >      >         the docs but we still need to know what you actually
> >     changed. Not
> >      >         everyone follows the docs correctly.)
> >      >
> >      >         Mark
> >      >
> >      >
> >
>  ---------------------------------------------------------------------
> >      >         To unsubscribe, e-mail:
> >     users-unsubscribe@tomcat.apache.org
> >     <ma...@tomcat.apache.org>
> >      >         <mailto:users-unsubscribe@tomcat.apache.org
> >     <ma...@tomcat.apache.org>>
> >      >         For additional commands, e-mail:
> >     users-help@tomcat.apache.org <ma...@tomcat.apache.org>
> >      >         <mailto:users-help@tomcat.apache.org
> >     <ma...@tomcat.apache.org>>
> >      >
> >
> >     ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >     <ma...@tomcat.apache.org>
> >     For additional commands, e-mail: users-help@tomcat.apache.org
> >     <ma...@tomcat.apache.org>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat 9 data source configuration error

Posted by Mark Thomas <ma...@apache.org>.
On 14/06/2023 00:20, Ying Jin wrote:
> Mark,
> 
> Thanks for the tip. I've resolved this error by using the way you 
> suggested along with the newer version of jdbc driver ojdbc8.jar and 
> modified the connection url in the right format.
> 
> However, I encountered another problem trying to run the application in 
> Eclipse with JDK 11. Please see below for the error message.
> I didn't have any problem running the application with JDK 8. 
> Any suggestions?

None, since we can't see the error message.

Embedded images don't work. Please paste the full stack trace and/or 
post it online somewhere we can read it.

Mark


> image.png
> 
> Many thanks!
> Jenny
> 
> 
> On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <markt@apache.org 
> <ma...@apache.org>> wrote:
> 
>     On 12/06/2023 16:52, Ying Jin wrote:
>      > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib folder as
>      > well as in the project's WEB-INF/lib folder.
> 
>     Don't do that. Put it *only* in $CATALINA_BASE/lib
> 
> 
>      > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com
>     <ma...@gmail.com>
>      > <mailto:jiny4clt@gmail.com <ma...@gmail.com>>> wrote:
>      >
>      >     Mark,
>      >
>      >     Thanks for your reply! Please see below for the details. BTW, I
>      >     removed the database connection info. for security reasons.
>     The same
>      >     data source configuration and jdbc driver "ojdbc6_g" works in the
>      >     Weblogic 14 server.
>      >
>      >     web.xml:
>      >        <resource-ref>
>      >       <description>project datasource</description>
>      >       <res-ref-name>jdbc/ariesDS</res-ref-name>
>      >       <res-type>javax.sql.DataSource</res-type>
>      >       <res-auth>Container</res-auth>
>      >
>      >     Tomcat 9.0.75 conf/context.xml:
> 
>     Putting it there means you have created one instance of the resource
>     for
>     each deployed web application. You probably want to put it in:
> 
>     $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-name>.xml
> 
>     But maybe wait until you have it working before fixing that.
> 
>      >       <Resource auth="Container"
>      >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
>      >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
>     password="PW"
>      >     type="javax.sql.DataSource"
>      >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
>      >     username="userName"/>
>      >
>      >     Datasource lookup code:
>      >
>      >         Context initContext = new InitialContext();
>      >          Context envContext  =
>      >     (Context)initContext.lookup("java:/comp/env");
>      >          DataSource ods =
>     (DataSource)envContext.lookup("jdbc/ariesDS");
>      >         if (ods==null)
>      >          {
>      >             System.out.println("ods = (OracleDataSource)
>      >     envCtx.lookup('jdbc/ariesDS') is null");
>      >             throw new Exception ("the data souce is null, error
>     throwed.");
>      >          }else{
>      >             conn = ods.getConnection();
>      >          }
>      >
>      >     The database version is Oracle 19C and I found out the Oracle
>     jdbc
>      >     driver should be ojdbc8.jar. If using this version of jar
>     file, any
>      >     code changes need to be done for the data source lookup code?
> 
>     No. The lookup code should be fine.
> 
>      >     The complete stacktrace:
>      >     image.png
> 
>     Embedded images don't work. Please paste the full stack trace and/or
>     post it online somewhere we can read it.
> 
>     Mark
> 
> 
>      >
>      >     Your help is greatly appreciated!
>      >
>      >     Thanks,
>      >     Jenny
>      >
>      >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <markt@apache.org
>     <ma...@apache.org>
>      >     <mailto:markt@apache.org <ma...@apache.org>>> wrote:
>      >
>      >         On 11/06/2023 19:33, Ying Jin wrote:
>      >          > Hello,
>      >          >
>      >          > We have an old java servlet web application which uses the
>      >         "ojdbc6_g" jar
>      >          > as Oracle jdbc driver and it works in Weblogic 14 server.
>      >         Recently, we need
>      >          > to try to see if this application can be deployed to
>     Tomcat
>      >         or not.
>      >          >
>      >          > The JDBC data source has been configured in Tomcat 9.0.75
>      >         server according
>      >          > to instructions below,
>      >          >
>      >          >
>      >
>     https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html>
>     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>     <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html>>
>      >          >
>      >          > Please see below for the error we encountered in the
>     Tomcat 9
>      >         deployment
>      >          > and help shed some light on this problem. The Oracle
>     database
>      >         version is
>      >          > 19c.
>      >          >
>      >          > Error: Cannot create JDBC driver of class
>      >         'oracle.jdbc.OracleDriver' for
>      >          > connect URL 'jdbc:oracle:thin@xxx
>      >          >
>      >          > java.sql.SQLException: Cannot create JDBC driver of class
>      >          > 'oracle.jdbc.OracleDriver' for connect URL
>     'jdbc:oracle:thin@
>      >          >
>      >       
>       <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt> <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>>>
>      >          > xxxx'
>      >          > at
>      >          >
>      >       
>       org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
>      >          > at
>      >          >
>      >       
>       org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
>      >          > at
>      >          >
>      >       
>       org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
>      >          > at
>      >          >
>      >       
>       org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
>      >
>      >         And the rest of the stack trace is?
>      >
>      >         ojdbc6_g.jar has been placed where in the file system?
>      >
>      >         That is a *very* old Oracle JDBC driver. It is also the debug
>      >         version of
>      >         the JAR. You might want to think about using the latest
>     one for
>      >         Oracle 19c.
>      >
>      >         The changes to the configuration are? (Yes, I know you
>     said you
>      >         followed
>      >         the docs but we still need to know what you actually
>     changed. Not
>      >         everyone follows the docs correctly.)
>      >
>      >         Mark
>      >
>      >       
>       ---------------------------------------------------------------------
>      >         To unsubscribe, e-mail:
>     users-unsubscribe@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>      >         <mailto:users-unsubscribe@tomcat.apache.org
>     <ma...@tomcat.apache.org>>
>      >         For additional commands, e-mail:
>     users-help@tomcat.apache.org <ma...@tomcat.apache.org>
>      >         <mailto:users-help@tomcat.apache.org
>     <ma...@tomcat.apache.org>>
>      >
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>     <ma...@tomcat.apache.org>
>     For additional commands, e-mail: users-help@tomcat.apache.org
>     <ma...@tomcat.apache.org>
> 

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


Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
Mark,

Thanks for the tip. I've resolved this error by using the way you suggested
along with the newer version of jdbc driver ojdbc8.jar and modified the
connection url in the right format.

However, I encountered another problem trying to run the application in
Eclipse with JDK 11. Please see below for the error message.
I didn't have any problem running the application with JDK 8.
Any suggestions?

[image: image.png]

Many thanks!
Jenny


On Mon, Jun 12, 2023 at 11:21 AM Mark Thomas <ma...@apache.org> wrote:

> On 12/06/2023 16:52, Ying Jin wrote:
> > BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib folder as
> > well as in the project's WEB-INF/lib folder.
>
> Don't do that. Put it *only* in $CATALINA_BASE/lib
>
>
> > On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     Mark,
> >
> >     Thanks for your reply! Please see below for the details. BTW, I
> >     removed the database connection info. for security reasons. The same
> >     data source configuration and jdbc driver "ojdbc6_g" works in the
> >     Weblogic 14 server.
> >
> >     web.xml:
> >        <resource-ref>
> >       <description>project datasource</description>
> >       <res-ref-name>jdbc/ariesDS</res-ref-name>
> >       <res-type>javax.sql.DataSource</res-type>
> >       <res-auth>Container</res-auth>
> >
> >     Tomcat 9.0.75 conf/context.xml:
>
> Putting it there means you have created one instance of the resource for
> each deployed web application. You probably want to put it in:
>
> $CATALINA_BASE/conf/<engine-name>/<host-name>/<context-name>.xml
>
> But maybe wait until you have it working before fixing that.
>
> >       <Resource auth="Container"
> >     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
> >     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS" password="PW"
> >     type="javax.sql.DataSource"
> >     url="jdbc:oracle:thin@hostname:portNumber/servic name"
> >     username="userName"/>
> >
> >     Datasource lookup code:
> >
> >         Context initContext = new InitialContext();
> >          Context envContext  =
> >     (Context)initContext.lookup("java:/comp/env");
> >          DataSource ods = (DataSource)envContext.lookup("jdbc/ariesDS");
> >         if (ods==null)
> >          {
> >             System.out.println("ods = (OracleDataSource)
> >     envCtx.lookup('jdbc/ariesDS') is null");
> >             throw new Exception ("the data souce is null, error
> throwed.");
> >          }else{
> >             conn = ods.getConnection();
> >          }
> >
> >     The database version is Oracle 19C and I found out the Oracle jdbc
> >     driver should be ojdbc8.jar. If using this version of jar file, any
> >     code changes need to be done for the data source lookup code?
>
> No. The lookup code should be fine.
>
> >     The complete stacktrace:
> >     image.png
>
> Embedded images don't work. Please paste the full stack trace and/or
> post it online somewhere we can read it.
>
> Mark
>
>
> >
> >     Your help is greatly appreciated!
> >
> >     Thanks,
> >     Jenny
> >
> >     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <markt@apache.org
> >     <ma...@apache.org>> wrote:
> >
> >         On 11/06/2023 19:33, Ying Jin wrote:
> >          > Hello,
> >          >
> >          > We have an old java servlet web application which uses the
> >         "ojdbc6_g" jar
> >          > as Oracle jdbc driver and it works in Weblogic 14 server.
> >         Recently, we need
> >          > to try to see if this application can be deployed to Tomcat
> >         or not.
> >          >
> >          > The JDBC data source has been configured in Tomcat 9.0.75
> >         server according
> >          > to instructions below,
> >          >
> >          >
> >
> https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html <
> https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html>
> >          >
> >          > Please see below for the error we encountered in the Tomcat 9
> >         deployment
> >          > and help shed some light on this problem. The Oracle database
> >         version is
> >          > 19c.
> >          >
> >          > Error: Cannot create JDBC driver of class
> >         'oracle.jdbc.OracleDriver' for
> >          > connect URL 'jdbc:oracle:thin@xxx
> >          >
> >          > java.sql.SQLException: Cannot create JDBC driver of class
> >          > 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
> >          >
> >         <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> >>
> >          > xxxx'
> >          > at
> >          >
> >
>  org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
> >          > at
> >          >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
> >          > at
> >          >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
> >          > at
> >          >
> >
>  org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
> >
> >         And the rest of the stack trace is?
> >
> >         ojdbc6_g.jar has been placed where in the file system?
> >
> >         That is a *very* old Oracle JDBC driver. It is also the debug
> >         version of
> >         the JAR. You might want to think about using the latest one for
> >         Oracle 19c.
> >
> >         The changes to the configuration are? (Yes, I know you said you
> >         followed
> >         the docs but we still need to know what you actually changed. Not
> >         everyone follows the docs correctly.)
> >
> >         Mark
> >
> >
>  ---------------------------------------------------------------------
> >         To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >         <ma...@tomcat.apache.org>
> >         For additional commands, e-mail: users-help@tomcat.apache.org
> >         <ma...@tomcat.apache.org>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat 9 data source configuration error

Posted by Mark Thomas <ma...@apache.org>.
On 12/06/2023 16:52, Ying Jin wrote:
> BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib folder as 
> well as in the project's WEB-INF/lib folder.

Don't do that. Put it *only* in $CATALINA_BASE/lib


> On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <jiny4clt@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     Mark,
> 
>     Thanks for your reply! Please see below for the details. BTW, I
>     removed the database connection info. for security reasons. The same
>     data source configuration and jdbc driver "ojdbc6_g" works in the
>     Weblogic 14 server.
> 
>     web.xml:
>        <resource-ref>
>       <description>project datasource</description>
>       <res-ref-name>jdbc/ariesDS</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
> 
>     Tomcat 9.0.75 conf/context.xml:

Putting it there means you have created one instance of the resource for 
each deployed web application. You probably want to put it in:

$CATALINA_BASE/conf/<engine-name>/<host-name>/<context-name>.xml

But maybe wait until you have it working before fixing that.

>       <Resource auth="Container"
>     driverClassName="oracle.jdbc.OracleDriver" maxIdle="10"
>     maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS" password="PW"
>     type="javax.sql.DataSource"
>     url="jdbc:oracle:thin@hostname:portNumber/servic name"
>     username="userName"/>
> 
>     Datasource lookup code:
> 
>         Context initContext = new InitialContext();
>          Context envContext  =
>     (Context)initContext.lookup("java:/comp/env");
>          DataSource ods = (DataSource)envContext.lookup("jdbc/ariesDS");
>         if (ods==null)
>          {
>             System.out.println("ods = (OracleDataSource)
>     envCtx.lookup('jdbc/ariesDS') is null");
>             throw new Exception ("the data souce is null, error throwed.");
>          }else{
>             conn = ods.getConnection();
>          }
> 
>     The database version is Oracle 19C and I found out the Oracle jdbc
>     driver should be ojdbc8.jar. If using this version of jar file, any
>     code changes need to be done for the data source lookup code?

No. The lookup code should be fine.

>     The complete stacktrace:
>     image.png

Embedded images don't work. Please paste the full stack trace and/or 
post it online somewhere we can read it.

Mark


> 
>     Your help is greatly appreciated!
> 
>     Thanks,
>     Jenny
> 
>     On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <markt@apache.org
>     <ma...@apache.org>> wrote:
> 
>         On 11/06/2023 19:33, Ying Jin wrote:
>          > Hello,
>          >
>          > We have an old java servlet web application which uses the
>         "ojdbc6_g" jar
>          > as Oracle jdbc driver and it works in Weblogic 14 server.
>         Recently, we need
>          > to try to see if this application can be deployed to Tomcat
>         or not.
>          >
>          > The JDBC data source has been configured in Tomcat 9.0.75
>         server according
>          > to instructions below,
>          >
>          >
>         https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html <https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html>
>          >
>          > Please see below for the error we encountered in the Tomcat 9
>         deployment
>          > and help shed some light on this problem. The Oracle database
>         version is
>          > 19c.
>          >
>          > Error: Cannot create JDBC driver of class
>         'oracle.jdbc.OracleDriver' for
>          > connect URL 'jdbc:oracle:thin@xxx
>          >
>          > java.sql.SQLException: Cannot create JDBC driver of class
>          > 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
>          >
>         <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>>
>          > xxxx'
>          > at
>          >
>         org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
>          > at
>          >
>         org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
>          > at
>          >
>         org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
>          > at
>          >
>         org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
> 
>         And the rest of the stack trace is?
> 
>         ojdbc6_g.jar has been placed where in the file system?
> 
>         That is a *very* old Oracle JDBC driver. It is also the debug
>         version of
>         the JAR. You might want to think about using the latest one for
>         Oracle 19c.
> 
>         The changes to the configuration are? (Yes, I know you said you
>         followed
>         the docs but we still need to know what you actually changed. Not
>         everyone follows the docs correctly.)
> 
>         Mark
> 
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>         <ma...@tomcat.apache.org>
>         For additional commands, e-mail: users-help@tomcat.apache.org
>         <ma...@tomcat.apache.org>
> 

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


Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
BTW, the ojdbc6_g.jar has been put in the Tomcat9.0.75/lib folder as well
as in the project's WEB-INF/lib folder.

On Mon, Jun 12, 2023 at 10:41 AM Ying Jin <ji...@gmail.com> wrote:

> Mark,
>
> Thanks for your reply! Please see below for the details. BTW, I removed
> the database connection info. for security reasons. The same data source
> configuration and jdbc driver "ojdbc6_g" works in the Weblogic 14 server.
>
> web.xml:
>   <resource-ref>
>  <description>project datasource</description>
>  <res-ref-name>jdbc/ariesDS</res-ref-name>
>  <res-type>javax.sql.DataSource</res-type>
>  <res-auth>Container</res-auth>
>
> Tomcat 9.0.75 conf/context.xml:
>
>  <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver"
> maxIdle="10" maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
> password="PW" type="javax.sql.DataSource" url="jdbc:oracle:thin@hostname:portNumber/servic
> name" username="userName"/>
>
> Datasource lookup code:
>
>    Context initContext = new InitialContext();
>     Context envContext  = (Context)initContext.lookup("java:/comp/env");
>     DataSource ods = (DataSource)envContext.lookup("jdbc/ariesDS");
>    if (ods==null)
>     {
>        System.out.println("ods = (OracleDataSource)
> envCtx.lookup('jdbc/ariesDS') is null");
>        throw new Exception ("the data souce is null, error throwed.");
>     }else{
>        conn = ods.getConnection();
>     }
>
> The database version is Oracle 19C and I found out the Oracle jdbc driver
> should be ojdbc8.jar. If using this version of jar file, any code changes
> need to be done for the data source lookup code?
>
> The complete stacktrace:
> [image: image.png]
>
> Your help is greatly appreciated!
>
> Thanks,
> Jenny
>
> On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <ma...@apache.org> wrote:
>
>> On 11/06/2023 19:33, Ying Jin wrote:
>> > Hello,
>> >
>> > We have an old java servlet web application which uses the "ojdbc6_g"
>> jar
>> > as Oracle jdbc driver and it works in Weblogic 14 server. Recently, we
>> need
>> > to try to see if this application can be deployed to Tomcat or not.
>> >
>> > The JDBC data source has been configured in Tomcat 9.0.75 server
>> according
>> > to instructions below,
>> >
>> > https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
>> >
>> > Please see below for the error we encountered in the Tomcat 9 deployment
>> > and help shed some light on this problem. The Oracle database version is
>> > 19c.
>> >
>> > Error: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for
>> > connect URL 'jdbc:oracle:thin@xxx
>> >
>> > java.sql.SQLException: Cannot create JDBC driver of class
>> > 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
>> > <
>> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
>> >
>> > xxxx'
>> > at
>> >
>> org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
>> > at
>> >
>> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
>> > at
>> >
>> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
>> > at
>> >
>> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
>>
>> And the rest of the stack trace is?
>>
>> ojdbc6_g.jar has been placed where in the file system?
>>
>> That is a *very* old Oracle JDBC driver. It is also the debug version of
>> the JAR. You might want to think about using the latest one for Oracle
>> 19c.
>>
>> The changes to the configuration are? (Yes, I know you said you followed
>> the docs but we still need to know what you actually changed. Not
>> everyone follows the docs correctly.)
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>

Re: Tomcat 9 data source configuration error

Posted by Ying Jin <ji...@gmail.com>.
Mark,

Thanks for your reply! Please see below for the details. BTW, I removed the
database connection info. for security reasons. The same data source
configuration and jdbc driver "ojdbc6_g" works in the Weblogic 14 server.

web.xml:
  <resource-ref>
 <description>project datasource</description>
 <res-ref-name>jdbc/ariesDS</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>

Tomcat 9.0.75 conf/context.xml:

 <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver"
maxIdle="10" maxTotal="20" maxWaitMillis="-1" name="jdbc/ariesDS"
password="PW" type="javax.sql.DataSource"
url="jdbc:oracle:thin@hostname:portNumber/servic
name" username="userName"/>

Datasource lookup code:

   Context initContext = new InitialContext();
    Context envContext  = (Context)initContext.lookup("java:/comp/env");
    DataSource ods = (DataSource)envContext.lookup("jdbc/ariesDS");
   if (ods==null)
    {
       System.out.println("ods = (OracleDataSource)
envCtx.lookup('jdbc/ariesDS') is null");
       throw new Exception ("the data souce is null, error throwed.");
    }else{
       conn = ods.getConnection();
    }

The database version is Oracle 19C and I found out the Oracle jdbc driver
should be ojdbc8.jar. If using this version of jar file, any code changes
need to be done for the data source lookup code?

The complete stacktrace:
[image: image.png]

Your help is greatly appreciated!

Thanks,
Jenny

On Mon, Jun 12, 2023 at 3:26 AM Mark Thomas <ma...@apache.org> wrote:

> On 11/06/2023 19:33, Ying Jin wrote:
> > Hello,
> >
> > We have an old java servlet web application which uses the "ojdbc6_g" jar
> > as Oracle jdbc driver and it works in Weblogic 14 server. Recently, we
> need
> > to try to see if this application can be deployed to Tomcat or not.
> >
> > The JDBC data source has been configured in Tomcat 9.0.75 server
> according
> > to instructions below,
> >
> > https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
> >
> > Please see below for the error we encountered in the Tomcat 9 deployment
> > and help shed some light on this problem. The Oracle database version is
> > 19c.
> >
> > Error: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for
> > connect URL 'jdbc:oracle:thin@xxx
> >
> > java.sql.SQLException: Cannot create JDBC driver of class
> > 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
> > <
> http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt
> >
> > xxxx'
> > at
> >
> org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
> > at
> >
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
> > at
> >
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
> > at
> >
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)
>
> And the rest of the stack trace is?
>
> ojdbc6_g.jar has been placed where in the file system?
>
> That is a *very* old Oracle JDBC driver. It is also the debug version of
> the JAR. You might want to think about using the latest one for Oracle 19c.
>
> The changes to the configuration are? (Yes, I know you said you followed
> the docs but we still need to know what you actually changed. Not
> everyone follows the docs correctly.)
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat 9 data source configuration error

Posted by Mark Thomas <ma...@apache.org>.
On 11/06/2023 19:33, Ying Jin wrote:
> Hello,
> 
> We have an old java servlet web application which uses the "ojdbc6_g" jar
> as Oracle jdbc driver and it works in Weblogic 14 server. Recently, we need
> to try to see if this application can be deployed to Tomcat or not.
> 
> The JDBC data source has been configured in Tomcat 9.0.75 server according
> to instructions below,
> 
> https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
> 
> Please see below for the error we encountered in the Tomcat 9 deployment
> and help shed some light on this problem. The Oracle database version is
> 19c.
> 
> Error: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for
> connect URL 'jdbc:oracle:thin@xxx
> 
> java.sql.SQLException: Cannot create JDBC driver of class
> 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin@
> <http://jdbc:oracle%3Athin@vdb04ld.hs.it.vumc.io:10920/ARDEV.vumc.vanderbilt>
> xxxx'
> at
> org.apache.tomcat.dbcp.dbcp2.DriverFactory.createDriver(DriverFactory.java:74)
> at
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:465)
> at
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:529)
> at
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:710)

And the rest of the stack trace is?

ojdbc6_g.jar has been placed where in the file system?

That is a *very* old Oracle JDBC driver. It is also the debug version of 
the JAR. You might want to think about using the latest one for Oracle 19c.

The changes to the configuration are? (Yes, I know you said you followed 
the docs but we still need to know what you actually changed. Not 
everyone follows the docs correctly.)

Mark

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