CXF和JBoss 6.4:两个类具有相同的XML类型名称

时间:2018-01-24 12:41:39

标签: web-services jboss cxf

在将我的CXF项目部署到JBoss EAP 6.4时遇到了一个问题,其他人似乎并不知道这个问题。

我尝试部署时收到以下堆栈跟踪:

14:02:08,701 ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 119) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AdminServices': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
    (snip)
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
    (snip)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
    at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:329) [cxf-rt-databinding-jaxb-3.1.13.jar:3.1.13]
    at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) [cxf-core-3.1.13.jar:3.1.13]
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:470) [cxf-rt-wsdl-3.1.13.jar:3.1.13]
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:696) [cxf-rt-frontend-jaxws-3.1.13.jar:3.1.13]
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:530) [cxf-rt-wsdl-3.1.13.jar:3.1.13]
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263) [cxf-rt-wsdl-3.1.13.jar:3.1.13]
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) [cxf-rt-frontend-jaxws-3.1.13.jar:3.1.13]
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) [cxf-rt-frontend-simple-3.1.13.jar:3.1.13]
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) [cxf-rt-frontend-simple-3.1.13.jar:3.1.13]
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) [cxf-rt-frontend-jaxws-3.1.13.jar:3.1.13]
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) [cxf-rt-frontend-jaxws-3.1.13.jar:3.1.13]
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) [cxf-rt-frontend-jaxws-3.1.13.jar:3.1.13]
    ... 32 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 208 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://app.application.com/adminServices}addCatalog". Use @XmlType.name and @XmlType.namespace to assign different names to them.

(样品)

Two classes have the same XML type name "{http://app.application.com/adminServices}updateQuantityAllocationResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
    at com.jason.app.control.jaxws_asm.UpdateQuantityAllocationResponse
this problem is related to the following location:
    at com.jason.app.adminservices.UpdateQuantityAllocationResponse
    at public javax.xml.bind.JAXBElement com.jason.app.adminservices.ObjectFactory.createUpdateQuantityAllocationResponse(com.jason.app.adminservices.UpdateQuantityAllocationResponse)
    at com.jason.app.adminservices.ObjectFactory

我不认识com.jason.app.control.jaxws_asm包,它在我正在部署的EAR文件中不存在。这对我来说意味着JBoss正在做某事,但我不知道是什么。

我的jboss-deployment-structure.xml很简单,只排除了内置的webservices子系统,因为我使用的是更现代的CXF版本。

<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>    <deployment>        <exclude-subsystems>            <subsystem name="webservices" />        </exclude-subsystems>   </deployment> </jboss-deployment-structure>

我对这个问题感到非常难过。如果有人可以提供帮助,我将不胜感激。如果需要,我会发布更多信息。

1 个答案:

答案 0 :(得分:0)

我假设您已定义此类: at com.jason.app.adminservices.UpdateQuantityAllocationResponse

在你的WS中,你可能有一个方法包含这样的东西: @WebMethod //在WS中作为操作公开 @ResponseWrapper(localName =“ UpdateQuantityAllocation ”)//这是响应中的包装元素

CXF / JAXB生成此类: at com.jason.app.control.jaxws_asm.UpdateQuantityAllocation 响应

因此,您最终得到了两个具有相同名称的类。