浏览 4616 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (3)
|
|
---|---|
作者 | 正文 |
发表时间:2009-05-09
不罗嗦,直接问题描述:我在使用java优先的方式写CXF服务时,因为用到了Map类型,所以想到使用CXF框架非默认的Aegis数据绑定方式。但是按照我自以为的方式配置的bean文件,在发布时遇到了异常: 异常摘要
nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'dataBinding' of bean class [org.apache.cxf.jaxws.spring.EndpointDefinitionParser$SpringEndpointImpl]: Bean property 'dataBinding' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 我原来的配置文件为: <?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:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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" /> <jaxws:endpoint id="LabsQuerying" implementor="rc.yuzone.services.LabsQueryImpl" address="/LabsQueryingService"> <jaxws:dataBinding> <bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" /> </jaxws:dataBinding> </jaxws:endpoint> </beans> 后来谷歌了好久,终于在一张已经被删了的网页中(还好有快照功能)找到了灵感,我修改了配置文件,用了另一种绑定方式: <?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:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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" /> <jaxws:endpoint id="LabsQuerying" implementor="rc.yuzone.services.LabsQueryImpl" address="/LabsQueryingService"> <jaxws:serviceFactory> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> <property name="dataBinding" ref="aegisBean" /> <property name="serviceConfigurations"> <list> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" /> <bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration" /> <bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration" /> </list> </property> </bean> </jaxws:serviceFactory> </jaxws:endpoint> <bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding"/> </beans> 如此修改以后再部署,Spring就不报错了,至少可以部署成功了。至于是否影响后续的开发,还有待时间检验;至于为什么,再研究吧。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-05-12
不知道用的CXF是什么版本, 通过 <jaxws:endpoint>来配置DataBinding 应该是没有问题的。
我在CXF2.2 上实验是没有问题。 这是具体的例子,包括了服务器端和客户端的配置。 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.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"> <!-- comment this bean to disable schema validation in the client --> <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort" createdFromAPI="true"> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> <jaxws:dataBinding> <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/> </jaxws:dataBinding> </jaxws:client> <jaxws:endpoint name="{http://apache.org/hello_world_soap_http}SoapPort" wsdlLocation="wsdl/hello_world.wsdl" createdFromAPI="true"> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> <jaxws:dataBinding> <bean class="org.apache.cxf.xmlbeans.XmlBeansDataBinding"/> </jaxws:dataBinding> </jaxws:endpoint> </beans> |
|
返回顶楼 | |
发表时间:2009-05-12
最后修改:2009-05-12
|
|
返回顶楼 | |