java项目tomcat启动报错

k111111 发布于 2015/06/02 14:43
阅读 1K+
收藏 0

启动tomcat是报下面的错误。求大手指点。前天还好好的忽然就报错。


2015-6-2 12:59:27 org.apache.catalina.core.StandardContext listenerStart

严重: Exception sending context initialized event to listener instance of class com.nantian.ofpiwap.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultSequence' defined in class path resource [conf/iwapcore.spring.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
at org.springframework.jdbc.core.support.JdbcDaoSupport.getConnection(JdbcDaoSupport.java:130)
at com.nantian.ofpiwap.srv.no.SequenceDao.getAllNo(SequenceDao.java:58)
at com.nantian.ofpiwap.srv.no.SequenceDao$$FastClassByCGLIB$$edfd5951.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:623)
at com.nantian.ofpiwap.srv.no.SequenceDao$$EnhancerByCGLIB$$540b37a7.getAllNo(<generated>)
at com.nantian.ofpiwap.srv.no.DefaultSequence.afterPropertiesSet(DefaultSequence.java:70)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:247)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:796)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:592)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:349)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at com.nantian.ofpiwap.BeanDefAwareApplicationContext.<init>(BeanDefAwareApplicationContext.java:21)
at com.nantian.ofpiwap.IWapContext.init(IWapContext.java:317)
at com.nantian.ofpiwap.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:30)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4172)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4671)
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:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:254)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.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(PoolableConnectionFactory.java:582)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
... 42 more
2015-6-2 12:59:27 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2015-6-2 12:59:27 org.apache.catalina.core.StandardContext start
严重: Context [/sx] startup failed due to previous errors
2015-6-2 12:59:27 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
警告: JDBC driver de-registration failed for web application [/sx]
java.lang.reflect.InvocationTargetException
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:597)
at org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc(WebappClassLoader.java:1962)
at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1882)
at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1800)
at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:738)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4880)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4716)
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:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
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:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.olap4j.driver.xmla.XmlaOlap4jDriver
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at java.sql.DriverManager.getCallerClass(DriverManager.java:477)
at java.sql.DriverManager.getDrivers(DriverManager.java:373)
at org.apache.catalina.loader.JdbcLeakPrevention.clearJdbcDriverRegistrations(JdbcLeakPrevention.java:55)
... 23 more
加载中
0
顺其自然001
顺其自然001
你不是数据库服务没启动吧?还是配置文件变了?
0
k
k111111
数据库服务启动了,配置文件也没改!就是之前能够跑休息俩天忽然就不能了。
0
指尖的舞者
指尖的舞者
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
k
k111111
这是什么原因呢?怎么解决呢?大哥给解答一下吧!一天了快愁死我了
0
Adairs
Adairs

Error creating bean with name 'DefaultSequence' defined in class path resource [conf/iwapcore.spring.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection) 

给出的错误说明,也是比较明白了,conf/iwapcore.spring.xml文件中,定义的DefaultSequence的bean不能创建,不能创建的原因是:org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; 不能得到jdbc连接异常。


查看一下数据库连接部分,参数配置(看看直接连接是否能连接数据库),lib包,如果使用连接池,那么需要查看连接池的包

k
k111111
回复 @Adairs : 好的,我试试吧!谢谢大哥!
Adairs
Adairs
回复 @k111111 : 你使用了jndi的话,你的容器就要配置连接池啊,你可以先不使用jndi试试
k
k111111
写了个测试类也能连上数据库,就是跑这个项目时就报错
k
k111111
jdbc.username=ficbusi jdbc.password=ficbusi jdbc.dialect=org.hibernate.dialect.Oracle10gDialect
k
k111111
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver jdbc.url=jdbc:oracle:thin:@127.0.0.1 :1521:FIC60 jdbc.jndiName=java:comp/env/FIC
下一页
0
alexgaoyh
alexgaoyh

java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection


不能创建链接···看一下是不是数据库资源使用之后没有释放,连接池用完了·

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部