获取错误 java.lang.NoSuchMethodException:org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label)

Getting error java.lang.NoSuchMethodException: org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label)

我有两个项目。一个是 spring mvc 项目,它向活动 mq 发送 JMS 消息,另一个是监听这个活动 mq 并处理它

现在我在两个项目中都使用了 activemq 配置。当我在第一个项目中添加 pom 依赖项时:

<dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-spring</artifactId>
        <version>5.12.0</version>
    </dependency>

现在,当我在 Wildfly 中部署这两个项目时,出现如下错误:

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) [wildfly-server-2.0.10.Final.jar:2.0.10.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.6.Final.jar:1.2.6.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_25]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_25]
    Caused by: javax.xml.ws.WebServiceException: java.lang.reflect.UndeclaredThrowableException
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
    at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:79)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543)
    at org.jboss.wsf.stack.cxf.configuration.BusHolder.configure(BusHolder.java:234)
    at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:97)
    at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:59)
    at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) [wildfly-server-2.0.10.Final.jar:2.0.10.Final]
    ... 5 more
    Caused by: java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy31.visitLabel(Unknown Source)
    at org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassGenerator.java:213)
    at org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.java:122)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanClass(JaxWsServiceFactoryBean.java:675)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:645)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:461)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:696)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168)
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460)
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338)
    ... 13 more
    Caused by: java.lang.NoSuchMethodException: org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label)
    at java.lang.Class.getMethod(Unknown Source) [rt.jar:1.8.0_25]
    at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:85)
    ... 28 more

但是如果没有这种依赖性,这两个应用程序 运行 都可以。那么这个错误是什么,我该如何解决呢?

在我看来,你的包中有一个 asm 依赖项,JBoss 也提供了 asm。版本不同导致的问题。希望对您有所帮助:https://access.redhat.com/solutions/690353