我正在尝试执行以下脚本:Example 35.18. Choice Occurrence Constraints
我在示例中编写了完全相同的代码:
@XmlType(name = "ClubEvent", propOrder = {
"memberNameOrGuestName"
})
public class ClubEvent {
@XmlElementRefs({
@XmlElementRef(name = "GuestName", type = JAXBElement.class),
@XmlElementRef(name = "MemberName", type = JAXBElement.class)
})
protected List<JAXBElement<String>> memberNameOrGuestName;
public List<JAXBElement<String>> getMemberNameOrGuestName() {
if (memberNameOrGuestName == null) {
memberNameOrGuestName = new ArrayList<JAXBElement<String>>();
}
return this.memberNameOrGuestName;
}
}
但是当我尝试启动我的Spring Boot应用程序时,我有一个错误:
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: can't parse argument number: ''{0}''
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
at it.uirnet.pcso.adapter.apiservicemanager.configuration.WebServiceConfig.endpoint(WebServiceConfig.java:83)
at it.uirnet.pcso.adapter.apiservicemanager.configuration.WebServiceConfig$$EnhancerBySpringCGLIB$$7b1da06a.CGLIB$endpoint$2(<generated>)
at it.uirnet.pcso.adapter.apiservicemanager.configuration.WebServiceConfig$$EnhancerBySpringCGLIB$$7b1da06a$$FastClassBySpringCGLIB$$5cfa9528.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at it.uirnet.pcso.adapter.apiservicemanager.configuration.WebServiceConfig$$EnhancerBySpringCGLIB$$7b1da06a.endpoint(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
我的项目正在使用带有Apache CXF 3.2.7的Spring Boot。在配置类中,这是例如端点的代码:
@Bean(name = "ship")
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus(), new ShipImpl(shipDAO, callerDAO));
endpoint.publish("/ship");
return endpoint;
}