Tag Archives: java

[Solved] IDEA try-with-resources Error: AutoCloseable

IDEA try-with-resources error: AutoCloseable

try (HttpPost post = new HttpPost(url)){
    ...
}catch(... | ... ){
}

Editor tip: incompatible types: try with resources is not applicable to variable types

Reason: the httppost used does not implement closeable and is not supported. The compiler automatically helps us complete close(), which is not available in httppost. If you want to test the writing method, you can use: closeablehttpclient, bufferedinputstream and so on. Finally, decompile it.

try (CloseableHttpClient client =HttpClients.createDefault();){
...
}...

[Solved] com.highgo.jdbc.util.PSQLException:bad value for long

environment
system platform: Galaxy Kirin u system (CPU Feiteng) 4
version: 4.3.4.5
symptom
application error:

com.highgo.jdbc.util.PSQLException:bad value for long:{"w":1341,"h":700,"widgets":[{"id":1,"c":1,"r":1,"x":24,"y":27},{"id":2,"c":25,"r":1,"x":51,"y":54},{"id":3,"c":25,"r":55,"x":51,"y":32},{"id":4,"c":1,"r":28,"x":24,"y":27},{"id":5,"c":76,"r":1,"x":25,"y":26},{"id":6,"c":76,"r":55,"x":25,"y":32},{"id":7,"c":76,"r":27,"x":25,"y":28},{"id":8,"c":1,"r":55,"x":24,"y":32}]}

Cause of the problem
MyBatis in the query for select mapping, the return type can be used resultTy, investigation and analysis found that the customer’s program to return the field type is longvarchar, so take the jar package within the tolong method, causing errors.

Solution
Modify the return field type longvarchar to varchar in the program.

Error code

com.highgo.jdbc.util.PSQLException:bad value for long

[Solved] kafka Error: java.net.UnknownHostException: kafkahost

 

Problem phenomenon:

Today, I wanted to debug the service on my computer. I found that when calling the interface through the gateway, an error related to Kafka was reported, as follows:

java.net.UnknownHostException: kafkahost


Problem analysis:

It can be seen from the error message that the host named kafkahost cannot be recognized.

By viewing the configuration of a service instance of Kafka cluster configuration on Linux server, you can find:

listeners=PLAINTEXT://kafkahost:0091

This configuration uses the {kafkahost} mentioned in the error message. You can see that this service instance listens to the IP port} kafkahost: 0091; By viewing the/etc/hosts file of the Linux server, you can see:

Kafkahost points to the Linux server IP.

Since I accessed the Kafka service on the Linux server in the native service, I naturally could not resolve to kafkahost. Therefore, you need to add the corresponding configuration in the hosts file of this machine!


Solution:

Find the hosts file path of this machine:

C:\Windows\System32\drivers\etc

Add the following configuration at the end of the file to identify kafkahost as the Linux server IP:

Restart the local service and call the interface again without any error:

Springboot mybatis Integrate Error: Invalid bound statement (not found): com…DepartmentMapper.save

