webservices 在main函数中运行webservices服务

Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException

at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:350)

at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)

at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:144)

at javax.xml.ws.Endpoint.publish(Endpoint.java:170)

at cn.com.ws.SoapServices.main(SoapServices.java:8)

Caused by: org.apache.cxf.service.factory.ServiceConstructionException

at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:292)

at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)

at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:438)

at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:682)

at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:501)

at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)

at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)

at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)

at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)

at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:202)

at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:433)

at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:322)

... 4 more

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions

Class has two properties of the same name "age"

this problem is related to the following location:

at public int cn.com.ws.Customers.getAge()

at cn.com.ws.Customers

at private cn.com.ws.Customers cn.com.ws.jaxws_asm.SelectLongNameStudent.arg0

at cn.com.ws.jaxws_asm.SelectLongNameStudent

this problem is related to the following location:

at public int cn.com.ws.Customers.age

at cn.com.ws.Customers

at private cn.com.ws.Customers cn.com.ws.jaxws_asm.SelectLongNameStudent.arg0

at cn.com.ws.jaxws_asm.SelectLongNameStudent

Class has two properties of the same name "name"

this problem is related to the following location:

at public java.lang.String cn.com.ws.Customers.getName()

at cn.com.ws.Customers

at private cn.com.ws.Customers cn.com.ws.jaxws_asm.SelectLongNameStudent.arg0

at cn.com.ws.jaxws_asm.SelectLongNameStudent

this problem is related to the following location:

at public java.lang.String cn.com.ws.Customers.name

at cn.com.ws.Customers

at private cn.com.ws.Customers cn.com.ws.jaxws_asm.SelectLongNameStudent.arg0

at cn.com.ws.jaxws_asm.SelectLongNameStudent

at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)

at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)

at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)

at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)

at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)

at org.apache.cxf.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:258)

at org.apache.cxf.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:167)

at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:418)

at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:290)

... 15 more


刚开始接触,也不知道怎么回事,我把customers中的属性改成private修饰就可以了.不解

ps:附件中的代码要执行的话,还要加入cxf项目中lib下面的所有包

猜你喜欢

转载自gengen201314.iteye.com/blog/1189716