Answer the question
In order to leave comments, you need to log in
Why are @Context fields not populated in cxf?
@Service
@Transactional
@Path("test")
public class ServiceImpl implements Service {
@Get
public void test(@Context MessageContext ctx) {
}
}
@Service
@Transactional
@Path("test")
public class ServiceImpl implements Service {
@Context MessageContext ctx;
@Get
public void test() {
}
}
Caused by: java.lang.IllegalArgumentException: Can not set org.apache.cxf.jaxrs.ext.MessageContext field com.example.services.test.ServiceImpl.ctx to com.sun.proxy.$Proxy197
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:75)
at java.lang.reflect.Field.set(Field.java:764)
at org.apache.cxf.jaxrs.utils.InjectionUtils$1.run(InjectionUtils.java:228)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.jaxrs.utils.InjectionUtils.injectFieldValue(InjectionUtils.java:224)
at org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxiesAndApplication(InjectionUtils.java:1103)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRSServerFactoryBean.java:405)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:429)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:162)
... 29 more
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question