首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

org.apache.commons.dbcp.SQLNestedException,该怎么解决

2012-01-23 
org.apache.commons.dbcp.SQLNestedExceptionorg.apache.commons.dbcp.SQLNestedException: Cannot create

org.apache.commons.dbcp.SQLNestedException
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFact
ory (Io 异常: The Network Adapter could not establish the connection)
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:855)
  at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:540)
  at com.sbdcpn.pool.ConnectionPool.getConnection(Unknown Source:157)
  at com.sbdcpn.utils.db.BaseDAO.query(Unknown Source:472)
  at com.sbdcpn.utils.db.BaseDAO.query(Unknown Source:558)
  at com.sbdcpn.utils.system.FunUtil.<init>(Unknown Source:31)
  at com.sbdcpn.utils.system.FunUtil.<clinit>(Unknown Source:27)
  at com.sbdcpn.workflow.CheckFlowBean.<clinit>(Unknown Source:29)
  at com.sbdcpn.workflow.CheckFlowListener.<init>(Unknown Source:29)
  at com.sbdcpn.workflow.CheckFlowThread.<init>(Unknown Source:31)
  at com.sbdcpn.system.load.LoadCheckFlow.load(Unknown Source:35)
  at com.sbdcpn.servlet.init.AppInitServlet._$1(Unknown Source:111)
  at com.sbdcpn.servlet.init.AppInitServlet._$1(Unknown Source:65)
  at com.sbdcpn.servlet.init.AppInitServlet.init(Unknown Source:47)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1139)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:96
6)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3996)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
266)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)

  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)

  at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720
)
  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
)
  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)

  at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)

  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
  at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
  at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
  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:324)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establi
sh the connection
  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)


  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
  at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)

  at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:468)
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
  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)
  ... 39 more
[EAM2004] 2011-9-19 11:29:49 connection is null
[EAM2004] 2011-9-19 11:29:49 getEntityContent()...
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFact
ory (Io 异常: The Network Adapter could not establish the connection)
  at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:855)
  at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:540)
  at com.sbdcpn.pool.ConnectionPool.getConnection(Unknown Source:157)
  at com.sbdcpn.utils.db.BaseDAO.query(Unknown Source:625)
  at com.sbdcpn.utils.db.BaseDAO.query(Unknown Source:716)
  at com.sbdcpn.utils.db.EntitySourceImpl._$2(Unknown Source:102)
  at com.sbdcpn.utils.db.EntitySourceImpl.getEntity(Unknown Source:45)
  at com.sbdcpn.pool.EntityBeanPool.borrowEntityBean(Unknown Source:81)
  at com.sbdcpn.workflow.CheckFlowBean.<init>(Unknown Source:35)
  at com.sbdcpn.workflow.CheckFlowListener.<init>(Unknown Source:29)
  at com.sbdcpn.workflow.CheckFlowThread.<init>(Unknown Source:31)
  at com.sbdcpn.system.load.LoadCheckFlow.load(Unknown Source:35)
  at com.sbdcpn.servlet.init.AppInitServlet._$1(Unknown Source:111)
  at com.sbdcpn.servlet.init.AppInitServlet._$1(Unknown Source:65)
  at com.sbdcpn.servlet.init.AppInitServlet.init(Unknown Source:47)
  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1139)
  at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:96
6)
  at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3996)
  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
266)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)

  at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)

  at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720
)
  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
)
  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)

  at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)



  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
  at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
  at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
  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:324)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establi
sh the connection
  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
  at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
  at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)

  at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:468)
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
  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)
  ... 40 more
[EAM2004] 2011-9-19 11:29:50 connection is null.

[解决办法]
我想可能有几种原因造成
1.数据库的JDBC驱动没有放到tomcat的lib文件夹当中
2.数据库的用户名和密码不对
2.数据源配置的URL地址有问题
楼主查查
[解决办法]
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establi
sh the connection

1. 数据库配置错误,其中有可能是url中的IP或者端口错误
2.防火墙设置造成的错误。(可能是未设置启用端口)
3.Oracle的监听服务未开启

热点排行