Search code examples
javaspring-mvctomcatdatasourceapplicationcontext

Conversion Exception for BasicDataSource


In trying to create a demo Spring-MVC application, I'm running into an issue on startup:

ConversionNotSupportedException: Failed to convert property value of type org.apache.commons.dbcp.BasicDataSource to required type org.apache.tomcat.dbcp.dbcp2.BasicDataSource for property dataSource; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.commons.dbcp.BasicDataSource] to required type [org.apache.tomcat.dbcp.dbcp2.BasicDataSource] for property dataSource: no matching editors or conversion strategy found

My question is, why does Tomcat think it needs to convert the BasicDataSource when it's defined in the applicationContext.xml file as

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

I can't see where it's getting that from...


Solution

  • I took the Captain-Kirk approach to solving this problem: I changed the parameters of the situation. Instead of trying to figure out why my new demo application, I copied an existing app then slowly changed and deleted things so that I got to my demo application. A more laborious approach, for sure, but I achieved my results ultimately...