In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
When working on the Docker integration WEB project, the tomcat container starts normally and the MySQL container starts normally, but when the external access tomcat is used for database operation, the application reports an error as follows:
Last packet sent to the server was 0 ms ago.; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure
Last packet sent to the server was 0 ms ago.)
At org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate (AbstractFallbackSQLExceptionTranslator.Java:83)
At org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate (AbstractFallbackSQLExceptionTranslator.java:80)
At org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate (AbstractFallbackSQLExceptionTranslator.java:80)
At org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException (HibernateAccessor.java:424)
At org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException (HibernateAccessor.java:410)
At org.springframework.orm.hibernate3.HibernateTemplate.doExecute (HibernateTemplate.java:411)
At org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession (HibernateTemplate.java:374)
At org.springframework.orm.hibernate3.HibernateTemplate.find (HibernateTemplate.java:912)
At org.springframework.orm.hibernate3.HibernateTemplate.find (HibernateTemplate.java:908)
At com.xgni.dao.impl.InstrumentsDaoImpl.findByProperty (InstrumentsDaoImpl.java:95)
At com.xgni.dao.impl.InstrumentsDaoImpl.findByIsJPTJ (InstrumentsDaoImpl.java:233)
At com.xgni.service.impl.InstrumentsServiceImpl.findByIsJPTJ (InstrumentsServiceImpl.java:98)
At com.xgni.controller.InstrumentController.initJPTJ (InstrumentController.java:496)
At sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethod)
At sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
At sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
At java.lang.reflect.Method.invoke (Method.java:606)
At com.opensymphony.xwork2.DefaultActionInvocation.invokeAction (DefaultActionInvocation.java:441)
At com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly (DefaultActionInvocation.java:280)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:243)
At com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java:165)
At com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (ValidationInterceptor.java:252)
At org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java:68)
At com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept (ConversionErrorInterceptor.java:122)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java:195)
At com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java:195)
At com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept (StaticParametersInterceptor.java:179)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.interceptor.MultiselectInterceptor.intercept (MultiselectInterceptor.java:75)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.interceptor.CheckboxInterceptor.intercept (CheckboxInterceptor.java:94)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.interceptor.FileUploadInterceptor.intercept (FileUploadInterceptor.java:235)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept (ModelDrivenInterceptor.java:89)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept (ScopedModelDrivenInterceptor.java:130)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (DebuggingInterceptor.java:267)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept (ChainingInterceptor.java:126)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (PrepareInterceptor.java:138)
At com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java:87)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18nInterceptor.java:165)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (ServletConfigInterceptor.java:164)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (AliasInterceptor.java:179)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept (ExceptionMappingInterceptor.java:176)
At com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:237)
At org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java:52)
At org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java:488)
At org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction (ExecuteOperations.java:77)
At org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter (StrutsPrepareAndExecuteFilter.java:91)
At org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:241)
At org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:208)
At org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:218)
At org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:122)
At org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:505)
At org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:169)
At org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:103)
At org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:956)
At org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:116)
At org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:442)
At org.apache.coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Processor.java:1083)
At org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process (AbstractProtocol.java:640)
At org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run (JIoEndpoint.java:318)
At java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
At java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615)
At org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run (TaskThread.java:61)
At java.lang.Thread.run (Thread.java:724)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure
Last packet sent to the server was 0 ms ago.)
At org.apache.commons.dbcp.BasicDataSource.createDataSource (BasicDataSource.java:1225)
At org.apache.commons.dbcp.BasicDataSource.getConnection (BasicDataSource.java:880)
At org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection (LocalDataSourceConnectionProvider.java:81)
At org.hibernate.jdbc.ConnectionManager.openConnection (ConnectionManager.java:446)
At org.hibernate.jdbc.ConnectionManager.getConnection (ConnectionManager.java:167)
At org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement (AbstractBatcher.java:161)
At org.hibernate.loader.Loader.prepareQueryStatement (Loader.java:1577)
At org.hibernate.loader.Loader.doQuery (Loader.java:696)
At org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (Loader.java:259)
At org.hibernate.loader.Loader.doList (Loader.java:2232)
At org.hibernate.loader.Loader.listIgnoreQueryCache (Loader.java:2129)
At org.hibernate.loader.Loader.list (Loader.java:2124)
At org.hibernate.loader.hql.QueryLoader.list (QueryLoader.java:401)
At org.hibernate.hql.ast.QueryTranslatorImpl.list (QueryTranslatorImpl.java:363)
At org.hibernate.engine.query.HQLQueryPlan.performList (HQLQueryPlan.java:196)
At org.hibernate.impl.SessionImpl.list (SessionImpl.java:1149)
At org.hibernate.impl.QueryImpl.list (QueryImpl.java:102)
At org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate (HibernateTemplate.java:921)
At org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate (HibernateTemplate.java:1)
At org.springframework.orm.hibernate3.HibernateTemplate.doExecute (HibernateTemplate.java:406)
... 77 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.
At sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:57)
At sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
At java.lang.reflect.Constructor.newInstance (Constructor.java:526)
At com.mysql.jdbc.Util.handleNewInstance (Util.java:406)
At com.mysql.jdbc.SQLError.createCommunicationsException (SQLError.java:1074)
At com.mysql.jdbc.ConnectionImpl.createNewIO (ConnectionImpl.java:2103)
At com.mysql.jdbc.ConnectionImpl. (ConnectionImpl.java:718)
At com.mysql.jdbc.JDBC4Connection. (JDBC4Connection.java:46)
At sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:57)
At sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
At java.lang.reflect.Constructor.newInstance (Constructor.java:526)
At com.mysql.jdbc.Util.handleNewInstance (Util.java:406)
At com.mysql.jdbc.ConnectionImpl.getInstance (ConnectionImpl.java:302)
At com.mysql.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:282)
At org.apache.commons.dbcp.DriverConnectionFactory.createConnection (DriverConnectionFactory.java:38)
At org.apache.commons.dbcp.PoolableConnectionFactory.makeObject (PoolableConnectionFactory.java:294)
At org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory (BasicDataSource.java:1247)
At org.apache.commons.dbcp.BasicDataSource.createDataSource (BasicDataSource.java:1221)
... 96 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communication link failure, message from server: "Can't get hostname for your address"
At sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:57)
At sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
At java.lang.reflect.Constructor.newInstance (Constructor.java:526)
At com.mysql.jdbc.Util.handleNewInstance (Util.java:406)
At com.mysql.jdbc.Util.getInstance (Util.java:381)
At com.mysql.jdbc.SQLError.createSQLException (SQLError.java:984)
At com.mysql.jdbc.SQLError.createSQLException (SQLError.java:956)
At com.mysql.jdbc.MysqlIO.doHandshake (MysqlIO.java:1095)
At com.mysql.jdbc.ConnectionImpl.createNewIO (ConnectionImpl.java:2031)
... 109 more
The most important thing is the last exception error: Communication link failure, message from server: "Can't get hostname for your address"
You need to set the ssh option when using navicat remote connection, and you also need to enter the operating system user password to log in when you click to connect to mysql.
The reason for this exception is that domain name resolution or DNS resolution is enabled by default when mysql starts. You need to add a parameter to the control file of mysql: skip-name-resolve, through the command
Mysql-- help | grep my check the configuration file address / etc/my.cnf of mysql, and add skip-name-resolve under [mysqld] to restart mysql or restart the docker container.
After the restart is completed, the application can operate the database normally without reporting: message from server: "Can't get hostname for your address", navicat connection to the database to cancel the SSH option, just click to connect to the database.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.