当前位置: 代码迷 >> Java Web开发 >> struts连接池有关问题,帮忙看一下
  详细解决方案

struts连接池有关问题,帮忙看一下

热度:51   发布时间:2016-04-17 12:46:03.0
struts连接池问题,帮忙看一下!
启动TOMCAT时,产生下面问题:
严重: Initializing application data source strutsDB
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFact
ory ([Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.)
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:855)
  at org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.
java:598)
  at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionSe
rvlet.java:808)
  at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
  at javax.servlet.GenericServlet.init(GenericServlet.java:211)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1029)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:86
2)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4013)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
357)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

  at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478
)
  at org.apache.catalina.core.StandardService.start(StandardService.java:4
80)
  at org.apache.catalina.core.StandardServer.start(StandardServer.java:231
3)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Err
or establishing socket.
  at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
  at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
  at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
  at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)

  at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Sou
rce)
  at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown S
ource)
  at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
  at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
  at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(Driv
erConnectionFactory.java:37)
  at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(Poolable
ConnectionFactory.java:290)
  at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(Bas
icDataSource.java:877)
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:851)
  ... 21 more
struts-config.xml配置:
<data-sources >
  <data-source type="org.apache.commons.dbcp.BasicDataSource" key = "strutsDB">
<set-property property="driverClassName" value = "com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<set-property property="url" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=my"/>
  相关解决方案