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

Ambiguous JAXRSServerFactoryBean.setApplication() breaks Spring injection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.7
    • 3.1.5, 3.0.8, 3.2.0
    • JAX-RS
    • None
    • Unknown

    Description

      We're using a custom javax.ws.rs.core.Application implementation, "com.foo.BasicApplication", injected via Spring XML into a JAXRSServerFactoryBean. I've been seeing some inconsistent behavior at intialization. About half the time I get this:

      WARN  [] [org.springframework.beans.GenericTypeAwarePropertyDescriptor] - Invalid JavaBean property 'application' being accessed! Ambiguous write methods found next to actually used [public void org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setApplication(javax.ws.rs.core.Application)]: [public void org.apache.cxf.jaxrs.JAXRSServerFactoryBean.setApplication(org.apache.cxf.jaxrs.model.ApplicationInfo)]
      

      which complains about it, but in this case it still works.

      The other half of the time I get this, and the application fails to start up:

      org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.foo.BasicApplication' to required type 'org.apache.cxf.jaxrs.model.ApplicationInfo' for property 'application'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.foo.BasicApplication] to required type [org.apache.cxf.jaxrs.model.ApplicationInfo] for property 'application': no matching editors or conversion strategy found
      	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:591)
      	at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:603)
      	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:204)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1527)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
      	... 24 more
      

      Is this not a supported configuration? I found a workaround of creating a wrapper class that proxies the setter call without the ambiguity, but it's not ideal.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            agreenburg@vergeventures.net Andrew Greenburg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: