java.lang.IllegalStateException:Failed to load ApplicationContext (2)

Source: Internet
Author: User

Error message:
java.lang.IllegalStateException:Failed to load ApplicationContext

caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' dataSource ' defined In class path resource [Applicationcontext.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Jdbcurl ' of Bean class [ Org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property ' Jdbcurl ' are not writable or have an invalid s Etter method. Does the parameter type of the setter match the return type of the getter?

caused By:org.springframework.beans.NotWritablePropertyException:Invalid property ' Jdbcurl ' of Bean class [ Org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property ' Jdbcurl ' are not writable or have an invalid s Etter method. Does the parameter type of the setter match the return type of the getter?

Spring built-in data source configuration :

<!--introduce external property profiles--
<context:property-placeholder location= "Classpath:db.properties"/>

<!--Configure the built-in data source bean, using db.properties--
<bean id= "DataSource" class= "Org.springframework.jdbc.datasource.DriverManagerDataSource" >
<property name= "Driverclassname" value= "${jdbc.driverclass}"/>
<property name= "url" value= "${jdbc.url}"/>
<property name= "username" value= "${jdbc.username}"/>
<property name= "Password" value= "${jdbc.password}"/>
</bean>

C3P0 Connection Pool configuration:

<!--c3p0 data source, using db.properties--
<bean id= "DataSource" class= "Com.mchange.v2.c3p0.ComboPooledDataSource" >
<property name= "Driverclass" value= "${jdbc.driverclass}"/>
<property name= "Jdbcurl" value= "${jdbc.url}"/>
<property name= "user" value= "${jdbc.username}"/>
<property name= "Password" value= "${jdbc.password}"/>
</bean>

Error Reason: Note the name attribute in the property name.

java.lang.IllegalStateException:Failed to load ApplicationContext (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.