【问题标题】:JBoss Migration 5 EAP to 7 EAP Error with IllegalAnnotationsException XML Binding带有 IllegalAnnotationsException XML 绑定的 JBoss 迁移 5 EAP 到 7 EAP 错误
【发布时间】:2018-08-20 08:24:19
【问题描述】:

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

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

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

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-deployment-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 吗?如果是,我该怎么办。

有人可以请教吗?提前致谢

【问题讨论】:

  • 尝试将org.apache.cxf.jaxb 版本更新为包含jboss eap 7.1 的版本,这可能会解决您的注释问题。
  • 您也可以尝试重构代码:@XmlRootElement(name = "fields") @XmlAccessorType(XmlAccessType.FIELD) public class Xyz { @XmlElement(name = "field") List&lt;Field&gt; fields = new ArrayList&lt;Field&gt;(); 添加这些注释也有助于解决问题。
  • @SwetaPatra 感谢您的建议。我已经更新了 org.apache.cxf.jaxb 但没有运气,将尝试重新分解代码,但这样做需要很多时间,因为 xml 映射代码是从 schema 生成的。您对此有什么其他建议吗?

标签: jboss jax-ws redhat jboss-eap-7


【解决方案1】:

我现在用https://developer.jboss.org/thread/274491解决了这个问题

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-10
    • 2018-09-16
    • 2021-02-22
    • 2018-01-31
    • 1970-01-01
    • 2021-08-26
    • 2017-06-24
    • 1970-01-01
    相关资源
    最近更新 更多