首页

oracle连接拒绝"GenericJDBCException..SQLNestedException.NetException..ORA-12505, TNS:listener..SID given in connect descriptor"异常

标签:GenericJDBCException,ora12505,NetException,SQLException,SQLNestedException,oracle异常     发布时间:2020-05-03   

一、异常说明

最近后台启动报数据库连接异常,导致应用启动失败而无法正常使用 “ORA-12505, TNS:listener does not currently know of SID given in connect descriptor... ERROR org.hibernate.util.JDBCExceptionReporter  – Cannot create PoolableConnectionFactory (Listener refused the connection with the following error.. ORA-12505

TNS:listener does not currently know of SID given in connect descriptor..org.hibernate.exception.GenericJDBCException: Cannot open connection..”详情上下文错误日志如下

AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@3d38fd93)@b@   LogAbandoned: true@b@   RemoveAbandoned: true@b@   RemoveAbandonedTimeout: 120@b@2111 [localhost-startStop-1] WARN  org.hibernate.util.JDBCExceptionReporter  – SQL Error: 0, SQLState: null@b@2111 [localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter  – 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@2112 [localhost-startStop-1] WARN  org.hibernate.util.JDBCExceptionReporter  – SQL Error: 0, SQLState: null@b@2112 [localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter  – 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@AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@5e301c8d)@b@   LogAbandoned: true@b@   RemoveAbandoned: true@b@   RemoveAbandonedTimeout: 120@b@2115 [localhost-startStop-1] WARN  org.hibernate.util.JDBCExceptionReporter  – SQL Error: 0, SQLState: null@b@2115 [localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter  – 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@2115 [localhost-startStop-1] WARN  org.hibernate.util.JDBCExceptionReporter  – SQL Error: 0, SQLState: null@b@2115 [localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter  – 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@2117 [localhost-startStop-1] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  – Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2a1b632f: defining beans [propertyConfigurer,dataSource,dataSourceMysql,sessionFactory,jdbcTransactionManager,mysqljdbcTransactionManager,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,addManagerMethod,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,hibernateTemplate,jdbcTemplate,jdbcMysqlTemplate,commonDao,commonMysqlDao,baseDao,baseMysqlDao,treeDao,treeServer,treeAction,templetDao,templetServer,templetAction,terminalDao,terminalServer,contentDao,terminalAdapterPicRelationDao,contentServer,terminalAdapterPicRelationServer,adDao,adServer,siteDao,siteServer,contentAction,fmtGenerator,publishRunnable,publishExecutors,publishDao,publishWaitDao,publishServer,filePublisher,publisherAction,ftpOms,publishWaitAction,userDao,userServer,userAction,loginAction,groupDao,groupServer,groupAction,userGroupDao,userGroupServer,ftpServerDao,ftpServerServer,ftpServerAction,keywordDao,keywordServer,keywordAction,faceiconDao,faceiconServer,faceiconAction,siteAction,cluAccessLogDao,initServer,cluAccessLogCustomer,terminalAction,adAction,postStaticQuestionTask,staticQuestionTrigger,dbBackTask,dbBackTrigger,contentTask,contentTrigger,accessLogTask,accessLogTrigger,accessLogDelTask,accessLogDelTrigger,synXwoodSearchViewTask,synXwoodSearchViewTrigger,PostUrlTask,PostUrlTrigger,org.springframework.scheduling.quartz.SchedulerFactoryBean,statDao,statServer,statAction,ccommentDao,cCommentServer,cCommentAction,channleCommentDao,channleCommentServer,channleComentAction,clientTerminalDao,clientTerminalServer,clientTerminalAction,voteDao,voteServer,voteAction,regimenUserDao,regimenUserServer,regimenUserAction,synRuleDao,synRuleServer,synRuleAction,paramDao,paramServer,paramAction,indexAction,fileRevAction,xfire.customEditorConfigurer,xfire.serviceRegistry,xfire.transportManager,xfire,xfire.typeMappingRegistry,xfire.aegisBindingProvider,xfire.serviceFactory,xfire.servletController,xfire.messageServiceFactory,xfire.messageBindingProvider]; root of factory hierarchy@b@2118 [localhost-startStop-1] INFO  org.springframework.orm.hibernate3.LocalSessionFactoryBean  – Closing Hibernate SessionFactory@b@2118 [localhost-startStop-1] INFO  org.hibernate.impl.SessionFactoryImpl  – closing@b@2119 [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$$7b08d920.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:62)@b@        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)@b@        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)@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:511)@b@        at java.util.concurrent.FutureTask.run(FutureTask.java:266)@b@        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)@b@        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)@b@        at java.lang.Thread.run(Thread.java:748)@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@May 03, 2020 11:54:16 AM org.apache.catalina.core.StandardContext startInternal@b@SEVERE: Error listenerStart

二、解决方法

1.方法一:因为oracle密码超期造成数据库无法正常连接,通过客户端plsql连接后自动提示可以直接 修改密码(如下图)

2.方法二:通过命令进行修改命令,参考教程进行修改

<<推荐下载>>