Tag Archives: Pit record

[Solved] Linux startup jar package error: Communications link failure

Linux Start jar package error: Communications link failure
Error Messages:

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

create connection SQLException, url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai, errorCode 0, state 08S01

 

Solution:

Modify the information of the database connection you had setted before.

url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

Modified data connection information

 url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

How to Solve Springboot configurate environment file Error

preface

When configuring multiple environment files for springboot, you need to configure multiple YML files. The configuration before version 2.4 is as follows:

spring: 
  profiles:
    active: dev

But if SpringBoot’s version 2.4 later, it’s a reward.

org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property ‘spring.profiles.active[0]’ imported from location ‘class path resource [application-work.yml]’ is invalid in a profile specific resource [origin: class path resource [application-work.yml] - 9:7]

 

Solution:

General layout changes as follows:

spring:
  config:
    activate:
       on-profile:
          - dev

Of course, it can also be solved by returning the spring boot version to before 2.4

Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibat

	Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userResultMap'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userResultMap
		at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:265)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
		at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
		... 104 more
	Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'userResultMap'.  Cause: java.lang.ClassNotFoundException: Cannot find class: userResultMap
		at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
		at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
		at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
		... 108 more

Recently, during SSM integration, I encountered a bug of classnotfoundexception, which means that the result type corresponding to the return value cannot be found. Finally, I found that I wrote the type and ID inversely.

In addition, if the returned value is a basic data type, use resulttype. If it matches resultmap
, such as collection, map, etc., use resultmap. When facing Baidu debug, you will report similar errors when you see this situation