您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關怎樣使用cxf3.0.4搭建webservice服務需要的最精簡jar包,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
下面是測試結果,只列出報錯了的測試:
1、org.apache.catalina.LifecycleException: A child container failed during start 缺少:cxf-core-3.0.4.jar(最核心的包,不多說)
2、java.lang.ClassNotFoundException: org.apache.cxf.binding.soap.SoapBindingConfiguration 缺少:cxf-rt-bindings-soap-3.0.4.jar (soap協議)
3、org.apache.cxf.jaxb.JAXBDataBinding: 缺少:cxf-rt-databinding-jaxb-3.0.4.jar
4、加載Application文件時出現Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
缺少:cxf-rt-frontend-jaxws-3.0.4.jar (frontend 前置的意思,你懂的)
5、org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser錯誤: 缺少:cxf-rt-frontend-simple-3.0.4.jar
6、class path resource [META-INF/cxf/cxf-servlet.xml] cannot be opened because it does not exist 缺少:cxf-rt-transports-http-3.0.4.jar
7、org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://cxf.apache.org/transports/udp. 缺少:cxf-rt-transports-udp-3.0.4.jar
8、org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl startup 警告: Could not start WS-Discovery Service. javax.xml.ws.WebServiceException: java.lang.NullPointerException 不能初始化配置的bean服務,也就是運行到jaxws:server時出錯
缺少:cxf-rt-ws-addr-3.0.4.jar
9、java.lang.ClassNotFoundException: org.apache.cxf.ws.policy.AssertionInfoMap 缺少:cxf-rt-ws-policy-3.0.4.jar
10、java.lang.ClassNotFoundException: org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean 缺少:cxf-rt-wsdl-3.0.4.jar
11、java.lang.ClassNotFoundException: org.apache.neethi.AssertionBuilderFactory 缺少:neethi-3.0.3.jar
12、java.lang.ClassNotFoundException: org.slf4j.LoggerFactory 缺少:slf4j-api-1.7.9.jar
13、java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver 缺少:xmlschema-core-2.2.1.jar
所以,總結cxf3.0.4框架必需的包為: cxf-core-3.0.4.jar cxf-rt-bindings-soap-3.0.4.jar cxf-rt-databinding-jaxb-3.0.4.jar cxf-rt-frontend-jaxws-3.0.4.jar cxf-rt-frontend-simple-3.0.4.jar cxf-rt-transports-http-3.0.4.jar cxf-rt-transports-udp-3.0.4.jar cxf-rt-ws-addr-3.0.4.jar cxf-rt-wsdl-3.0.4.jar cxf-rt-ws-policy-3.0.4.jar cxf-rt-wsdl-3.0.4.jar neethi-3.0.3.jar slf4j-api-1.7.9.jar xmlschema-core-2.2.1.jar
注意:這里不包括spring依賴包和commoms下的jar包
引入CXF Bean定義如下,早期的版本中使用,如果是servlet引入的話則下面三句不用了,因為框架引入了 配置文件中不需要: <import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
[html] view plain copy
<!-- scope="singleton"單例 -->
<bean id="userServiceBean" class="com.winit.webservice.UserWebService"> </bean> <!-- 注意下面的address,這里的address的名稱就是訪問的WebService的name --> <jaxws:server id="userService" serviceClass="com.winit.webservice.IUserWebService" address="/Users"> <jaxws:serviceBean> <!-- 要暴露的 bean 的引用 --> <ref bean="userServiceBean"/> </jaxws:serviceBean> </jaxws:server>
web.xml中添加cxf的servlet
[html] view plain copy
<servlet> <servlet-name>CXFService</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFService</servlet-name> <url-pattern>/webservice/*</url-pattern> </servlet-mapping>
看完上述內容,你們對怎樣使用cxf3.0.4搭建webservice服務需要的最精簡jar包有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。