Oh, and just as an added note to this discussion of the maven
dependencies - if you're using WS-Policy configurations it looks like
you also need to have the dependency on cxf-rt-ws-policy - otherwise the
policy is silently ignored.
- Dennis
On 01/23/2012 01:30 PM, Dennis Sosnoski wrote:
Thanks for the suggestions, Glen. I had originally added in all the
separate dependencies because I had build errors after running mvn
eclipse:eclipse, and then to make sure I had everything in place when
I was running into problems. I've cut the dependencies back to just
cxf-rt-frontend-jaxws, cxf-rt-ws-security, and cxf-rt-transports-http,
and verified the Eclipse projects are set up correctly with just those
three - but I still have the same problem when I try to run it.
Later... Figured it out, after comparing some other projects! The
<jaxws:client name="..." attribute in the cxf.xml file needs to be the
port name, and I instead had the service name.
That's a very strange error to get as a result of a wrong port name,
but at least it'll be in the mailing list archive now if anyone else
makes the same mistake.
- Dennis
On 01/23/2012 01:07 AM, Glen Mazza wrote:
Perhaps you have too many explicit dependencies listed, instead of
relying on the ones CXF actually uses and otherwise would bring in
(via Maven transitive dependency mechanism)? For WS-SecPol (either
X.509 or Usernametoken), I found just these two dependencies needed:
http://www.jroller.com/gmazza/entry/cxf_usernametoken_profile#UTCXF2
over and above the two core ones given in my WSDL-first tutorial
(http://www.jroller.com/gmazza/entry/web_service_tutorial#WFstep3).
HTH,
Glen
On 01/22/2012 02:44 AM, Dennis Sosnoski wrote:
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