Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.NoSuchMethodException: com.mchange.v2.c3p0.PoolBackedDataSource.setUserOverridesAsString(java.lang.String)
    text
    copied!<p>I'm using C3P0 0.9.1.2 to configure data sources for my connection pool.</p> <p>When context is loading an error is raised. Here is the trace:</p> <pre><code>java.lang.NoSuchMethodException: com.mchange.v2.c3p0.PoolBackedDataSource.setUserOverridesAsString(java.lang.String) at java.lang.Class.getMethod(Class.java:1605) at com.mchange.v2.c3p0.cfg.C3P0Config.bindNamedConfigToBean(C3P0Config.java:215) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.initializeNamedConfig(AbstractPoolBackedDataSource.java:89) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.&lt;init&gt;(AbstractPoolBackedDataSource.java:69) at com.mchange.v2.c3p0.PoolBackedDataSource.&lt;init&gt;(PoolBackedDataSource.java:37) at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:267) at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881) at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:197) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:172) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:158) at com.myApp.backoffice.model.CreateSchema.main(CreateSchema.java:8) java.lang.NoSuchMethodException: com.mchange.v2.c3p0.PoolBackedDataSource.setUserOverridesAsString(java.lang.String) at java.lang.Class.getMethod(Class.java:1605) at com.mchange.v2.c3p0.cfg.C3P0Config.bindNamedConfigToBean(C3P0Config.java:215) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.initializeNamedConfig(AbstractPoolBackedDataSource.java:89) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.&lt;init&gt;(AbstractPoolBackedDataSource.java:69) at com.mchange.v2.c3p0.PoolBackedDataSource.&lt;init&gt;(PoolBackedDataSource.java:37) at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:267) at com.mchange.v2.c3p0.DataSources.pooledDataSource(DataSources.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:197) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:172) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:158) at com.myApp.backoffice.model.CreateSchema.main(CreateSchema.java:8) Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaCreator' defined in class path resource [CreateSchema.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] for property 'sessionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] for property 'sessionFactory': no matching editors or conversion strategy found at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:197) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:172) at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:158) at com.myApp.backoffice.model.CreateSchema.main(CreateSchema.java:8) Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] for property 'sessionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] for property 'sessionFactory': no matching editors or conversion strategy found at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1288) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1249) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) ... 15 more Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.hibernate.impl.SessionFactoryImpl] to required type [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] for property 'sessionFactory': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386) ... 19 more </code></pre> <p>I have googled this issue but I have found nothing. Any idea? Anybody know if there is any bug in c3p0? </p> <p>&lt;&lt; added on december 10 >> Here are most relevant parts of my Spring XML configuration file:</p> <pre><code>&lt;!-- Driver Register --&gt; &lt;bean id="systemProperties" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"&gt; &lt;property name="targetClass"&gt; &lt;value&gt;java.lang.System&lt;/value&gt; &lt;/property&gt; &lt;property name="targetMethod"&gt; &lt;value&gt;setProperty&lt;/value&gt; &lt;/property&gt; &lt;property name="arguments"&gt; &lt;list&gt; &lt;value&gt;jdbc.drivers&lt;/value&gt; &lt;value&gt;${jdbc.driverClassName}&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="unpooledRODataSource" class="com.mchange.v2.c3p0.DataSources" factory-method="unpooledDataSource"&gt; &lt;constructor-arg value="${jdbc.ro.url}"/&gt; &lt;constructor-arg value="${jdbc.ro.username}"/&gt; &lt;constructor-arg value="${jdbc.ro.password}"/&gt; &lt;/bean&gt; &lt;bean id="unpooledRWDataSource" class="com.mchange.v2.c3p0.DataSources" factory-method="unpooledDataSource"&gt; &lt;constructor-arg value="${jdbc.rw.url}"/&gt; &lt;constructor-arg value="${jdbc.rw.username}"/&gt; &lt;constructor-arg value="${jdbc.rw.password}"/&gt; &lt;/bean&gt; &lt;bean id="pooledRODataSource" class="com.mchange.v2.c3p0.DataSources" factory-method="pooledDataSource"&gt; &lt;constructor-arg ref="unpooledRODataSource"/&gt; &lt;constructor-arg value="readonly"/&gt; &lt;/bean&gt; &lt;bean id="pooledRWDataSource" class="com.mchange.v2.c3p0.DataSources" factory-method="pooledDataSource"&gt; &lt;constructor-arg ref="unpooledRWDataSource"/&gt; &lt;constructor-arg value="readwrite"/&gt; &lt;/bean&gt; &lt;alias name="pooledRWDataSource" alias="dataSource"/&gt; &lt;alias name="pooledRODataSource" alias="alternativeDataSource"/&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;!-- values from properties file --&gt; &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt; &lt;prop key="hibernate.format_sql"&gt;${hibernate.format_sql}&lt;/prop&gt; &lt;prop key="hibernate.use_sql_comments"&gt;${hibernate.use_sql_comments}&lt;/prop&gt; &lt;prop key="hibernate.generate_statistics"&gt;${hibernate.generate_statistics}&lt;/prop&gt; &lt;prop key="hibernate.jdbc.batch_size"&gt;${hibernate.jdbc.batch_size}&lt;/prop&gt; &lt;prop key="hibernate.max_fetch_depth"&gt;${hibernate.max_fetch_depth}&lt;/prop&gt; &lt;prop key="hibernate.validator.apply_to_ddl"&gt;${hibernate.validator.apply_to_ddl}&lt;/prop&gt; &lt;prop key="hibernate.validator.autoregister_listeners"&gt;${hibernate.validator.autoregister_listeners}&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;!-- using classpath scanning for autodetection of entity classes (when &gt;= spring 2.5.6) --&gt; &lt;property name="packagesToScan"&gt; &lt;list&gt; &lt;value&gt;com/myApp/backoffice/model/*/dto/&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="eventListeners"&gt; &lt;map&gt; &lt;entry key="merge"&gt; &lt;bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/&gt; &lt;/entry&gt; &lt;/map&gt; &lt;/property&gt; &lt;property name="entityInterceptor" ref="backofficeInterceptor"/&gt; &lt;/bean&gt; &lt;!-- Transaction manager --&gt; &lt;bean id="transactionManager" class="com.myApp.persistence.tx.impl.TransactionManagerImpl"&gt; &lt;property name="timeoutDelayInMillis" value="${session.timeout}"/&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; &lt;!-- Transactional interceptor --&gt; &lt;bean id="transactionalInterceptor" class="com.myApp.persistence.tx.impl.TransactionalInterceptor"&gt; &lt;property name="transactionManager" ref="transactionManager" /&gt; &lt;/bean&gt; &lt;!-- Assign Transactional interceptor to @Transactional methods --&gt; &lt;bean class="com.myApp.persistence.tx.TransactionalAutoProxyCreator"&gt; &lt;property name="transactionalInterceptor" ref="transactionalInterceptor" /&gt; &lt;/bean&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload