在 Jboss 6.3.0 EAP 中部署 Java WS 时出错

error when deploying Java WS in Jboss 6.3.0 EAP

我正在将带有 Java WS 的应用程序从 Jboss 5.1.0 迁移到 Jboss 6.3.0 EAP。它适用于 Jboss 5.1.0,但在 Jboss 6.3.0 EAP 中部署时出现错误。

14:42:10,887 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deploy
ment.unit."my-app.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."dtm-banking.
war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "dtm-banking.war"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-a
s-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-ms
c-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.F
inal-redhat-1.jar:1.1.5.Final-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
Caused by: javax.xml.ws.WebServiceException: java.lang.reflect.UndeclaredThrowableException
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371)
        at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:66)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:539)
        at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:118)
        at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:137
)
        at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:69)
        at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-a
s-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        ... 5 more
Caused by: java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy371.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:6
83)
        at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:653)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBea
n.java:484)
        at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBe
an.java:550)
        at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
        at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
        at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java
:102)
        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
        at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
        at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
        ... 13 more
Caused by: java.lang.NoSuchMethodException: org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label)
        at java.lang.Class.getMethod(Class.java:1665) [rt.jar:1.7.0_60]
        at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:85)
        ... 28 more

我了解 Jboss 6.3.0 EAP 使用 CXF 实现 web 服务,但我正在寻找简单的 Java WS 来使用标准 Java EE 环境。

在 jboss-部署-structure.xml

中尝试了以下操作
<exclude-subsystems>
    <subsystem name="webservices" />
</exclude-subsystems>

这消除了部署时的异常,但在调用服务的 wsdl 时出现类播异常

http://localhost:8080/myapp/myservice?wsdl

JBWEB000235:为 servlet MyWebService 分配异常:java.lang.ClassCastException:com.example.webservice.endpoint.DataService 无法转换为 javax.servlet.Servlet

有什么想法吗?

问题是在您的部署中捆绑 asm.jar
尝试将其删除并将其添加到您的 jboss-deployment-structure.xml:

<jboss-deployment-structure>
    <deployment>
       <dependencies>
            ...
            <module name="asm.asm" />
            ...
        </dependencies>
    </deployment>
</jboss-deployment-structure>

查看更多:https://developer.jboss.org/message/823745

The answer 为我解决的问题是:

I had the same problem. Adding jboss-deployment-structure.xml only work for WAR files. If I depolyed the WAR inside an EAR I got the error back. So I added

  <global-modules>
    <module name="asm.asm" slot="main"/>
  </global-modules>

to the current jboss configuration, ie standalone-full.xml The it work fine for me.

因此,如果有人偶然发现了这个问题,请试一试。

也查看此页面。 https://access.redhat.com/solutions/690353

The above Error is thrown when for given class particular method not found. Hence user is packaging asm jar in their application and class "org.objectweb.asm.MethodWriter" which contains in a jar does not have method "public void visitLabel(org.objectweb.asm.Label);" hence getting "java.lang.NoSuchMethodException".