Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5563

Setting the attribute 'namespace' of the {http://cxf.apache.org/policy}policies configuration element causes a NotWritablePropertyException to be thrown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7.8
    • None
    • Configuration
    • None
    • Unknown

    Description

      According to https://cxf.apache.org/docs/wspconfiguration.html you can specify the ws-policy namespace to be used when configuring the Policies feature using the namespace attribute.

      However when I do this:

      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:cxf="http://cxf.apache.org/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
      	xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
      	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:p="http://cxf.apache.org/policy"
      	xsi:schemaLocation="
                  http://cxf.apache.org/core
                  http://cxf.apache.org/schemas/core.xsd 
                  http://cxf.apache.org/configuration/security  		      
                  http://cxf.apache.org/configuration/schemas/security.xsd
                  http://cxf.apache.org/jaxws
                  http://cxf.apache.org/schemas/jaxws.xsd
                  http://cxf.apache.org/transports/http/configuration
                  http://cxf.apache.org/transports/http/schemas/http-conf.xsd
                  http://cxf.apache.org/transports/http-jetty/configuration
                  http://cxf.apache.org/transports/http-jetty/schemas/http-jetty.xsd
                  http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans.xsd
                  http://cxf.apache.org/policy 
                  http://cxf.apache.org/schemas/policy.xsd">
      
      
      
      	<bean id="abstractLoggingInterceptor" abstract="true">
      		<property name="prettyLogging" value="true" />
      	</bean>
      	<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"
      		parent="abstractLoggingInterceptor" />
      	<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"
      		parent="abstractLoggingInterceptor" />
      
      	<cxf:bus>
      		<cxf:inInterceptors>
      			<ref bean="loggingInInterceptor" />
      		</cxf:inInterceptors>
      		<cxf:outInterceptors>
      			<ref bean="loggingOutInterceptor" />
      		</cxf:outInterceptors>
      		<cxf:outFaultInterceptors>
      			<ref bean="loggingOutInterceptor" />
      		</cxf:outFaultInterceptors>
      		<cxf:inFaultInterceptors>
      			<ref bean="loggingInInterceptor" />
      		</cxf:inFaultInterceptors>
      		<cxf:features>
      			<p:policies ignoreUnknownAssertions="true" namespace="http://schemas.xmlsoap.org/ws/2004/09/policy" />
      		</cxf:features>
      	</cxf:bus>
      
      
      
      	
      
      </beans>
      

      the following exception is thrown:

      Exception in thread "main" java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Cannot create inner bean 'p:policies#43191701' of type [org.apache.cxf.ws.policy.WSPolicyFeature] while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'p:policies#43191701': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'namespace' of bean class [org.apache.cxf.ws.policy.WSPolicyFeature]: Bean property 'namespace' 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.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:151)
      	at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:124)
      	at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:94)
      
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Cannot create inner bean 'p:policies#43191701' of type [org.apache.cxf.ws.policy.WSPolicyFeature] while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'p:policies#43191701': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'namespace' of bean class [org.apache.cxf.ws.policy.WSPolicyFeature]: Bean property 'namespace' 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.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      	at org.apache.cxf.bus.spring.BusApplicationContext$1.run(BusApplicationContext.java:107)
      	at org.apache.cxf.bus.spring.BusApplicationContext$1.run(BusApplicationContext.java:105)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:105)
      	at org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:157)
      	at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:148)
      	... 3 more
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'p:policies#43191701': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'namespace' of bean class [org.apache.cxf.ws.policy.WSPolicyFeature]: Bean property 'namespace' 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:1363)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
      	... 23 more
      Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'namespace' of bean class [org.apache.cxf.ws.policy.WSPolicyFeature]: Bean property 'namespace' 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:1360)
      	... 27 more
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            dvoets David Voets
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: