站内搜索: 请输入搜索关键词

当前页面: 开发资料首页J2EE 专题No suitable driver,原来就是因为对配置文件进行自动排版了!

No suitable driver,原来就是因为对配置文件进行自动排版了!

摘要: No suitable driver,原来就是因为对配置文件进行自动排版了!


org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1560)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.gdnfha.atcs.common.service.dao.hibernate.GenericDaoHibernateImpl.executeFinder(GenericDaoHibernateImpl.java:73)
at com.gdnfha.atcs.common.service.dao.finder.FinderIntroductionInterceptor.invoke(FinderIntroductionInterceptor.java:22)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
at $Proxy2.getById(Unknown Source)
at com.gdnfha.atcs.maintain.service.dao.StaffDaoTest.testFind(StaffDaoTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL '
jdbc:sqlserver://localhost:1433;databaseName=atcs
', cause: No suitable driver
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:750)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 37 more
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
... 40 more

提示的是No suitable driver,问题是我的配置文件都没有改过,昨天晚上还是正常运行的...dataSource:
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">

com.microsoft.sqlserver.jdbc.SQLServerDriver



jdbc:sqlserver://localhost:1433;databaseName=atcs



atcs


123456



我的数据库是SQL Server 2005,已经把sqljdbc.jar放到编译路径和CLASSPATH里了...
调了一个下午还是这个问题,谁能帮帮忙啊!!


没见过,但确定一定是低级错误。呵呵
检查一下sql server是不是正确运行,或者再检查一下驱动


SQL Server 2005正常运行,驱动我把原来的包删了重新加进行也不行...
而且这个应该跟数据库运行没关吧?他在加载Driver时就不行了....怎么会突然就有问题的呢??





Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL '
jdbc:sqlserver://localhost:1433;databaseName=atcs
', cause: No suitable driver

你的databaseName=atcs重新起一个属性项试试:


jdbc:sqlserver://localhost:1433


atcs



我也遇到过这个问题,好好的程序突然就不能连接了,后来自己就又好了.可能是你的机器的问题把.你设了tomcat系统启动吗?重新启动一下看看



你的databaseName=atcs重新起一个属性项试试:


jdbc:sqlserver://localhost:1433


atcs


-----------------------
不行,没这个属性,现在是把包重新加了不行,dataSource也检查了好多遍了,这样的问题有可能是什么引起的??


up,还是不行


RPWT
或许明天就好了(*^_^*)


你的SQL Server2005的JDBC驱动包你放在哪里了?在ClassPath了吗?


在ClASSPATH里面,上面的配置应该也没错,我那天晚上还全部都能跑起来...现在就是不行了...在Eclipse的buildpath里面也把库删掉重加了..不知道还能有什么方法...


解决了,原来就是因为对配置文件进行自动排版了!


↑返回目录
前一篇: 为什么会是FALSE呢?
后一篇: access数据库的名称改过了,和项目名称是一样的,然后就可以了