Error message:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.qf.java2107.springboot.mapper.DepartmentMapper.save

	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53)
	at org.apache.ibatis.binding.MapperProxy.lambda$cachedInvoker$0(MapperProxy.java:115)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at org.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:102)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
	at com.sun.proxy.$Proxy74.save(Unknown Source)
	at com.qf.java2107.springboot.SpringbootDemo01QuickApplicationTests.saveTest(SpringbootDemo01QuickApplicationTests.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

Error reason: the namespace of mapper mapping file is written incorrectly

<mapper namespace="com.qf.java2107.springboot.demo02.mapper.DepartmentMapper">

After modification, it is successful

<mapper namespace="com.qf.java2107.springboot.mapper.DepartmentMapper">

[Solved] Powermock error: Java.Lang.linkageerror: load constraint violation

Use powermock to report an error Java Lang. linkageerror: load constraint violation

Error reporting information (limited to deletion of space): analysis and solution extension

Error reporting information (limited to deletion of space):

java.lang.LinkageError: Loading constraint violation: loaders“org/powermock/core/classloader/javassist/JavassistMockClassLoader@47ab16ce”先前已启动由装入器“com/ibm/oti/vm/BootstrapClassLoader@ba626924”定义的名为“javax/security/auth/x500/X500Principal”的另一种类型的装入

\tat java.lang.ClassLoader.defineClassImpl(Native Method)
\tat java.lang.ClassLoader.defineClass(ClassLoader.java:346)
\tat org.powermock.core.classloader.javassist.JavassistMockClassLoader.loadUnmockedClass(JavassistMockClassLoader.java:90)
\tat org.powermock.core.classloader.MockClassLoader.loadClassByThisClassLoader(MockClassLoader.java:104)
\tat 、ock.core.MockInvocation.init(MockInvocation.java:31)
\tat org.powermock.core.MockInvocation.<init>(MockInvocation.java:22)
\tat org.powermock.core.MockGateway.doMethodCall(MockGateway.java:155)
\tat org.powermock.core.MockGateway.methodCall(MockGateway.java:138)

analysis

java.Lang.linkageerror this exception is often encountered in applications using multiple classloaders
the reason for this error is the class conflict caused by the cross use of class classes with the same qualified name after being loaded by multiple different classloaders. Classes with the same qualified name belong to different class instances in different classloaders. When loading a class, the JVM needs to load all imported classes. In this case, if there is a class with the same qualified name in the custom classloader as that in the parent classloader, Java. Net will be thrown Lang.LinkageError.
from the error message, you can see that the javax/security/auth/X500/X500 principal class is loaded by the classloader and bootstrapclassloader customized by powermock at the same time.

Solution:

Use @powermockignore to make javassistmockclassloader ignore the loading of javax/security/auth/X500/X500 principal:

@PowerMockIgnore({"javax.security.*"})

[Solved] Activity jump permission UID Error: ActivityTaskmanager: Permission Denied

Scenario.
Settings application’s interface, pulling up Dialer’s interface reports an error.


Error Messages:

//Fail log:Settings->ApnEditorActivity
01-11 16:46:07.938 1044 6380 W ActivityTaskManager: Permission Denial: package=com.android.settings does not belong to uid=1001
//Pass log: Settings->ApnSettingsActivity
01-11 16:46:03.997 1044 1694 I ActivityTaskManager: START u0 {act=android.intent.action.CALL_BUTTON flg=0x10000000 cmp=com.android.dialer/.app.DialpadActivity} from uid 1000

UI corresponding process configuration

<!--AndroidManifest.xml-->
<activity android:name="Settings$ApnEditorActivity"
    android:process="com.android.phone">

Cause analysis:

UI on COM android. Settings, Android: process = “com. Android. Phone” is configured, and they are in different processes.

Source code reference: XRef:/packages/apps/settings/androidmanifest xml (revision 939136b)

<!--xref: /packages/apps/Settings/AndroidManifest.xml (revision 939136b3)-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        package="com.android.settings"
        coreApp="true"
        android:sharedUserId="android.uid.system">

The settings application is in system and the phone belongs to radio

adb shell
top # Check the progress

// top
PID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ ARGS
6558 system    20 0 1.0G 137M 110M S 0.0 15.6 0:06.92 com.android.settings
6138 radio        20   0 1.1G 113M  98M S  0.3  12.9   1:19.43 com.android.phone


Solution:
According to the log ActivityTaskManager: Permission Denial: package=com.android.settings does not belong to uid=1001, it should be a package and process mismatch. Remove the configuration of android:process=”com.android.phone”.

javaweb Connect Datas Error: che.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444)

1. Jar package is not imported
2 Multiple versions conflict
3 Version mismatch between idea and Tomcat

java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)

Error reporting check

1. Check whether you have introduced MySQL-connector-Java.Jar package

This is used to link the database

2. Check the position of the bag

be sure to check

3. See if there are more spaces in the incoming string

serviceimpl inherits generic public impl startup error: ClassCastException (Mybatis-plus version Issue)

Project scenario:

Mybatis plus version: 3.4.3
create abstract general services for service classes and service implementation classes
eg:

service port: service extends AbstracService<T>
service: serviceimpl extends  AbstracServiceImpl<M,T> implements service 
Abstract Common Service Interface: AbstracService<T extends xxBaseEntity> extends IService<T>
Abstract Common Service Interface Implementation: AbstracServiceImpl<M extends BaseMapper<T>,T extends xxBaseEntity> extends ServiceImpl<M, T> implements AbstracService<T>

