`

Tomcat启动时报错:Could not load com.microsoft.sqlserver.jdbc.SQLServerResource

阅读更多

Tomcat不添加项目时没问题,添加项目后有问题,报错如下:

Illegal access: this web application instance has been stopped already.  Could not load com.microsoft.sqlserver.jdbc.SQLServerResource_zh.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1777)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
	at java.util.ResourceBundle$Control.newBundle(Unknown Source)
	at java.util.ResourceBundle.loadBundle(Unknown Source)
	at java.util.ResourceBundle.findBundle(Unknown Source)
	at java.util.ResourceBundle.findBundle(Unknown Source)
	at java.util.ResourceBundle.getBundleImpl(Unknown Source)
	at java.util.ResourceBundle.getBundle(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerException.getErrString(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
	at com.mchange.v2.async.ThreadPerTaskAsynchronousRunner$TaskThread.run(ThreadPerTaskAsynchronousRunner.java:255)

看提示说的好像是没有加载SQLServerResource_zh.properties文件,可是这个文件我所有的项目里都没有,而别的项目都运行好好的。跟这个文件没关系,跟SQL Server数据库应该没关系。

 

于是开了SQL Server Management Studio,用.登陆了数据库引擎没问题再试试"127.0.0.1"和本地的IP地址,均报同样的错误

连接到服务器报错:
无法连接到127.0.0.1.
其他信息:
在与SQL Server建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且SQL Server已配置为允许远程连接。(privider:命名管道提供程序,error:40-无法打开到SQL Server的连接)(Microsoft SQL Server,错误:5)

至此,前面的异常应该就知道问题所在了(数据库连接用的127.0.0.1):只要解决了这个问题,异常问题迎刃而解。

解决办法很简单:

打开SQL Server Configuration Manager,找到左侧的配置管理器,逐个点开,只要有“协议”的(如客户端协议、MSSQLSERVER协议),除了VIA属性禁用外,其他的属性都启用,如此之后重启SQL Server的各项服务,再去Studio种测试,就能访问了。Tomcat重新启动,项目也能访问了。

 

至此,问题解决。

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics