mfkl0101 2023-04-15 12:28 采纳率: 0%
浏览 27

SpringBoot项目部署到linux上报错,如何解决?

本地打成jar包运行没有问题,上传到linux服务器后报错


```java
[root@localhost canchenkeji]# java -jar ruoyi-admin.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::               (v2.5.14)

11:46:25.764 [main] INFO  c.r.RuoYiApplication - [logStarting,55] - Starting RuoYiApplication using Java 1.8.0_121 on localhost.localdomain with PID 36049 (/data/opt/canchenkeji/ruoyi-admin.jar started by root in /data/opt/canchenkeji)
11:46:25.784 [main] DEBUG c.r.RuoYiApplication - [logStarting,56] - Running with Spring Boot v2.5.14, Spring v5.3.20
11:46:25.774 [background-preinit] INFO  o.h.v.i.util.Version - [<clinit>,21] - HV000001: Hibernate Validator 6.2.3.Final
11:46:25.816 [main] INFO  c.r.RuoYiApplication - [logStartupProfileInfo,686] - The following 1 profile is active: "druid"
11:46:46.024 [main] INFO  o.a.c.h.Http11NioProtocol - [log,173] - Initializing ProtocolHandler ["http-nio-8081"]
11:46:46.028 [main] INFO  o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
11:46:46.030 [main] INFO  o.a.c.c.StandardEngine - [log,173] - Starting Servlet engine: [Apache Tomcat/9.0.63]
11:46:46.806 [main] INFO  o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
^[[19~11:46:52.856 [main] DEBUG c.r.f.s.f.JwtAuthenticationTokenFilter - [init,242] - Filter 'jwtAuthenticationTokenFilter' configured for use
11:47:10.029 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - [refresh,591] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxApiWXPayController': Unsatisfied dependency expressed through field 'wxPayService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxApiWXPayServiceImpl': Unsatisfied dependency expressed through field 'wxPayClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getWxPayClient' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.impl.client.CloseableHttpClient]: Factory method 'getWxPayClient' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
11:47:10.041 [main] INFO  c.a.d.p.DruidDataSource - [close,2138] - {dataSource-0} closing ...
11:47:10.204 [main] INFO  o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
11:47:10.766 [main] ERROR o.s.b.SpringApplication - [reportFailure,870] - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxApiWXPayController': Unsatisfied dependency expressed through field 'wxPayService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxApiWXPayServiceImpl': Unsatisfied dependency expressed through field 'wxPayClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getWxPayClient' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.impl.client.CloseableHttpClient]: Factory method 'getWxPayClient' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:453)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1370)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1359)
    at com.ruoyi.RuoYiApplication.main(RuoYiApplication.java:21)
    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.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxApiWXPayServiceImpl': Unsatisfied dependency expressed through field 'wxPayClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getWxPayClient' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.impl.client.CloseableHttpClient]: Factory method 'getWxPayClient' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
    ... 28 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getWxPayClient' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.impl.client.CloseableHttpClient]: Factory method 'getWxPayClient' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)
    ... 42 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.http.impl.client.CloseableHttpClient]: Factory method 'getWxPayClient' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 55 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getVerifier' defined in class path resource [com/ruoyi/canchen/utils/WxPayConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:362)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916.getVerifier(<generated>)
    at com.ruoyi.canchen.utils.WxPayConfig.getWxPayClient(WxPayConfig.java:117)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916.CGLIB$getWxPayClient$4(<generated>)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916$$FastClassBySpringCGLIB$$f069e1ff.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916.getWxPayClient(<generated>)
    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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 56 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.wechat.pay.contrib.apache.httpclient.auth.Verifier]: Factory method 'getVerifier' threw exception; nested exception is java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 79 common frames omitted
Caused by: java.lang.IllegalArgumentException: java.security.InvalidKeyException: Illegal key size
    at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:47)
    at com.wechat.pay.contrib.apache.httpclient.util.CertSerializeUtil.deserializeToCerts(CertSerializeUtil.java:42)
    at com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager.downloadAndUpdateCert(CertificatesManager.java:267)
    at com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager.initCertificates(CertificatesManager.java:295)
    at com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager.putMerchant(CertificatesManager.java:152)
    at com.ruoyi.canchen.utils.WxPayConfig.getVerifier(WxPayConfig.java:95)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916.CGLIB$getVerifier$3(<generated>)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916$$FastClassBySpringCGLIB$$f069e1ff.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at com.ruoyi.canchen.utils.WxPayConfig$$EnhancerBySpringCGLIB$$96437916.getVerifier(<generated>)
    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.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 80 common frames omitted
Caused by: java.security.InvalidKeyException: Illegal key size
    at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
    at javax.crypto.Cipher.implInit(Cipher.java:805)
    at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
    at javax.crypto.Cipher.init(Cipher.java:1396)
    at javax.crypto.Cipher.init(Cipher.java:1327)
    at com.wechat.pay.contrib.apache.httpclient.util.AesUtil.decryptToString(AesUtil.java:40)
    ... 95 common frames omitted


```

  • 写回答

3条回答 默认 最新

  • pzzhao 2023-04-16 14:23
    关注

    最终报错是 Illegal key size ,你这个是不是用到了微信的AES 解密,这个最简单的办法就是 你把jdk版本升级一下就行了

    评论 编辑记录

报告相同问题?

问题事件

  • 创建了问题 4月15日

悬赏问题

  • ¥20 WPF MVVM模式 handycontrol 框架, hc:SearchBar 控件 Text="{Binding NavMenusKeyWords}" 绑定取不到值
  • ¥15 需要手写数字信号处理Dsp三个简单题 不用太复杂
  • ¥15 数字信号处理考试111
  • ¥100 关于#audobe audition#的问题,如何解决?
  • ¥15 allegro17.2生成bom表是空白的
  • ¥15 请问一下怎么打通CAN通讯
  • ¥20 如何在 rocky9.4 部署 CDH6.3.2?
  • ¥35 navicat将excel中的数据导入mysql出错
  • ¥15 rt-thread线程切换的问题
  • ¥15 高通uboot 打印ubi init err 22