I'm trying to put together a maven build for a JAX-WS CXF client using
WS-Security (with policy configured from WSDL), but I'm getting the
error from the subject line. I haven't tried using CXF WS-Security from
Maven before, so I suspect my problem is somehow in my Maven
configuration. Here are my Maven dependencies:
<properties>
<cxf.version>2.5.1</cxf.version>
<spring.version>3.0.6.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-addr</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-common-utilities</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
Here's my cxf.xml file:
<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-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:client name="{urn:xxx:xxxservice:3.0.0}XxxService3"
createdFromAPI="true">
<jaxws:properties>
<entry key="ws-security.signature.properties"
value="client-crypto.properties"/>
<entry key="ws-security.signature.username" value="clientkey"/>
<entry key="ws-security.encryption.properties"
value="client-crypto.properties"/>
<entry key="ws-security.encryption.username" value="serverkey"/>
<entry key="ws-security.callback-handler"
value="nz.govt.minedu.wrapper.ClientCallback"/>
</jaxws:properties>
</jaxws:client>
</beans>
When I run in Eclipse I can see the full stack trace:
INFO: Creating Service {urn:xxx:xxxservice:3.0.0}XxxService3 from WSDL:
file:/secure/dennis/projects/minedu/wcf-test/common/src/main/resources/model/XxxService.svc.xml
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name '{urn:xxx:xxxservice:3.0.0}XxxService3': Error setting
property values; nested exception is
org.springframework.beans.NotWritablePropertyException: Invalid property
'bus' of bean class [org.apache.cxf.service.ServiceImpl]: Bean property
'bus' is not writable or has an invalid setter method. Does the
parameter type of the setter match the return type of the getter?
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.configureBean(AbstractAutowireCapableBeanFactory.java:314)
at
org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:146)
at
org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:151)
at
org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:115)
at
org.apache.cxf.jaxws.ServiceImpl.configureObject(ServiceImpl.java:548)
at
org.apache.cxf.jaxws.ServiceImpl.configureObject(ServiceImpl.java:542)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:478)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
at javax.xml.ws.Service.getPort(Service.java:92)
at xxx.XxxService3.getCustomBindingIServices(XxxService3.java:58)
at xxx.XxxService3.main(Xxx3Client.java:33)
Caused by: org.springframework.beans.NotWritablePropertyException:
Invalid property 'bus' of bean class
[org.apache.cxf.service.ServiceImpl]: Bean property 'bus' is not
writable or has an invalid setter method. Does the parameter type of the
setter match the return type of the getter?
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1052)
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:921)
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
Anyone have any suggestions about what I'm doing wrong?
Thanks!
- Dennis
--
Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
CXF and Web Services Security Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>