On Thu, Mar 8, 2018 at 5:26 PM, Tarin Gamberini <taringamber...@gmail.com> wrote:
> Hi everybody, > > I have found a strange behavior on Tomcat 9.0.5 (originally on Tomcat > 8.5.28). > > > # PROBLEM > > I have two datasources in the same web application: > > <ResourceLink global="jdbc/abc/ABC" name="jdbc/abc" > type="javax.sql.DataSource"/> > <ResourceLink global="jdbc/abc/jkl/XXX_YYY" name="jdbc/abc/jkl" > type="javax.sql.DataSource"/> > > Starting the server I get an "java.lang.ClassCastException: > org.apache.tomcat.dbcp.dbcp2.BasicDataSource cannot be cast to > javax.naming.Context" ERROR. > Well, you have "abc" that s already bound and is a datasource, then you try to create a subcontext "abc" and it doesn't work. Try using better paths instead so that "abc" doesn't have to be both a subcontext and a datasource. Rémy