Docker debian 容器遇到的问题记录

397 阅读2分钟

一:deiban容器更新源失败,抱gpk error。镜像包过时,使用 docker image prune 清理一下镜像,重新拉去。

二:jar包启动失败。报错日志: javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10 is not accepted by client preferences [TLS12] com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 com.zaxxer.hikari.pool.HikariPoolPoolInitializationException:Failedtoinitializepool:ThedrivercouldnotestablishasecureconnectiontoSQLServerbyusingSecureSocketsLayer(SSL)encryption.Error:"TheserverselectedprotocolversionTLS10isnotacceptedbyclientpreferences[TLS12]".ClientConnectionId:98b73b8a85294bc78e8618e42ad04da4org.springframework.beans.factory.BeanCreationException:ErrorcreatingbeanwithnamedataSourcedefinedinclasspathresource[com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]:Invocationofinitmethodfailed;nestedexceptioniscom.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPoolPoolInitializationException:Failedtoinitializepool:ThedrivercouldnotestablishasecureconnectiontoSQLServerbyusingSecureSocketsLayer(SSL)encryption.Error:"TheserverselectedprotocolversionTLS10isnotacceptedbyclientpreferences[TLS12]".ClientConnectionId:98b73b8a85294bc78e8618e42ad04da4org.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnamereviewProcessMapperdefinedinURL[jar:file:/usr/local/server/ntoccbasicapi.jar!/BOOTINF/lib/ntocccommon1.0SNAPSHOT.jar!/com/arpa/ntocc/common/mapper/ReviewProcessMapper.class]:UnsatisfieddependencyexpressedthroughbeanpropertysqlSessionFactory;nestedexceptionisorg.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnamesqlSessionFactorydefinedinclasspathresource[com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]:UnsatisfieddependencyexpressedthroughmethodsqlSessionFactoryparameter0;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:ErrorcreatingbeanwithnamedataSourcedefinedinclasspathresource[com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]:Invocationofinitmethodfailed;nestedexceptioniscom.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reviewProcessMapper' defined in URL [jar:file:/usr/local/server/ntocc-basic-api.jar!/BOOT-INF/lib/ntocc-common-1.0-SNAPSHOT.jar!/com/arpa/ntocc/common/mapper/ReviewProcessMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reviewProcessMapper' defined in URL [jar:file:/usr/local/server/ntocc-basic-api.jar!/BOOT-INF/lib/ntocc-common-1.0-SNAPSHOT.jar!/com/arpa/ntocc/common/mapper/ReviewProcessMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPoolPoolInitializationException:Failedtoinitializepool:ThedrivercouldnotestablishasecureconnectiontoSQLServerbyusingSecureSocketsLayer(SSL)encryption.Error:"TheserverselectedprotocolversionTLS10isnotacceptedbyclientpreferences[TLS12]".ClientConnectionId:98b73b8a85294bc78e8618e42ad04da4org.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnameauthorizeTokenService:UnsatisfieddependencyexpressedthroughfieldroleService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:ErrorcreatingbeanwithnameroleServiceImpl:Injectionofresourcedependenciesfailed;nestedexceptionisorg.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnamereviewProcessMapperdefinedinURL[jar:file:/usr/local/server/ntoccbasicapi.jar!/BOOTINF/lib/ntocccommon1.0SNAPSHOT.jar!/com/arpa/ntocc/common/mapper/ReviewProcessMapper.class]:UnsatisfieddependencyexpressedthroughbeanpropertysqlSessionFactory;nestedexceptionisorg.springframework.beans.factory.UnsatisfiedDependencyException:ErrorcreatingbeanwithnamesqlSessionFactorydefinedinclasspathresource[com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]:UnsatisfieddependencyexpressedthroughmethodsqlSessionFactoryparameter0;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:ErrorcreatingbeanwithnamedataSourcedefinedinclasspathresource[com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]:Invocationofinitmethodfailed;nestedexceptioniscom.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorizeTokenService': Unsatisfied dependency expressed through field 'roleService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reviewProcessMapper' defined in URL [jar:file:/usr/local/server/ntocc-basic-api.jar!/BOOT-INF/lib/ntocc-common-1.0-SNAPSHOT.jar!/com/arpa/ntocc/common/mapper/ReviewProcessMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceAutoConfiguration.class]: Invocation of init method failed; nested exception is com.zaxxer.hikari.pool.HikariPoolPoolInitializationException: Failed to initialize pool: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4 com.zaxxer.hikari.pool.HikariPool|throwPoolInitializationException()|ds2 - Exception during pool initialization. com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS12]". ClientConnectionId:98b73b8a-8529-4bc7-8e86-18e42ad04da4

解决方法:到容器内 找到 jdk/jre/lib/security/java.security 文件,找到jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA 罪魁祸首就是 TLSv1, TLSv1.1 去掉这两个即可,使用sed命令,注意更换文件路径。 sed -i 's/TLSv1,//g' /opt/java/openjdk/jre/lib/security/java.security && sed -i 's/TLSv1.1,//g' /opt/java/openjdk/jre/lib/security/java.security