kubo2088
2008-09-24 11:24
浏览 277
已采纳

spring+ibatis配置问题

<bean id="ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">


oracle.jdbc.driver.OracleDriver


jdbc:oracle:thin:@localhost:1521:yssf


sa


sa




   <property name="configLocation">
   <value>WEB-INF/sql-map-config.xml</value>
   </property>

   </bean>

报错如下:
javax.servlet.ServletException: Error creating bean with name 'sqlMapClient' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSource' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'dataSource' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
期待高手解决下。

[b]问题补充:[/b]
还是不行啊,Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMapConfig", must match DOCTYPE root "null".

[b]问题补充:[/b]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">



User.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">








resultMap="result">
select * from user where username=#name#

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

5条回答 默认 最新

相关推荐 更多相似问题