HttpRequestException:请求期间出现套接字异常。可能是 SSL 配置错误造成的

问题描述 投票:0回答:1

我正在使用 Spring Boot 3 MVC Web 应用程序。通过 https://start.spring.io/ 创建骨架后,我无法通过 Gradle 构建它。我的操作系统是 Debian 12 (Bookworm),我正在使用 Amazon Correcto java 21 LTS Vendor 和 SKD man。

build.gradle

plugins {
    id 'java'
    id 'war'
    id 'org.springframework.boot' version '3.2.1'
    id 'io.spring.dependency-management' version '1.1.4'
}

group = '--------' // it's hidden
version = 'v1'

java {
    sourceCompatibility = '21'
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-batch'
    implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.boot:spring-boot-starter-data-rest'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-jooq'
    implementation 'org.springframework.boot:spring-boot-starter-mail'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-authorization-server'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.liquibase:liquibase-core'
    implementation 'org.springframework.kafka:spring-kafka'
    implementation 'org.springframework.session:spring-session-data-redis'
    implementation 'org.springframework.session:spring-session-jdbc'
    implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
    runtimeOnly 'org.postgresql:postgresql'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.boot:spring-boot-testcontainers'
    testImplementation 'org.springframework.batch:spring-batch-test'
    testImplementation 'org.springframework.kafka:spring-kafka-test'
    testImplementation 'org.springframework.security:spring-security-test'
    testImplementation 'org.testcontainers:junit-jupiter'
    testImplementation 'org.testcontainers:kafka'
    testImplementation 'org.testcontainers:postgresql'
}

tasks.named('test') {
    useJUnitPlatform()
}

**例外:**

2024-01-10T20:50:57.004+0700 [INFO] [org.apache.http.impl.execchain.RetryExec] I/O exception (java.net.SocketException) caught when processing request to {s}->https://plugins.gradle.org:443: Connection reset
2024-01-10T20:50:57.004+0700 [DEBUG] [org.apache.http.impl.execchain.RetryExec] Connection reset
java.net.SocketException: Connection reset
    at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:318)
    at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
    at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
    at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
    at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:489)
    at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:483)
    at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
    at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
    at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
    at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:199)

.......

2024-01-10T20:50:57.007+0700 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
2024-01-10T20:50:57.103+0700 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-78: Shutdown connection
2024-01-10T20:50:57.103+0700 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection discarded
2024-01-10T20:50:57.103+0700 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 78][route: {s}->https://plugins.gradle.org:443][total available: 0; route allocated: 0 of 20; total allocated: 0 of 20]
2024-01-10T20:50:57.104+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Download https://plugins.gradle.org/m2/org/springframework/boot/org.springframework.boot.gradle.plugin/3.2.1/org.springframework.boot.gradle.plugin-3.2.1.pom' completed
2024-01-10T20:50:57.104+0700 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder] Flushing resolved configuration data in Binary store in /home/vyn/.gradle/.tmp/gradle14143206730842509816.bin. Wrote root 9.
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Resolve dependencies of detachedConfiguration1' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Resolve files of detachedConfiguration1' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Apply build file 'build.gradle' to root project 'kuzbassrw'' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 4.398 secs
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Notify afterEvaluate listeners of :' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 3: released lock on state of build :
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Configure project :'
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Configure project :' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Configure build'
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Configure build' completed
2024-01-10T20:50:57.105+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Finish root build tree' started
2024-01-10T20:50:57.106+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Finish root build tree'
2024-01-10T20:50:57.106+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Finish root build tree' completed
2024-01-10T20:50:57.107+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Build finished for file system watching' started
2024-01-10T20:50:57.107+0700 [INFO] [org.gradle.internal.watch.registry.impl.WatchableHierarchies] Some of the file system contents retained in the virtual file system are on file systems that Gradle doesn't support watching. The relevant state was discarded to ensure changes to these locations are properly detected. You can override this by explicitly enabling file system watching.
2024-01-10T20:50:57.107+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Build finished for file system watching'
2024-01-10T20:50:57.107+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Build finished for file system watching' completed
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-supplier (/home/vyn/.gradle/caches/8.5/md-supplier)
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-supplier (/home/vyn/.gradle/caches/8.5/md-supplier).
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-rule (/home/vyn/.gradle/caches/8.5/md-rule)
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-rule (/home/vyn/.gradle/caches/8.5/md-rule).
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 2 resolution results binary files in 0.0 secs
2024-01-10T20:50:57.108+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Run build'
2024-01-10T20:50:57.109+0700 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Run build' completed
2024-01-10T20:50:57.109+0700 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 3: released lock on worker lease
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopping 0 deployment handles
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopped deployment handles
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.DefaultPersistentDirectoryStore] VCS Checkout Cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/vcs-1) has last been fully cleaned up 6 hours ago
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.DefaultCacheCoordinator] Cache VCS Checkout Cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/vcs-1) was closed 0 times.
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.DefaultCacheCoordinator] Cache VCS metadata (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/vcsMetadata) was closed 0 times.
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for checksums cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/checksums)
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on checksums cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/checksums).
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file hash cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/fileHashes)
2024-01-10T20:50:57.110+0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file hash cache (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/fileHashes).
2024-01-10T20:50:57.111+0700 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for dependencies-accessors (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/dependencies-accessors)
2024-01-10T20:50:57.111+0700 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on dependencies-accessors (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/dependencies-accessors).
2024-01-10T20:50:57.111+0700 [DEBUG] [org.gradle.cache.internal.DefaultPersistentDirectoryStore] dependencies-accessors (/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/.gradle/8.5/dependencies-accessors) has last been fully cleaned up 3 hours ago
2024-01-10T20:50:57.114+0700 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file '/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/build.gradle' line: 4
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Plugin [id: 'org.springframework.boot', version: '3.2.1'] was not found in any of the following sources:
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1')
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   Searched in the following repositories:
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]     Gradle Central Plugin Repository
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --stacktrace option to get the stack trace.
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Get more help at https://help.gradle.org.
2024-01-10T20:50:57.107+0700 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
2024-01-10T20:50:57.107+0700 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] CONFIGURE FAILED in 4s

我哪里错了?我做错了什么?

谢谢!

我正在尝试通过 Spring 初始化程序 Web 服务从头开始构建 Spring-Boot 3 Web 应用程序。重要事实:在 Windows 10 上,一切都开箱即用

java spring spring-boot spring-mvc
1个回答
0
投票

当我使用连接到本地 Reposilite 的 gradle 存储库构建 springboot 应用程序(Grade 8.10、OpenJDK 21、Ubuntu 22.04LTS)时,我遇到了类似的问题:

./gradlew bootJar
....
> Could not resolve org.mariadb.jdbc:mariadb-java-client:3.4.1.
  Required by:
      root project :
   > Could not resolve org.mariadb.jdbc:mariadb-java-client:3.4.1.
      > Could not get resource 'http://my_local_reposilite_host:8080/releases/org/mariadb/jdbc/mariadb-java-client/3.4.1/mariadb-java-client-3.4.1.pom'.
         > Could not HEAD 'http://my_local_reposilite_host:8080/releases/org/mariadb/jdbc/mariadb-java-client/3.4.1/mariadb-java-client-3.4.1.pom'.
            > Got socket exception during request. It might be caused by SSL misconfiguration
               > No route to host

我的有效解决方案: 添加到 ~/.gradle/gradle.properties 文件参数:

org.gradle.jvmargs=-Dhttps.protocols=TLSv1.2,TLSv1.3

© www.soinside.com 2019 - 2024. All rights reserved.