ssh项目如何处理 Communications link failure due to underlying exception:异常

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 利用ssh项目处理登入系统异常这个问题

今天在跑项目的时候,登入系统遇到这个异常,于是就想着跟大家分享一下,如何解决此问题?****


如下:是抛出的异常源码:

Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION **



java.net.ConnectException MESSAGE: Connection refused: connect STACKTRACE: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at  

java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at  

java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at  

java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at  

java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at  

java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown  

Source) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256) at  

com.mysql.jdbc.MysqlIO.(MysqlIO.java:271) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771) at

com.mysql.jdbc.Connection.(Connection.java:1555) at  

com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at  

java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown  Source) at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)  

at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159) at  

org.logicalcobwebs.proxool.ConnectionPool.getConnection(ConnectionPool.java:211) at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:89) at  

java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at org.hibernate.connection.ProxoolConnectionProvider.getConnection(ProxoolConnectionProvider.java:75)  

at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) at  

org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at  

org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) at  

org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85) at  

org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463) at  org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555) at  

org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371) at  

org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335) at  

org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105) at  

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at  

org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at  

org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at  

org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy11.selectUserbByusernameByPassword(Unknown Source) at  

manage.action.ManageAction.login(ManageAction.java:114) at  

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at  

sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at  

sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown  

Source) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at  

com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at  

com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)  

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) at  

org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at  

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at  

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)  

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java

:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) at  

com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at  

com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:18

7) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at  

org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at  

org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at  

org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at  

org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:9

1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at  

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at  

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java

:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at  

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at  

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at  

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at  

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at  

org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) at  

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at  

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) at  

org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) at  

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at  

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at  

org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799) at  

org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at  

org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) at  

org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) at  

org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at  

java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at  

java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at  

org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at  

java.lang.Thread.run(Unknown Source) ** END NESTED EXCEPTION ** Last packet sent to the server was 1 ms ago.

Cannot open connection

Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection

File: com/mysql/jdbc/Connection.java

Line number: 2,847



###要在异常中能准确查找到关键问题所在位置,而不是全篇从头看到尾!

42.jpg

43.jpg

解决 :

1、检查mysql服务是否启动;

win+R 输入:services.msc将mysql的服务启动后问题解决。

或者:右键 <计算机>---->>>管理—>>>服务和应用程序---->>>服务,在右侧的栏目中找到名称为MYSQL的服务。这个时候他的状态应该是空,即未启动,启动此服务就OK了。

如图:

33.jpg


2、检查mysql的登陆用户名和密码是否正确;

34.jpg


小伙伴,你们学会了吗?

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
227 0
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
|
16小时前
|
Java 应用服务中间件 网络安全
Eclipse运行SSM/SSH项目教程
Eclipse运行SSM/SSH项目教程
|
1月前
|
监控 Java 网络安全
java获取ssh连接时报错com.jcraft.jsch.JSchException: Packet corrupt如何处理?
【6月更文挑战第5天】java获取ssh连接时报错com.jcraft.jsch.JSchException: Packet corrupt如何处理?
207 5
|
1月前
|
网络安全
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
54 0
|
8月前
|
网络安全
SNETCracker.exe 2022/1/26 31:13:29----检查12.26.20.1:SSH登录发生异常!未能加载文件或程序集“ChilkatDotNet4.dll”或它的某一个依赖项
SNETCracker.exe 2022/1/26 31:13:29----检查12.26.20.1:SSH登录发生异常!未能加载文件或程序集“ChilkatDotNet4.dll”或它的某一个依赖项
284 0
|
9月前
|
JavaScript Java 网络安全
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
208 0
|
9月前
|
Java 网络安全 Maven
16Maven - maven构建ssh项目(Eclipse版本)
16Maven - maven构建ssh项目(Eclipse版本)
56 0
|
11月前
|
JavaScript Java 网络安全
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
291 0
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
|
jenkins 持续交付 网络安全
2. 成功解决 BUG:Exception when publishing, ...[Failed to connect and initialize SSH connection...
SSH: Connecting from host [WIN-...] SSH: Connecting with configuration [192.168....] ... ERROR: Exception when publishing, exception message [Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [192.168....]. Message [java.net.ConnectException: Connection
1325 0
ssh2 Connection .connect()方法抛出连接过早关闭异常
ssh2 Connection .connect()方法抛出连接过早关闭异常
ssh2 Connection .connect()方法抛出连接过早关闭异常