一、异常描述
最近无法登录连接oracle数据库,代码连接报"org.hibernate.exception.GenericJDBCException: Cannot open connection..ORA-12528, TNS:listener: all appropriate instances are blocking new connections"错误异常,详情日志如下
2479 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader – Context initialization failed@b@org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'publishExecutors' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Cannot resolve reference to bean 'publishRunnable' while setting bean property 'publishRunnable'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'publishRunnable' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Cannot resolve reference to bean 'filePublisher' while setting bean property 'filePublisher'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filePublisher' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOms' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xwood.pms.util.publisher.FtpOms]: Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'publishRunnable' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Cannot resolve reference to bean 'filePublisher' while setting bean property 'filePublisher'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filePublisher' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOms' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xwood.pms.util.publisher.FtpOms]: Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filePublisher' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOms' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xwood.pms.util.publisher.FtpOms]: Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ftpOms' defined in ServletContext resource [/WEB-INF/config/application-publish.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xwood.pms.util.publisher.FtpOms]: Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xwood.pms.util.publisher.FtpOms]: Constructor threw exception; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection@b@Caused by: @b@org.hibernate.exception.GenericJDBCException: Cannot open connection@b@ at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)@b@ at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)@b@ at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)@b@ at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)@b@ at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)@b@ at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)@b@ at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)@b@ at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)@b@ at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1327)@b@ at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:510)@b@ at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)@b@ at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)@b@ at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)@b@ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@ at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)@b@ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)@b@ at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)@b@ at com.xwood.pms.dao.impl.FtpServerDao$$EnhancerByCGLIB$$8398d933.find(<generated>)@b@ at com.xwood.pms.service.impl.FtpServerServer.findFtps(FtpServerServer.java:123)@b@ at com.xwood.pms.service.impl.FtpServerServer.findAndSetFtps(FtpServerServer.java:154)@b@ at com.xwood.pms.util.publisher.FtpOms.<init>(FtpOms.java:52)@b@ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)@b@ at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)@b@ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)@b@ at java.lang.reflect.Constructor.newInstance(Constructor.java:526)@b@ at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85)@b@ at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)@b@ at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:187)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:800)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:718)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)@b@ at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)@b@ at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:372)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:919)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:834)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)@b@ at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)@b@ at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)@b@ at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:268)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)@b@ at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)@b@ at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)@b@ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)@b@ at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)@b@ at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)@b@ at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)@b@ at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)@b@ at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)@b@ at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)@b@ at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)@b@ at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)@b@ at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)@b@ at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)@b@ at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)@b@ at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)@b@ at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)@b@ at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)@b@ at java.lang.Thread.run(Thread.java:745)@b@Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error:@b@ORA-12528, TNS:listener: all appropriate instances are blocking new connections@b@ )@b@ at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)@b@ at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)@b@ at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)@b@ at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)@b@ ... 72 more@b@Caused by: java.sql.SQLException: Listener refused the connection with the following error:@b@ORA-12528, TNS:listener: all appropriate instances are blocking new connections@b@ @b@ at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)@b@ at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)@b@ at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)@b@ at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)@b@ at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)@b@ at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)@b@ at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)@b@ at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)@b@ at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)@b@ ... 75 more@b@Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:@b@ORA-12528, TNS:listener: all appropriate instances are blocking new connections@b@ @b@ at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)@b@ at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)@b@ at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)@b@ ... 83 more
通过ssh登录oracle重启报出"ORA-09817: Write to audit file failed. ORA-01075: you are currently logged on",详情日志
[oracle@centos6 tomcat7]$ source ~/.bash_profile@b@@b@[oracle@centos6 tomcat7]$ sqlplus /nolog@b@@b@SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 29 01:14:49 2019@b@@b@Copyright (c) 1982, 2009, Oracle. All rights reserved.@b@@b@SQL> connect /as sysdba;@b@ERROR:@b@ORA-09817: Write to audit file failed.@b@Linux-x86_64 Error: 28: No space left on device@b@Additional information: 12@b@ORA-01075: you are currently logged on
二、解决方法
1.因磁盘满造成无法正常连接使用oracle,定时删除比较大的日志文件
[root@centos6 tomcat7]# df@b@Filesystem 1K-blocks Used Available Use% Mounted on@b@/dev/mapper/vg_centos6-lv_root@b@ 51475068 3706092 45147536 8% /@b@tmpfs 2988808 725436 2263372 25% /dev/shm@b@/dev/sda1 487652 42208 419844 10% /boot@b@/dev/mapper/vg_centos6-lv_home@b@ 460832816 460585492 0 100% /home
2. 定义删除tomcat日志,并配置crontab -e定时器进行定期删除日志
[root@centos6 bin]# vi clrTomcatLog.sh @b@rm -fr /home/app/tomcat7/logs/*.log@b@echo '' > /home/app/tomcat7/logs/catalina.out@b@@b@[root@centos6 bin]# crontab -e@b@@b@10 01 * * * sh /home/app/tomcat7/bin/clrTomcatLog.sh
、