Announcement Announcement Module
Collapse
No announcement yet.
Cannot set property (this has to be a bug) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot set property (this has to be a bug)

    Hi.

    I didn't want to register this as bug in Jira before I post it here, but I'm pretty sure it is.

    I'm using C3P0 as database pool (com.mchange.v2.c3p0.ComboPooledDataSource), and trying to set it's maxStatementsPerConnection int property. Everything works fine with maxStatements property, but this one raises following exception:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxStatementsPerConnection' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'maxStatementsPerConnection' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.NotWritablePropertyException: Invalid property 'maxStatementsPerConnection' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'maxStatementsPerConnection' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:772)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:685)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:826)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:853)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:842)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:870)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:688)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:325)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:260)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:221)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:131)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:224)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:150)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
    	at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
    	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:324)
    	at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
    	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
    	at org.apache.commons.digester.Rule.end(Rule.java:276)
    	at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
    	at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
    	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    	at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
    	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    	at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
    	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    	at org.apache.commons.digester.Digester.parse(Digester.java:1567)
    	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:488)
    	at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
    	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:483)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:480)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • #2
    Oh yeah, just to inform that I use Spring 1.1.5 version.
    Just so none would be suspicious about how did I register this bean. Here is standard piece of applicationContext.xml does it:

    Code:
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="maxStatementsPerConnection">
    <value>20</value>
    </property>
    ....
    ...
    </bean>
    And as I said, if I use maxStatements instead of maxStatementsPerConnection, everything works fine.

    Comment


    • #3
      Older c3p0 versions had only maxStatements property. Check if the version you actually use is maybe older then you think it is.

      Comment


      • #4
        Thanx. Somehow, my IDE copied 2 different C3P0 jars in WEB-INF/lib, having taken older one as the one.

        Comment

        Working...
        X