4

I have upgraded Tomcat from 7 to 9. I am getting exception while start up. It is throwing below exception:

oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver

context.xml has following :

<Resource auth="Container" driverClassName="oracle.jdbc.xa.client.OracleXADataSource" 
        logAbandoned="true" initialSize="1" maxActive="2" maxIdle="2" 
        minIdle="2" timeBetweenEvictionRunsMillis="34000" 
        inEvictableIdleTimeMillis="55000" validationQuery="SELECT 1 FROM DUAL" 
        validationInterval="34" testOnBorrow="true" removeAbandoned="true" 
        removeAbandonedTimeout="600" name="jdbc/regionalDS" password="XXX" 
        type="javax.sql.DataSource" url="jdbc:oracle:thin:@HOSTURL" 
        username="XXX" /> 

Please let me know, what changes I need to do.

Neha Shettar
  • 703
  • 10
  • 28
  • I am still getting Caused by: javax.naming.NameNotFoundException: Name [jdbc/regionalDS] is not bound in this Context. Unable to find [jdbc]. All configuration I have verified. – Neha Shettar May 02 '20 at 05:36

1 Answers1

2

Two things you can try :
1. Change the type to type="javax.sql.XADataSource"
2. Check that the url is in the form of url="jdbc:oracle:thin:@your_host_name:port_say_1521:service_or_sid"

souser
  • 5,868
  • 5
  • 35
  • 50
  • I have changed 1 as suggested. I am now getting this exception: Caused by: javax.naming.NameNotFoundException: Name [jdbc/regionalDS] is not bound in this Context. Unable to find [jdbc]. – Neha Shettar Apr 27 '20 at 10:59
  • Glad it fixed the original issue you posted. – souser Apr 27 '20 at 15:45
  • For the second issue, take a look at this one : https://stackoverflow.com/questions/22545169/name-jdbc-mydb-is-not-bound-in-this-context – souser Apr 27 '20 at 22:17