Problem Description.
Startup error message:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.xx.xx.xx.service.impl.ServiceImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326)
… 157 common frames omitted
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.currentModelClass(ServiceImpl.java:88)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.(ServiceImpl.java:62)
at cn.lztl.assp.mall.service.impl.AbstractPromotionsServiceImpl.(AbstractPromotionsServiceImpl.java:38)
at cn.lztl.assp.mall.service.impl.ServiceImpl.(SeckillServiceImpl.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)
… 159 common frames omitted


Solution:
Update mybatis-plus version to version 3.4.3.2 or later.
Introduce dependency com.baomidou.mybatisplus.extension section must be version 3.4.3.2 onwards

[Solved] Springboot project Create to start Error: APPLICATION FAILED TO START

 

Description:
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Process finished with exit code 1

Reason:
Spring boot loads the org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration class by default, after introducing mybatis-spring-boot-starter in the pom. DataSourceAutoConfiguration class uses the @Configuration annotation to inject the dataSource bean into spring because there is no configuration information about the dataSource in the project, so when spring creates the dataSource bean due to the lack of relevant information it will report an error.

Solution:
Add attribute @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) to the Spring boot boot boot class to prevent Spring boot from automatically injecting the dataSource

Rancher application service error: request entity too large

When request entity too large occurs, it is because the transport stream exceeds 1m.

1. It is necessary to set parameters in ingress of rancher.

Configuration note: nginx.ingress.kubernetes.io/proxy-body-size

2. Springboot 2.0 adds configuration to the configuration file

spring.servlet.multipart.max-file-size=1024MB
spring.servlet.multipart.max-request-size=1024MB

[Solved] spingboot Error: I/O error on POST request for “9411/api/v2/spans“: connect timed out

Springboot error I/O error on post request for“ http://10.10.195.199:9411/api/v2/spans “: connect timed out; nested exception is java.net.SocketTimeoutException: connect timed out

Problem background solution experience Lyric: a sack of love and happiness

Problem background

When using Zipkin, the following error occurs when accessing the URL

2022-01-11 11:22:35.554  WARN [service-one,,,] 40592 --- [ender@131ff6fa}] z.r.AsyncReporter$BoundedAsyncReporter   : Spans were dropped due to exceptions. All subsequent errors will be logged at FINE level.
2022-01-11 11:22:35.557  WARN [service-one,,,] 40592 --- [ender@131ff6fa}] z.r.AsyncReporter$BoundedAsyncReporter   : Dropped 1 spans due to ResourceAccessException(I/O error on POST request for "http://10.10.195.199:9411/api/v2/spans": connect timed out; nested exception is java.net.SocketTimeoutException: connect timed out)

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://10.10.195.199:9411/api/v2/spans": connect timed out; nested exception is java.net.SocketTimeoutException: connect timed out
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:751) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at org.springframework.cloud.sleuth.zipkin2.sender.ZipkinRestTemplateWrapper.doExecute(ZipkinRestTemplateSenderConfiguration.java:228) ~[spring-cloud-sleuth-zipkin-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:644) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender.post(RestTemplateSender.java:129) ~[spring-cloud-sleuth-zipkin-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender$HttpPostCall.doExecute(RestTemplateSender.java:142) ~[spring-cloud-sleuth-zipkin-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender$HttpPostCall.doExecute(RestTemplateSender.java:132) ~[spring-cloud-sleuth-zipkin-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at zipkin2.Call$Base.execute(Call.java:380) ~[zipkin-2.19.0.jar:na]
	at zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:285) ~[zipkin-reporter-2.11.0.jar:na]
	at zipkin2.reporter.AsyncReporter$Flusher.run(AsyncReporter.java:354) [zipkin-reporter-2.11.0.jar:na]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_172]
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_172]
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_172]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_172]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_172]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_172]
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_172]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_172]
	at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_172]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[na:1.8.0_172]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[na:1.8.0_172]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[na:1.8.0_172]
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[na:1.8.0_172]
	at sun.net.www.http.HttpClient.New(HttpClient.java:339) ~[na:1.8.0_172]
	at sun.net.www.http.HttpClient.New(HttpClient.java:357) ~[na:1.8.0_172]
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) ~[na:1.8.0_172]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) ~[na:1.8.0_172]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) ~[na:1.8.0_172]
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) ~[na:1.8.0_172]
	at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:76) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:742) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	... 9 common frames omitted

Solution

1. The firewall is not turned off

systemctl stop firewalld

Experience

1. I was tired of finding the problem. Another time, I just introduced Zipkin dependency, which was not used, and a similar error occurred.