JBoss 将 5 EAP 迁移到 7 EAP 时出现 IllegalAnnotationsException XML 绑定错误

JBoss Migration 5 EAP to 7 EAP Error with IllegalAnnotationsException XML Binding

我目前正在 JBoss 从 EAP 5.0.0 迁移到 EAP 7.1.0 我的项目结构是

AAA.ear 
-- AAA-ejb.jar
-- AAA-soap.jar
    -- /**-mapping.xml
-- lib

目前,当我尝试仅使用 AAA-ejb.jar 依赖项部署 AAA.ear 时,它不会出现任何错误。 但是对于 AAA-ejb.jar 和 AAA-soap.jar 都有关于 XML binding

的错误日志
2018-08-20 11:53:55,565 INFO  [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-2) Creating Service {http://www.abcd.co.com/wsdl/AImplementation/subscription/subscription-soap11http/v1}Subscription-SOAP11HTTP-v1 from WSDL: META-INF/wsdl/Subscription-SOAP11HTTP.wsdl
2018-08-20 11:53:55,672 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."AAA.ear"."AAA-soap.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."AAA.ear"."AAA-soap.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "AAA-soap.jar" of deployment "AAA.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
    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:235)
    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:165)
    ... 5 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
    at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:329)
    at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103)
    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: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 12 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://www.abcd.co.com/schema/bus/money/money/v1}InvestmentTypeType". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at com.co.abcd.subscriptionv1.schema.bus.money.money.InvestmentTypeType
        at protected com.co.abcd.subscriptionv1.schema.bus.money.money.InvestmentTypeType com.co.abcd.subscriptionv1.schema.bus.subscription.subscription.SubscriptionByInvestmentTypeType.investmentType
        at com.co.abcd.subscriptionv1.schema.bus.subscription.subscription.SubscriptionByInvestmentTypeType
        at public com.co.abcd.subscriptionv1.schema.bus.subscription.subscription.SubscriptionByInvestmentTypeType com.co.abcd.subscriptionv1.schema.bus.subscription.subscription.ObjectFactory.createSubscriptionByInvestmentTypeType()
        at com.co.abcd.subscriptionv1.schema.bus.subscription.subscription.ObjectFactory
    this problem is related to the following location:
        at com.co.abcd.schema.bus.money.money.v1.InvestmentTypeType
        at protected com.co.abcd.schema.bus.money.money.v1.InvestmentTypeType com.co.abcd.schema.bus.account.account.v1.ValuationByMoneyType.investmentType
        at com.co.abcd.schema.bus.account.account.v1.ValuationByMoneyType
        at protected java.util.List com.co.abcd.schema.bus.account.account.v1.ValuationByMoneyListType.valuationByMoney
        at com.co.abcd.schema.bus.account.account.v1.ValuationByMoneyListType
        at protected com.co.abcd.schema.bus.account.account.v1.ValuationByMoneyListType com.co.abcd.schema.bus.account.account.v1.ProductHoldingInstanceType.valuationByMoneyList
        at com.co.abcd.schema.bus.account.account.v1.ProductHoldingInstanceType
        at protected java.util.List com.co.abcd.schema.bus.account.account.v1.ProductHoldingInstanceListType.productHoldingInstance
        at com.co.abcd.schema.bus.account.account.v1.ProductHoldingInstanceListType
        at public com.co.abcd.schema.bus.account.account.v1.ProductHoldingInstanceListType com.co.abcd.schema.bus.account.account.v1.ObjectFactory.createProductHoldingInstanceListType()
        at com.co.abcd.schema.bus.account.account.v1.ObjectFactory
.
.
.

我目前在 AAA.ear 中的 jboss-部署-structure.xml 是

<jboss-deployment-structure>
    <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
    <deployment>
        <dependencies>
            <module name="org.hibernate" export="true"/>
            <module name="org.jboss.as.system-jmx" export="true"/>
            <module name="org.dom4j" export="true"/>
            <module name="deployment.AAA.ear.AAA-ejb.jar" export="true"/>
            <module name="deployment.AAA.ear.AAA-soap.jar" export="true"/>
        </dependencies>
    </deployment>
    <sub-deployment name="AAA-ejb.jar"> 
    </sub-deployment> 
    <sub-deployment name="AAA-soap.jar">
        <dependencies>
            <module name="deployment.AAA.ear.AAA-ejb.jar" />
        </dependencies>

而且我认识到我的项目可以在 Jboss 5 中使用 JBoss Web Services Native 3.1.2 SP3 成功部署和 运行。 是否因为 JBoss Web 服务更改为 JBossWS 5.1.9 而发生此错误?如果是,我该怎么办

谁能指点一下?提前致谢

我现在用 https://developer.jboss.org/thread/274491

解决了这个问题

碰巧是因为订阅-wsimport.jar(用于生成 WSDL 的 Jar 存根)不再适用于 EAP 7。

所以我尝试用新生成器重新生成存根并再次部署。它没有错误并且 WSDL 服务 运行 成功。