?
?CXF(http://cxf.apache.org/)和Spring(http://cxf.apache.org/)无缝集成的Web Service开发框架。CXF目前是APACHE的孵化项目,也是目前JAVA领域十分热门和有前途的Web Service开发框架。最近在一个研发项目中需要提供Web Service服务,调用方是.NET开发的系统。通过分析选择,最终决定采用CXF来做。
????? CXF、SPRING和HIBERNATE版本更新都比较快,把几个东西搁一块就会出现些不兼容的问题。我将最新的CXF 2.1和Spring 2.5 和 Hibernate 3.2放到一起,系统启动时报“Unsatisfied dependency expressed through constructor argument with index 2 of type [org.apache.cxf.jaxws.JaxWsServerFactoryBean]:” …的错误。在cxf的mail-list 和 CXF-ZH(http://groups.google.com/group/cxf-zh) 没找到合适解答。经过一番分析测试,现将解决上述问题的方案提供给大家:
?????? 1、CXF 下载最新的 CXF 2.1.1(http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1.1-SNAPSHOT/
)
?????? 2、在lib下应该使用如下版本的类库文件
?????????? cxf-2.1.1-SNAPSHOT.jar??????????
?????????? asm-2.2.3.jar(在Spring 2.5里,替换掉hibernate3.2里自带的)
?????????? hibernate3.2.6.jar
?????????? cglib-nodep-2.1_3.jar(去掉老的cglib)
?????????? spring-core.jar
?????????? spring-web.jar
?????????? spring-webmvc.jar
?????????? hibernate-annotations.jar
?????????? hibernate-commons-annotations.jar
?????????? cxf 2.1.1相关的类库
?????????? commons-logging-1.1.jar
?????????? geronimo-activation_1.1_spec-1.0.2.jar
?????????? geronimo-annotation_1.0_spec-1.1.1jar
?????????? geronimo-javamail_1.4_spec-1.3.jar
?????????? geronimo-servlet_2.5_spec-1.2.jar (or Sun's Servlet jar)
?????????? geronimo-stax-api_1.0_spec-1.0.1.jar
?????????? geronimo-ws-metadata_2.0_spec-1.1.2.jar (JSR 181)
?????????? jaxb-api-2.1.jar
?????????? jaxb-impl-2.1.6.jar
?????????? jaxws-api-2.1-1.jar
?????????? neethi-2.0.4.jar
?????????? saaj-api-1.3.jar
?????????? saaj-impl-1.3.jar
?????????? wsdl4j-1.6.1.jar
?????????? wstx-asl-3.2.4.jar
?????????? XmlSchema-1.4.2.jar
?????????? xml-resolver-1.2.jar
???? 3、编写spring的配置文件时应该注意采用如下结构形式(helloWorld.xml)
?
?<?xml version="1.0" encoding="UTF-8"?>
?<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">??
?
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
?
<bean id="helloWorldImpl" class="lee.ws.HelloWorldImpl" />
<jaxws:endpoint id="helloWorld"? implementor="#helloWorldImpl" implementorClass="lee.ws.HelloWorldImpl"?? address="/HelloWorld">??
<jaxws:serviceFactory>??
<bean??
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">??
<property name="wrapped" value="true" />??
</bean>??
</jaxws:serviceFactory>??
??????? </jaxws:endpoint>?
?
</beans>
?
?OK,希望这篇文章对大家有所帮助.
终于找到解决方案,多谢,顶下
谢谢