On 25.03.19 03:41, Hua, Gary - Saint Louis, MO - Contractor wrote:
> Hi experts:
> 
>                 After I deployed my application TOPS to Tomcat server(9.0.13) 
> on Linux box,  and started the server,  I got the following error:
> 
> 
> 1537 [main] FATAL connection.DatasourceConnectionProvider  - Could not find 
> datasource: java:/comp/env/jdbc/TOPSDB
> java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp2.BasicDataSource 
> cannot be cast to javax.sql.DataSource
>         at 
> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java>
> ...
> 
> I have tried to put different version of tomcat-dbcp.jar   like 
> tomcat-dbcp-7.0.47.jar/ tomcat-dbcp-8.0.23.jar/ tomcat-dbcp-9.0.13.jar  into 
> /opt/TomCat/apache-tomcat-9.0.13/lib, but not the same error occurred.

One way or another, the last sentence most likely is the most relevant
information, and key to solving your problem: Whenever a Java class
can't be typecast to its legitimate superclass or interface, this is a
clear sign that the superclass or interface can be found twice on the
classpath.

The error message only contains the class name, not the classloader, so
the root cause is effectively hidden. Make sure that
javax.sql.DataSource is nowhere to be found in your app's WEB-INF/lib,
and only once in tomcat's lib directory.

Olaf

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

Reply via email to