Announcement Announcement Module
Collapse
No announcement yet.
Help: TypeMismatchException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help: TypeMismatchException

    I am new to SpringFramework. I tried to use c3p0 connection pool with my code. I can use the XmlBeanFactory to get the ComboPooledDataSource. However, I got TypeMismatchException when I tried to get productManager instance.

    Failed to convert property value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource']

    Any idea?

    Thanks.

    java9394

    Code:
    <beans>	
    	<bean id="productDS" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    		<property name="driverClass"><value>oracle.jdbc.OracleDriver</value></property>
    		<property name="jdbcUrl"><value>jdbc&#58;oracle&#58;thin&#58;correctURLforDB</value></property>
    		<property name="minPoolSize"><value>1</value></property>
    		<property name="acquireIncrement"><value>1</value></property>
    		<property name="maxPoolSize"><value>10</value></property>
    	</bean>
    	<bean id="productManager" class="com.mycom.ProductManagerDaoJdbc">
    		<property name="dataSource"><idref local="productDS"/></property>
    	</bean>
    </beans>

  • #2
    productManager definition should be
    Code:
    <bean id="productManager" class="com.mycom.ProductManagerDaoJdbc"> 
    <property name="dataSource"><ref local="productDS"/></property> 
    </bean>

    Comment


    • #3
      Thanks. It worked. So the idref is short hand and error-proof for <value/> only then

      Comment

      Working...
      X