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

Ambiguous JAXRSServerFactoryBean.setApplication() breaks Spring injection

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.7
    • Fix Version/s: 3.1.5, 3.0.8, 3.2.0
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: