问题描述
org.springframework.jdbc.UncategorizedSQLException:Hibernateoperation:Cannotopenconnection;uncategorizedSQLExceptionforSQL[???];SQLstate[null];errorcode[17002];Io异常:TheNetworkAdaptercouldnotestablishtheconnection;nestedexceptionisjava.sql.SQLException:Io异常:TheNetworkAdaptercouldnotestablishtheconnection
解决方案
解决方案二:
Eclipse中出现错误如下ERROR-JDBCExceptionReporter.logExceptions(101)|Io异常:TheNetworkAdaptercouldnotestablishtheconnectionERROR-JDBCExceptionReporter.logExceptions(101)|Io异常:TheNetworkAdaptercouldnotestablishtheconnectionERROR-AbstractFlushingEventListener.performExecutions(324)|Couldnotsynchronizedatabasestatewithsessionorg.hibernate.exception.GenericJDBCException:Cannotopenconnectionatorg.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)atorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)atorg.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)atorg.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)atorg.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)atorg.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)atorg.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116)atorg.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)atorg.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244)atorg.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2242)atorg.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2678)atorg.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)atorg.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)atorg.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)atorg.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)atorg.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)atorg.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)atorg.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)atorg.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)atorg.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:420)atorg.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)atorg.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)atcn.com.ztaxj.core.base.BaseDao.insert(BaseDao.java:32)atcn.com.ztaxj.core.base.BaseService.insert(BaseService.java:28)atcn.com.ztaxj.permission.action.User.uploadLdap(User.java:105)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atcom.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)atcom.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)atorg.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:314)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)atorg.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:314)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atcom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)atorg.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)atorg.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)atorg.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)atjava.lang.Thread.run(UnknownSource)Causedby:java.sql.SQLException:Io异常:TheNetworkAdaptercouldnotestablishtheconnectionatoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)atoracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)atoracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
解决方案三:
有没有高手帮忙看下呀~~
解决方案四:
循环的代码贴下吧.大家一起研究下.不知道你是不是循环太多了,然后每次打开一个新连接没有释放,导致连接池不够用了
解决方案五:
最大的肯能是数据库连接开多了,达到上限
解决方案六:
具体看看出错的代码吧。3L、4L说的可能性比较大