错误:Exception in thread "Main Thread" java.lang.LinkageError: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/D:/Work/aspire/lib/jaxb-impl-2.2.1.1.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:173)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:456)
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:585)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
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)
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.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:501)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:89)
at cxf.service.Client.main(Client.java:34)
解决方法:
使用System.out.println(System.getProperty("java.endorsed.dirs"));指定的目录面放置的jar文件,将有覆盖系统API的功能。可以牵强的理解为,将自己修改后的API打入到虚拟机指定的启动API中,取而代之。但是能够覆盖的类是用限制的,其中不包括java.lang包中的类,然后把jaxb-api-2.2.1.jar,jaxws-api-2.0.jar放入该目录下的endorsed文件夹下,如果没有就新建一个.
错误二:wsdl文件只暴露服务而没有暴露方法
Exception in thread "Main Thread" org.apache.cxf.binding.soap.SoapFault: Message part {http://service.cxf/}sayHello was not recognized. (Does it exist in service WSDL?)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:104)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:736)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy27.sayHello(Unknown Source)
at cxf.service.Client.main(Client.java:36)
解决方法:把geronimo-ws-metadata_2.0_spec-1.1.3.jar从web-inf/lib下删除
错误三:
Exception in thread "Main Thread" java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:140)
at org.apache.cxf.attachment.AttachmentUtil.<clinit>(AttachmentUtil.java:60)
at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:736)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy27.sayHello(Unknown Source)
at cxf.service.Client.main(Client.java:36)
找到安装MyEclipse目录..\MyEclipse\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.6.0.zmyeclipse660200810\data\libraryset\EE_5下的javaee.jar然后下载activation.jar使用winrar打开,然后把com这个包解压到指定的一个地方,然后再它com这个包增压到javaee.jar中。
错误四:
Exception in thread "Main Thread" org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error: javax/xml/stream/XMLStreamReader
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:104)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:736)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1448)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy27.sayHello(Unknown Source)
at cxf.service.Client.main(Client.java:36)
解决方法:
把jaxb-impl-2.2.1.1.jar,jaxb-api-2.2.1.jar放到web-lib/lib目录下
分享到:
相关推荐
在本教程中,我们将深入探讨如何使用CXF在JBoss和Tomcat这两种流行的Java应用服务器上发布Web服务。 ### 一、CXF WebService发布 1. **CXF环境搭建** 在开始之前,确保你已经安装了Java Development Kit (JDK) 和...
它具有高度的灵活性,可以在多种应用服务器上部署,包括Tomcat、JBoss、Jetty以及WebLogic。 在开始使用CXF之前,你需要从官方网站下载并解压Apache CXF的最新版本。解压缩后,你会看到一个bin目录,其中包含了一些...
4. **部署服务**:将服务部署到应用服务器(如Tomcat或JBoss)。 5. **测试服务**:使用CXF自带的工具或其他测试工具验证服务功能是否正常。 #### 六、总结 Apache CXF 提供了一个全面而强大的框架,使得开发者...
在本文中,我们将深入探讨七种实现WebService的方法,这些方法涵盖了从基本的JDK实现到利用高级框架如CXF和Spring的解决方案。 1. **JDK SOAP实现**:基于Java API for XML Processing (JAXP) 和SOAP with ...
在Windows 8 64位操作系统上开发REST接口时,需要注意JDK版本至少为7,因为有些库可能不支持更早的JDK版本。同时,开发环境(如Eclipse、IntelliJ IDEA)也需要配置好相应的JRE和Maven/Gradle构建工具,以正确管理和...
Java应用服务器是指支持Java应用运行的服务器软件,文档中提到了几种常见的Java应用服务器,包括Jboss、Websphere、Weblogic。这些应用服务器对于Java的Web应用开发和企业级应用部署至关重要。例如,Tomcat是一个...
1. **环境配置**:首先确保安装了MyEclipse 6.5,然后可能需要配置JDK和Web服务相关的库,如JAX-WS的API和实现。 2. **创建服务端**:使用MyEclipse的向导创建一个新的JAX-WS服务。这通常涉及定义一个Java接口和其...
导入导出支持Excel/PDF,可以选择jxl/poi/excel2007的pddfbox/iText,XML文件解析可使用dom4j/Digester,WebServices发布建议使用cxf。 **基础类库** J2EE服务端开发涉及的库包括apache-commons提供基础类扩展,...
3. **WebService Server**:可以是Apache Axis2、JBoss、Tomcat等支持WebService的服务器。 #### 三、创建WebService项目 1. **新建项目**: - 在Eclipse中选择“File”->“New”->“Dynamic Web Project”,按照...