首页新闻找找看学习计划

Tomcat启动报错,提示为数据库连接问题

0
悬赏园豆:10 [已解决问题] 解决于 2014-12-29 10:04

2014-12-19 16:16:22 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performanc
e in production environments was not found on the java.library.path: C:\Program
Files\Java\jdk1.6.0_45\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Window
s;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program Files\Java\jdk1.6.0_45\jre\bi
n;C:\app\vVolF\product\11.2.0\client_1\bin;C:\Windows\system32;C:\Windows;C:\Win
dows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;;.
2014-12-19 16:16:22 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2014-12-19 16:16:22 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 356 ms
2014-12-19 16:16:22 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2014-12-19 16:16:22 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.29
2014-12-19 16:16:22 org.apache.catalina.startup.HostConfig deployWAR
信息: Deploying web application archive filemng.war
Init SetCacheAndCharacterFilter....
load default ObjFactory config file:cfg/objFactory.xml
load ObjFactory cfg file from [file:/D:/tomcat/webapps/filemng/WEB-INF/classes/c
fg/objFactory.xml]
DBTableOpperImpl.setSelfCtrlTrans NOOP
DBOperImpl.setSelfCtrlTrans NOOP
2014-12-19 16:19:32 [main]-[com.fire.alias.framework.web.action.ContextLoaderPlu
gin]-[ERROR] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'paramService' defined in ServletContext resource [/WEB-INF/applicationCo
ntextWeb.xml]: Invocation of init method failed; nested exception is com.syit.db
operate.DBException: Cannot create PoolableConnectionFactory (Listener refused t
he connection with the following error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
58.240.29.37:9004:orcl
);can't get connection:java:comp/env/jdbc/filemng
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:464)
at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicati
onContext(ContextLoaderPlugIn.java:356)
at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplication
Context(ContextLoaderPlugIn.java:297)
at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoader
PlugIn.java:227)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:99
3)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:4350)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
659)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

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

at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740
)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445
)
at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.syit.dboperate.DBException: Cannot create PoolableConnectionFacto
ry (Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
58.240.29.37:9004:orcl
);can't get connection:java:comp/env/jdbc/filemng
at com.syit.dboperate.GetConnectionImpl.newConnection(GetConnectionImpl.
java:62)
at com.syit.dboperate.AbstractGetConnection.getConnection(AbstractGetCon
nection.java:133)
at com.syit.dboperate.dbtable.DBTableOperImpl.getTableObjectByPreSQL(DBT
ableOperImpl.java:846)
at com.syit.dboperate.dbtable.DBTableOperImpl.getTableObjectByPreSQL(DBT
ableOperImpl.java:808)
at com.fire.alias.biz.dao.impl.ParamDaoImpl.getAllParamList(ParamDaoImpl
.java:51)
at com.fire.alias.biz.service.impl.ParamServiceImpl.loadAllParam(ParamSe
rviceImpl.java:122)
at com.fire.alias.biz.service.impl.ParamServiceImpl.loadParams(ParamServ
iceImpl.java:290)
at com.fire.alias.biz.service.impl.ParamServiceImpl.afterPropertiesSet(P
aramServiceImpl.java:312)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 41 more
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create Poolabl
eConnectionFactory (Listener refused the connection with the following error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
58.240.29.37:9004:orcl
)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionF
actory(BasicDataSource.java:1549)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDat
aSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSo
urce.java:1044)
at com.syit.dboperate.GetConnectionImpl.newConnection(GetConnectionImpl.
java:59)
... 50 more
Caused by: java.sql.SQLException: Listener refused the connection with the follo
wing error:
ORA-12518, TNS:listener could not hand off client connection
The Connection descriptor used by the client was:
58.240.29.37:9004:orcl

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
438)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(
DriverConnectionFactory.java:38)
at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(Pool
ableConnectionFactory.java:582)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory
(BasicDataSource.java:1556)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionF
actory(BasicDataSource.java:1545)
... 53 more
2014-12-19 16:19:32 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2014-12-19 16:19:33 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2014-12-19 16:19:33 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/72 config=null
2014-12-19 16:19:33 org.apache.catalina.startup.Catalina start
信息: Server startup in 190711 ms

 

用PLSql连接数据库正常, Sqlplus连接也没问题, 数据库连接个数也未到上限, 为何会出现这个错误呢? 

vVolF的主页 vVolF | 初学一级 | 园豆:193
提问于:2014-12-19 16:52
< >
分享
最佳答案
0

配置连接池错误吧

收获园豆:4
狂奔的程序猿 | 菜鸟二级 |园豆:244 | 2014-12-19 18:53

配置是正常的,前几天都无错误,今天突然出现的

vVolF | 园豆:193 (初学一级) | 2014-12-19 19:24

@vVolF: 

把<Resource url="jdbc:oracle:thin:@58.240.29.37:9004:orcl"  的 url中@后替换为oracle tnsnames.ora中的链接地址试试

狂奔的程序猿 | 园豆:244 (菜鸟二级) | 2014-12-19 21:47

@常志辰: 问题已基本定位清楚,是数据连接被占满导致。重启Oracle后正常,但是为什么PLSql连接正常这个原因还未找到。

vVolF | 园豆:193 (初学一级) | 2014-12-19 22:57

@vVolF: 是否有连接未关闭,如session、sessionfactory

狂奔的程序猿 | 园豆:244 (菜鸟二级) | 2014-12-22 12:01

@常志辰:  感谢各位的回复,问题已解决,原因有2个,1: Oracle未配置自动释放长期不使用的链接, 2: 垃圾外包公司做的东西在出现异常时链接未关闭。 

vVolF | 园豆:193 (初学一级) | 2014-12-29 10:04
其他回答(2)
0

at com.syit.dboperate.GetConnectionImpl.newConnection(GetConnectionImpl.
java:62)

at com.syit.dboperate.GetConnectionImpl.newConnection(GetConnectionImpl.
java:59)

 

你看下,好几个地方提示这个。

收获园豆:3
xya_zone | 园豆:220 (菜鸟二级) | 2014-12-19 17:04
0

连接Oracle数据地址是不是写的有问题,tomcat中配置数据库连接地址 url="jdbc:oracle:thin:@58.240.29.37:9004:orcl" ,你看对不对?

收获园豆:3
心是透明的 | 园豆:205 (菜鸟二级) | 2014-12-19 17:28

<Resource url="jdbc:oracle:thin:@58.240.29.37:9004:orcl" type="javax.sql.DataSource" username="xxxx" password="xxxx" name="jdbc/filemng" maxWait="5000" maxIdle="5" maxActive="20" driverClassName="oracle.jdbc.driver.OracleDriver" auth="Container"/>

配置文件里应该是正常的, 程序所有东西都没更改过,之前一切正常, 今天就突然挂了

支持(0) 反对(0) vVolF | 园豆:193 (初学一级) | 2014-12-19 19:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册