【问题标题】:Error deploying thin jar via xldeploy and jenkins on linux server在 Linux 服务器上通过 xldeploy 和 jenkins 部署瘦 jar 时出错
【发布时间】:2018-04-27 13:54:12
【问题描述】:

我有一个 spring boot/batch 应用程序,它在使用 jenkins 和 xldeploy 部署时抛出错误。它是一个 gradle 应用程序。

当我将它作为胖 jar 直接部署在服务器上时,它工作正常,但是当我通过 jenkins 和 xldeploy 部署该 jar 时,它给了我以下错误。

在类路径中定义名称为“jobOperator”的 bean 创建错误 资源 [com/one/RetirementConversionImport/standalone/BatchConfiguration.class]: bean初始化失败;嵌套异常是 org.springframework.aop.framework.AopConfigException:不能 生成类的CGLIB子类[class com.one.RetirementConversionImport.standalone.BatchConfiguration$1]: 此问题的常见原因包括使用最终类或 不可见的类;嵌套异常是 org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 com.paychex.RetirementConversionImport.standalone.RetirementConversionImport.main(RetirementConversionImport.java:85) [RetirementConversionImport.jar:?] 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] 在 java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] 在 org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.4.2.RELEASE.jar:1.4.2.RELEASE] 原因: org.springframework.aop.framework.AopConfigException:不能 生成类的CGLIB子类[class com.paychex.RetirementConversionImport.standalone.BatchConfiguration$1]: 此问题的常见原因包括使用最终类或 不可见的类;嵌套异常是 org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null

【问题讨论】:

    标签: linux spring spring-boot jar spring-batch


    【解决方案1】:

    根本原因是类路径中有 spring-boot-devtools。删除 devtools 解决了这个问题。所以基本上在这种情况下,问题出在 AOP 代理上。出于某种原因,我们必须关闭 AOP 代理,这将确保它使用 JDK 代理,这可以通过删除 spring-boot-devtools jar 来完成, 删除它会启动它以使用本机 JDK 代理并修复此错误。

    【讨论】:

      猜你喜欢
      • 2018-09-04
      • 1970-01-01
      • 2018-06-29
      • 2014-02-08
      • 2016-04-18
      • 2011-08-26
      • 1970-01-01
      • 1970-01-01
      • 2020-03-20
      相关资源
      最近更新 更多