<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
destroy-method="close"
p:driverClass="oralce.jdbc.dirver.OracleDriver"
p:jdbcUrl="jdbc:oracle:thin:@localhost:1521:orcl"
p:user="system"
p:password="tiger"/>
严重: Context initialization failed
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 'driverClass' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'driverClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
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 'driverClass' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'driverClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

解决方案 »

  1.   

    看这句:Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClass' of bean class 
      

  2.   

    严重: Context initialization failed
    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 'driverClass' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'driverClass' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?这段好像是说创建名字为dataSource的bean失败了,原因好像是因为这个对象的driverClass属性不存在吧,你确认大小写和语法都没问题?
      

  3.   

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    destroy-method="close"
    p:driverClass="oralce.jdbc.dirver.OracleDriver"
    p:jdbcUrl="jdbc:oracle:thin:@localhost:1521:orcl"
    p:user="system"
    p:password="tiger"/>
      

  4.   

    不是driverClassName吗?.....还有userName?我很凌乱
      

  5.   

    这样配连接池起不了作用的,用dbcp或c3p0好点
      

  6.   

    p:driverClass="oralce.jdbc.dirver.OracleDriver"
    连接参数名在属性文件中是不是一一对应呢?
      

  7.   

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close"
    p:driverClass="oracle.jdbc.dirver.OracleDriver"
    p:jdbcUrl="jdbc:oracle:thin:@localhost:1521:orcl"
    p:user="system"
    p:password="tiger"/>警告: Could not load driverClass oracle.jdbc.dirver.OracleDriver
    java.lang.ClassNotFoundException: oracle.jdbc.dirver.OracleDriver