Java 发布用于在数据库中插入和搜索数据的web服务时出错
首先,我为简单的get和set方法创建了一个webservice,并成功地发布了该web服务。之后,我创建了一个WebDevice,它有使用jdbc连接从oracle数据库插入和搜索数据的方法,但是当我试图发布这个web服务时,我遇到了以下错误Java 发布用于在数据库中插入和搜索数据的web服务时出错,java,web-services,jax-ws,jax-rpc,Java,Web Services,Jax Ws,Jax Rpc,首先,我为简单的get和set方法创建了一个webservice,并成功地发布了该web服务。之后,我创建了一个WebDevice,它有使用jdbc连接从oracle数据库插入和搜索数据的方法,但是当我试图发布这个web服务时,我遇到了以下错误 Exception in thread "main" Server Runtime Error: javax.xml.ws.WebServiceException at com.sun.xml.internal.ws.transport.
Exception in thread "main" Server Runtime Error: javax.xml.ws.WebServiceException
at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
at javax.xml.ws.Endpoint.publish(Unknown Source)
at com.bizmonks.services.BizMonksWSPublish.main(BizMonksWSPublish.java:10)
Caused by: javax.xml.ws.WebServiceException
at com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModel.postProcess(Unknown Source)
at com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(Unknown Source)
at com.sun.xml.internal.ws.server.RuntimeEndpointInfo.createSEIModel(Unknown Source)
at com.sun.xml.internal.ws.server.RuntimeEndpointInfo.init(Unknown Source)
at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source)
... 5 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
java.sql.Connection is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at java.sql.Connection
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModel$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 11 more
你能帮帮我吗?我无法找出我做错了什么。提前感谢。您应该注意异常的原因,这可能就是问题所在。@Omoro是的,您是对的,事实上我尝试了很多次,但无法确定此错误的原因。