Results 1 to 3 of 3

Thread: Help: TypeMismatchException

  1. #1
    Join Date
    Aug 2004
    Posts
    8

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

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

    Spring Modules Team
    http://irbouh.blogspot.com/

  3. #3
    Join Date
    Aug 2004
    Posts
    8

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •