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

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用系列 2核4GB
简介: 利用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


小伙伴,你们学会了吗?

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
258 0
在使用SSH+Spring开发webservice ,报的一些异常及处理方法
|
22天前
|
监控 Ubuntu Linux
使用VSCode通过SSH远程登录阿里云Linux服务器异常崩溃
通过 VSCode 的 Remote - SSH 插件远程连接阿里云 Ubuntu 22 服务器时,会因高 CPU 使用率导致连接断开。经排查发现,VSCode 连接根目录 ".." 时会频繁调用"rg"(ripgrep)进行文件搜索,导致 CPU 负载过高。解决方法是将连接目录改为"root"(或其他具体的路径),避免不必要的文件检索,从而恢复正常连接。
|
4月前
|
XML JSON Java
使用IDEA+Maven搭建整合一个Struts2+Spring4+Hibernate4项目,混合使用传统Xml与@注解,返回JSP视图或JSON数据,快来给你的SSH老项目翻新一下吧
本文介绍了如何使用IntelliJ IDEA和Maven搭建一个整合了Struts2、Spring4、Hibernate4的J2EE项目,并配置了项目目录结构、web.xml、welcome.jsp以及多个JSP页面,用于刷新和学习传统的SSH框架。
93 0
使用IDEA+Maven搭建整合一个Struts2+Spring4+Hibernate4项目,混合使用传统Xml与@注解,返回JSP视图或JSON数据,快来给你的SSH老项目翻新一下吧
WXM
|
5月前
|
Java 应用服务中间件 网络安全
Eclipse运行SSM/SSH项目教程
Eclipse运行SSM/SSH项目教程
WXM
157 0
|
6月前
|
监控 Java 网络安全
java获取ssh连接时报错com.jcraft.jsch.JSchException: Packet corrupt如何处理?
【6月更文挑战第5天】java获取ssh连接时报错com.jcraft.jsch.JSchException: Packet corrupt如何处理?
964 5
|
6月前
|
网络安全
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
474 0
|
网络安全
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”或它的某一个依赖项
365 0
|
JavaScript Java 网络安全
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
从零玩转之JPOM自动化部署本地构建 + SSH 发布 java 项目
334 0
|
7月前
|
Shell 网络安全 开发工具
GitLab创建项目的时候需要SSH Keys
GitLab创建项目的时候需要SSH Keys
40 0
|
Java 网络安全 Maven
16Maven - maven构建ssh项目(Eclipse版本)
16Maven - maven构建ssh项目(Eclipse版本)
72 0