各位,我想在一个web项目里面用ibatis连接数据库,但是一直报 四月 15, 2013 7:46:14 下午 com.ibatis.common.logging.jdk14.Jdk14LoggingImpl error SEVERE: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:186) at com.ibatis.common.resources.Resources.classForName(Resources.java:267) at com.ibatis.common.resources.Resources.instantiate(Resources.java:283) at com.ibatis.common.jdbc.SimpleDataSource.initialize(SimpleDataSource.java:199) at com.ibatis.common.jdbc.SimpleDataSource.<init>(SimpleDataSource.java:116) at com.ibatis.sqlmap.engine.datasource.SimpleDataSourceFactory.initialize(SimpleDataSourceFactory.java:31) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:220) at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46) at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63) at com.sis.common.getSqlMapClient.getSqlMapClients(getSqlMapClient.java:18) at com.sis.common.LoginServlet.doGet(LoginServlet.java:26) at com.sis.common.LoginServlet.doPost(LoginServlet.java:47) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675) at java.lang.Thread.run(Thread.java:722) 这个错,可是我用jdbc是可以连上数据库的?但是ibatis就一直找不到驱动程序!请问驱动程序的jar包应该放在哪个地方?我放在项目的lib以及tomcat的lib都不行 而且奇怪的是,我把驱动程序的jar包都删掉之后,还是可以用jdbc连数据库(缓存我也清了),这到底怎么回事,真心求教 |
|
#1 |
没有人回答?我要顶上去
|
#2 |
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver 肯定是找不到驱动的jar包,jdbc的jar包对于tomcat的工程来说,我通常都放到具体工程的web_info的lib里面。
|
#340分 |
还要确认下异常中提到的这个类,你的jar文件里是否真的存在这个类。连接数据库的字符串写的是否一致?
|
#4 |
我也遇到这个问题,楼主你是怎么解决的呢
|
#5 |
查看你SqlMap.properties配置文件驱动属性后是否有空格
|