读书人

java联接oracles数据库报错求解

发布时间: 2013-09-11 17:27:29 作者: rapoo

java连接oracles数据库报错,求解
<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?

[最优解释]
最后一个是报找不到这个驱动,那么是不是没有引入必要开发包?
[其他解释]
这样配连接池起不了作用的,用dbcp或c3p0好点

[其他解释]
p:driverClass="oralce.jdbc.dirver.OracleDriver"
连接参数名在属性文件中是不是一一对应呢?
[其他解释]
不是driverClassName吗?.....还有userName?我很凌乱
[其他解释]
看这句:Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClass' of bean class
[其他解释]
严重: 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属性不存在吧,你确认大小写和语法都没问题?
[其他解释]
<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"/>
[其他解释]
是对应的,现在不考虑连接池的问题。
[其他解释]
<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

读书人网 >J2EE开发

热点推荐