一、问题描述
在centos系统通过df -h 报/dev/mapper/vg_centos6-lv_root分区磁盘占满100%,应用启动报各种异常错误"oracle.net.ns.NetException: Listener refused the connection with the following error...ORA-12505, TNS:listener does not currently know of SID given in connect descripto..org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error..",如下日志所示
[root@centos6 home]# df -h@b@Filesystem Size Used Avail Use% Mounted on@b@/dev/mapper/vg_centos6-lv_root@b@ 50G 50G 0 100% /@b@tmpfs 4.8G 88K 4.8G 1% /dev/shm@b@/dev/sda1 477M 42M 411M 10% /boot@b@/dev/mapper/vg_centos6-lv_home@b@ 440G 24G 394G 6% /home
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$$8cccf024.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-12505, TNS:listener does not currently know of SID given in connect descriptor@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-12505, TNS:listener does not currently know of SID given in connect descriptor@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-12505, TNS:listener does not currently know of SID given in connect descriptor@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@b@六月 12, 2021 11:34:12 下午 org.apache.catalina.core.StandardContext startInternal@b@严重: Error listenerStart
二、解决方法
1、通过cat /etc/fstab查看最近挂载磁盘分区目录详情
#@b@# /etc/fstab@b@# Created by anaconda on Wed Aug 8 23:39:30 2018@b@#@b@# Accessible filesystems, by reference, are maintained under '/dev/disk'@b@# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info@b@#@b@...@b@/dev/sda2 /data210202 ext4 defaults 0 0
2、因本来挂载磁盘容量最大50G,系统空间完全够了,肯定用户空间最近挂载大的磁盘分区目录等等。。。删除后解决问题
[root@centos6 tomcat7]# cd /@b@[root@centos6 /]# du -h -x --max-depth=1@b@2.8G ./usr@b@4.0K ./mnt@b@425M ./var@b@12K ./.dbus@b@4.0K ./cgroup@b@116K ./data210202@b@0 ./net@b@0 ./misc@b@42M ./etc@b@8.0K ./opt@b@4.0K ./home@b@9.3M ./bin@b@19M ./sbin@b@39M ./logs@b@28M ./lib64@b@29M ./root@b@184K ./C:@b@16K ./_site_domain_@b@4.0K ./_gsdata_@b@0 ./dev@b@0 ./selinux@b@0 ./proc@b@176M ./lib@b@348K ./tmp@b@4.0K ./media@b@0 ./sys@b@2.0K ./boot@b@16K ./lost+found@b@4.0K ./srv@b@3.6G
[root@centos6 tomcat7]#rm -fr /data210202/@b@[root@centos6 /]# df -h@b@Filesystem Size Used Avail Use% Mounted on@b@/dev/mapper/vg_centos6-lv_root@b@ 50G 3.6G 44G 8% /@b@tmpfs 4.8G 718M 4.1G 15% /dev/shm@b@/dev/sda1 477M 42M 411M 10% /boot@b@/dev/mapper/vg_centos6-lv_home@b@ 440G 24G 394G 6% /home@b@[root@centos6 /]#