分类: 未分类

  • springboot使用mvn打包时应用不同的配置

    首先需要准备以下几个配置文件:

    application.yml(默认配置)

    application-dev.yml(开发环境配置)

    application-prof.yml(生产环境配置)

    application.yml中必须包含以下配置,否则不生效:

    spring:
      profiles:
        active: @profiles.active@

    并且在pom.xml文件中的project节点内增加以下配置:

    <!--设置不同的环境配置文件-->
    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <profiles.active>dev</profiles.active>
            </properties>
            <!--设置当前的配置为默认配置-->
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <profiles.active>prod</profiles.active>
            </properties>
        </profile>
    </profiles>

    最后使用以下命令来指定配置文件打包即可(-P后面接的是配置文件的id):

    mvn clean package -P prof

  • 一个最基础的gitlab自动编译vue项目并发布到docker的ci配置

    # This file is a template, and might need editing before it works on your project.
    # This is a sample GitLab CI/CD configuration file that should run without any modifications.
    # It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
    # it uses echo commands to simulate the pipeline execution.
    #
    # A pipeline is composed of independent jobs that run scripts, grouped into stages.
    # Stages run in sequential order, but jobs within stages run in parallel.
    #
    # For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
    #
    # You can copy and paste this template into a new `.gitlab-ci.yml` file.
    # You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
    #
    # To contribute improvements to CI/CD templates, please follow the Development guide at:
    # https://docs.gitlab.com/ee/development/cicd/templates.html
    # This specific template is located at:
    # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
    
    stages:          # List of stages for jobs, and their order of execution.
      - build
    #  - test
      - deploy
    
    build-job:       # This job runs in the build stage, which runs first.
      stage: build
      script:
        - echo "Compiling the code..."
        - npm install
        - npm run build
        - docker build -t yuexi_admin .
        - echo "Compile complete."
    
    #unit-test-job:   # This job runs in the test stage.
    #  stage: test    # It only starts when the job in the build stage completes successfully.
    #  script:
    #    - echo "Running unit tests... This will take about 60 seconds."
    #    - sleep 60
    #    - echo "Code coverage is 90%"
    
    #lint-test-job:   # This job also runs in the test stage.
    #  stage: test    # It can run at the same time as unit-test-job (in parallel).
    #  script:
    #    - echo "Linting code... This will take about 10 seconds."
    #    - sleep 10
    #    - echo "No lint issues found."
    
    deploy-job:      # This job runs in the deploy stage.
      stage: deploy  # It only runs when *both* jobs in the test stage complete successfully.
      environment: production
      script:
        - echo "Deploying application..."
        - docker stop yuexi_admin
        - docker rm yuexi_admin
        - docker run -d -p 8611:80 --name yuexi_admin yuexi_admin
        - echo "Application successfully deployed."
  • 使用gitlab跑ci时报fatal: git fetch-pack: expected shallow list

    解决方法,修改gitlab的cicd配置,如下图所示:

  • 使用gilab-ci运行docker命令时报Got permission denied权限错误的问题

    如上图所示,报了权限错误。

    方法一:临时修改权限(重启后会失效)

    是将/var/run/docker.sock的权限设置为666,如下图所示:

    方法二:将当前用户组授权到docker中

    先查看原来的docker用户组的情况:

    cat /etc/group | grep docker

    应该会如下图所示:

    然后使用以下指令将需要权限的用户($USER为当前登录的用户,如果是gitlab-runner执行则要替换成gitlab-runner用户)加入到docker组:

    sudo gpasswd -a $USER docker

    执行后再次使用cat命令查看情况,正常来说会如下图所示:

    然后使用 service docker restart 命令重启docker即可。

  • Centos7安装Sonarqube7.8

    能运行在JDK8和MySQL环境下的最高sonarqube版本是7.8,版本在7.9以上的都要安装jdk11和PostgreSQL了。

    下载

    到https://www.sonarqube.org/downloads/网站下载历史版本7.8的zip压缩包,

    配置

    数据库链接

    打开sonar目录的/conf/sonar.properties文件,找到并配置:

    # User credentials.
    # Permissions to create tables, indices and triggers must be granted to JDBC user.
    # The schema must be created first.
    sonar.jdbc.username=
    sonar.jdbc.password=
    
    #----- Embedded Database (default)
    # H2 embedded database server listening port, defaults to 9092
    #sonar.embeddedDatabase.port=9092
    
    #----- DEPRECATED 
    #----- MySQL >=5.6 && <8.0
    # Support of MySQL is dropped in Data Center Editions and deprecated in all other editions
    # Only InnoDB storage engine is supported (not myISAM).
    # Only the bundled driver is supported. It can not be changed.
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
    

    请在启动前提前创建好对应的数据库。

    创建用户 Sonarqube并设为启动账户

    # 创建用户
    useradd sonar
    # 配置密码
    passwd sonar
    # 将目录权限给予该用户
    chown -R sonar:sonar /home/sonarqube-7.8

    编辑sonar安装目录的/bin/linux-x86-64/sonar.sh文件,修改用户为sonar

    # If specified, the Wrapper will be run as the specified user.
    # IMPORTANT - Make sure that the user has the required privileges to write
    #  the PID file and wrapper.log files.  Failure to be able to write the log
    #  file will cause the Wrapper to exit without any way to write out an error
    #  message.
    # NOTE - This will set the user which is used to run the Wrapper as well as
    #  the JVM and is not useful in situations where a privileged resource or
    #  port needs to be allocated prior to the user being changed.
    RUN_AS_USER=sonar

    启动Sonarqube

    直接执行 /home/sonarqube-7.8/bin/linux-x86-64/sonar.sh console 就可以启动 Sonarqube ,并且直观的看到启动日志,建议调试期间使用该命令启动。

    等调试结束,启动完全没问题了,就可以使用 ./sonar.sh console & 来实现后台运行,或者直接 ./sonar.sh start 来快速启动。

    查看日志

    Sonarqube 的日志目录位于 /home/sonarqube-7.8/log/ 目录,分别有:

    • access.log 访问权限相关日志
    • ce.log 不知道啥日志,应该没用
    • sonar.log 主体日志,使用 console 命令启动输出的日志来自该文件
    • es.log 依赖的 Elasticsearch 启动时输出的日志
    • web.log 主体 Web 项目输出的日志

    在配置 Sonarqube 时,集中关注 es.log 和 web.log 即可。

    sonarQube安装中文插件

    访问中文插件的网址并查看对应sonar版本的中文插件版本:https://github.com/xuhuisheng/sonar-l10n-zh

    对应sonar7.8的是这个链接:https://github.com/xuhuisheng/sonar-l10n-zh/releases/tag/sonar-l10n-zh-plugin-1.28

    下载对应的jar文件:

    然后将jar包上传到自己sonar项目安装的extensions/plugins/下,并重启sonarqube即可。

    其他

    sonar的默认端口是9000,默认账号和密码是admin。

  • Centos7使用yum安装gitlab-ce并安装git-runner、升级gitlab

    安装gitlab-ce

    一、设置国内yum源

    新建 /etc/yum.repos.d/gitlab-ce.repo,内容为:

    [gitlab-ce]
    name=Gitlab CE Repository
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
    gpgcheck=0
    enabled=1
    

    其实这步可选,不设置的话,默认用国外源的话会非常慢。

    二、安装gitlab-ce

    sudo yum makecache
    sudo yum install gitlab-ce

    三、启动gitlab

    先运行配置命令:

    gitlab-ctl reconfigure

    然后运行相关的启动命令:

    gitlab-ctl start
    gitlab-ctl restart
    gitlab-ctl stop

    四、打开gitlab面板

    默认端口是8088

    ——————————————————————————

    安装gitlan-runner

    runner我们选择装直接装在宿主机上,不推荐装在docker里

    一、查看已安装的gitlab版本

    打开web面板的help页面即可看到。

    二、查看可安装的gitlab-runner版本

    # 添加正式的GitLab存储库
    curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
    # 查询GitLab版本号列表
    yum list gitlab-runner --showduplicates | sort -r

    三、安装对应版本的gitlab-runner

    # 安装特定版本的GitLab Runner(镜像在国外需要梯子或者切换阿里的镜像)
    yum install gitlab-runner-14.5.1-1

    注意:如果跟gitlab的版本差异太大,则可能存在未知异常。

    四、运行并管理runner

    gitlab-runner start    启动gitlab-runner
    gitlab-runner stop     关闭gitlab-runner
    gitlab-runner restart  重启gitlab-runner 
    gitlab-runner status   查看gitlab-runner状态,当服务正在运行时,退出代码为零,而当服务未运行时,退出代码为非零。

    五、注册runner

    gitlab-runner register

    相关注册解释:

    • Enter the GitLab instance URL (for example, https://gitlab.com/): ===>填gitlab的地址
    • Enter the registration token: ===> 填gitlab上注册runner时提示的token
    • Enter a description for the runner: ===>填写runner的描述(可为空)
    • Enter tags for the runner (comma-separated): ===> 填写runner的标签(后面需要用到,一般跟项目的名称一直)
    • Enter optional maintenance note for the runner: ===> 填写可维护说明(可为空)
    • Enter an executor: docker, docker-ssh, custom, parallels, shell, ssh, virtualbox, docker+machine, docker-ssh+machine, instance, kubernetes: ===>填写执行器,一般为shell

    六、注销相关命令

    gitlab-runner  register     #默认交互模式下使用,非交互模式天机--non-interactice
    gitlab-runner  list         #命令列出保存在配置文件中的所有运行程序
    gitlab-runner verify   #检查注册runner十分是否可以连接,但不验证gitlab服务是否正在使用runner.--delete删除
    gitlab-runner unregister #该命令使用gitlablab取消以及已注册的runner
    
    #使用令牌注销
    gitlab-runner unregister--url http://gitlab.example.com/--tokentok3n
    
    #使用名称注销(同名删除一个)
    gtlab-runner  unregister --name test-runner
    
    #注销所有
    gitlab-runner   unregister --all-runners

    七、其他疑问

    提示:此作业已阻塞,因为该项目没有分配任何可用Runner。

    解决方法一:在.gitlab-ci.yml中补充对应的runner-tag的名称

    解决方法二:设置runner可执行没有标签的作业:

    20221201190512

    —————————————————————–

    升级gitlab

    到gitlab官网查看最佳升级路径:

    https://docs.gitlab.com/ee/update/index.html#upgrade-paths

    https://docs.gitlab.com/ee/update/index.html#upgrade-paths

    yum install gitlab-ce-<version>
  • 微信支付平台证书返回解密方法封装

    废话不多说,直接上代码:

    package com.isuidian.util;
    
    import java.io.IOException;
    import java.security.*;
    import java.util.Base64;
    
    import javax.crypto.Cipher;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.spec.GCMParameterSpec;
    import javax.crypto.spec.SecretKeySpec;
    
    public class WechatStaticUtil {
    
        private static final int KEY_LENGTH_BYTE = 32;
        private static final int TAG_LENGTH_BIT = 128;
    
        public static String decryptToString(byte[] apiV3Key, byte[] associatedData, byte[] nonce, String ciphertext) throws GeneralSecurityException, IOException {
    
            if (apiV3Key.length != KEY_LENGTH_BYTE) {
                throw new IllegalArgumentException("无效的ApiV3Key,长度必须为32个字节");
            }
    
            try {
                Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
    
                SecretKeySpec key = new SecretKeySpec(apiV3Key, "AES");
                GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce);
                cipher.init(Cipher.DECRYPT_MODE, key, spec);
                cipher.updateAAD(associatedData);
    
                return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8");
            } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
                throw new IllegalStateException(e);
            } catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
                throw new IllegalArgumentException(e);
            }
        }
    
    }
    

     

     

  • NoSuchMethodError kotlin.collections.ArraysKt.copyInto([B[BIII)[B

    查了网络资料,大概原因就是:springboot版本跟okhttp的jar包冲突,因此提示调用的方法没有。

    解决方法:

    方法一:(已验证)

    指定kotlib-stdlib的版本,在pom中加入如下依赖:

    <!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib -->
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>1.3.70</version>
    </dependency>

    方法二:(未验证)

    把okhttp3的4.x版本改成3.x版本:

            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>3.14.8</version>
            </dependency>

     

  • JDK的AES加密异常java.security.InvalidKeyException: Illegal key size 的解决方法

    今天在调用获取微信支付平台证书V3接口时,需要对其内容进行解密。根据官方的demo如下:

    static final int KEY_LENGTH_BYTE = 32;
    	static final int TAG_LENGTH_BIT = 128;
    
    	public String decryptToString(byte[] apiV3Key, byte[] associatedData, byte[] nonce, String ciphertext) throws GeneralSecurityException, IOException {
    
    		if (apiV3Key.length != KEY_LENGTH_BYTE) {
    			throw new IllegalArgumentException("无效的ApiV3Key,长度必须为32个字节");
    		}
    
    		try {
    			Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
    
    			SecretKeySpec key = new SecretKeySpec(apiV3Key, "AES");
    			GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce);
    
    			cipher.init(Cipher.DECRYPT_MODE, key, spec);
    			cipher.updateAAD(associatedData);
    
    			return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8");
    		} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
    			throw new IllegalStateException(e);
    		} catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
    			throw new IllegalArgumentException(e);
    		}
    	}

    发现执行到 cipher.init(Cipher.DECRYPT_MODE, key, spec); 的时候报 java.security.InvalidKeyException: Illegal key size 错误。

    经过资料查阅,得出原因如下:

    JDK受版本安全限制,默认只允许128位长度以内的。秘钥长度,如果密钥大于128, 会抛出java.security.InvalidKeyException: Illegal key size 异常. java运行时环境默认读到的是受限的policy文件. 文件位于${java_home}/jre/lib/security, 这种限制是因为美国对软件出口的控制所造成的的.JDK1.8之后已经兼容了该问题。

    解决方案:

    方法一:升级不受限制JDK版本
    升级JDK9级以上版本,未测试

    方法二:替换JDK受限文件级配置
    JDK7的下载地址: Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 Download
    JDK8的下载地址: JCE Unlimited Strength Jurisdiction Policy Files for JDK/JRE 8 Download
    下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt
    如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件
    如果安装了JDK,还要将两个jar文件也放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件

    方法三:JDK1.8 代码策略修改
    JDK1.8 已经支持不受限的jar,但配置默认是受限的
    修改代码配置,在加密之前,修改不受限配置.

    WXBizMsgCrypt wxcpt = createWXBizMsgCrypt(suiteId, getCorpId(postData), false);
    Security.setProperty("crypto.policy", "unlimited");
    sMsg = wxcpt.decryptMsg(msgSignature, timestamp, nonce, postData);

     

  • 在linux下报java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/PKCS12Key的解决方法

    在windows下正常,但是在linux中报了这个错:

    2022-10-15T00:10:14,835 ERROR [http-nio-9969-exec-97] org.springframework.boot.web.servlet.support.E                                                         rrorPageFilter: Forwarding to error page from request [/api/v2/auth/loginByWechatInMp] due to except                                                         ion [org/bouncycastle/jcajce/PKCS12Key]
     java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/PKCS12Key
            at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineInit(Unknown Source                                                         )
            at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineInit(Unknown Source                                                         )
            at javax.crypto.Cipher.init(Cipher.java:1536)
            at javax.crypto.Cipher.init(Cipher.java:1469)
            at com.zero4j.controller.api.v2.AuthControllerV2.wechatDecrypt(AuthControllerV2.java:1166)
            at com.zero4j.controller.api.v2.AuthControllerV2.loginByWechatInMp(AuthControllerV2.java:422                                                         )
            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.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMe                                                         thod.java:189)
            at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableH                                                         andlerMethod.java:138)
            at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invok                                                         eAndHandle(ServletInvocableHandlerMethod.java:102)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invoke                                                         HandlerMethod(RequestMappingHandlerAdapter.java:895)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handle                                                         Internal(RequestMappingHandlerAdapter.java:800)
            at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHa                                                         ndlerMethodAdapter.java:87)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:100                                                         5)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:231)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenS                                                         essionInViewFilter.java:151)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter                                                         .java:99)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:                                                         92)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFi                                                         lter.java:93)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.jav                                                         a:130)
            at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.j                                                         ava:66)
            at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPage                                                         Filter.java:105)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.jav                                                         a:123)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava:193)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
            at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncoding                                                         Filter.java:200)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:10                                                         7)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j                                                         ava: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:493)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
            at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679)
            at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
            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:800)
            at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
            at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
            at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
            at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            at java.lang.Thread.run(Thread.java:748)
    

    解决方法:

    1.查看/etc/profile下JAVA_HOME配置路径,

    如果不存在,使用whereis java命令你会看到java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java

    打开java.conf,找到JAVA_HOME路径

    2.将bcprov-jdkxxx.jar放入JAVA_HOME/jre/lib/ext下

    3.打开JAVA_HOME/jre/lib/security下的java.security文件,在下面加上

    security.provider.x=org.bouncycastle.jce.provider.BouncyCastleProvider

    4.重启服务即可

     

    附带maven仓库的地址:https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15to18/