nengyu 2013-05-29
Hibernate 3.2放到一起,系统启动时报“Unsatisfied dependency expressed throughconstructor argument with index 2 of type[org.apache.cxf.jaxws.JaxWsServerFactoryBean]:”…的错误。
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/schemas/core.xsd
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>