Hi you were right. I was working with request scope. I have made the necessary changes and things work as expected now. Thanks a lot.
On Fri, May 13, 2011 at 5:01 PM, Sergey Beryozkin <[email protected]>wrote: > What bean scope you are using ? > Is it "request" or "session" by any chance ? > > Please check this section as well: > > > http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-FromSpring > > Cheers, Sergey > > On Fri, May 13, 2011 at 12:28 PM, Shashank Rachamalla > <[email protected]> wrote: > > Hi > > > > Thanks for replying. I have tried with a dedicated interface but no luck. > I > > see the following exception now: > > > > Caused by: javax.ws.rs.WebApplicationException > > at > > > org.apache.cxf.jaxrs.utils.InjectionUtils.reportServerError(InjectionUtils.java:390) > > at > > > org.apache.cxf.jaxrs.utils.InjectionUtils.injectThroughMethod(InjectionUtils.java:255) > > at > > > org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxiesAndApplication(InjectionUtils.java:810) > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRSServerFactoryBean.java:324) > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:350) > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:120) > > > > > > On Fri, May 13, 2011 at 4:01 PM, Sergey Beryozkin <[email protected] > >wrote: > > > >> Hi - it has to be a setter and you need to have a dedicated interface > >> with methods like > >> setMessageContext which the root resource will implement, that should > help > >> > >> Cheers, Sergey > >> > >> On Fri, May 13, 2011 at 11:01 AM, Shashank Rachamalla > >> <[email protected]> wrote: > >> > Hi > >> > > >> > I have been trying to get a reference to MessageContext through > @Context > >> > annotation. However, when spring AOP is enabled I see the following > >> > exception being thrown. any clues ? > >> > > >> > Caused by: java.lang.IllegalArgumentException: Can not set > >> > org.apache.cxf.jaxrs.ext.MessageContext field > >> > > >> > com.hexagrid.vxappstore.webservice.impl.AppstoreApplianceWebServiceImpl.mcto > >> > $Proxy87 > >> > at > >> > > >> > sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146) > >> > at > >> > > >> > sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150) > >> > at > >> > > >> > sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37) > >> > at > >> > > >> > sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57) > >> > at java.lang.reflect.Field.set(Field.java:657) > >> > at > >> > > org.apache.cxf.jaxrs.utils.InjectionUtils$1.run(InjectionUtils.java:162) > >> > at java.security.AccessController.doPrivileged(Native Method) > >> > at > >> > > >> > org.apache.cxf.jaxrs.utils.InjectionUtils.injectFieldValue(InjectionUtils.java:158) > >> > at > >> > > >> > org.apache.cxf.jaxrs.utils.InjectionUtils.injectContextProxiesAndApplication(InjectionUtils.java:815) > >> > at > >> > > >> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.injectContexts(JAXRSServerFactoryBean.java:324) > >> > at > >> > > >> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.updateClassResourceProviders(JAXRSServerFactoryBean.java:350) > >> > at > >> > > >> > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:120) > >> > ... 44 more > >> > > >> > I tried using a setter with @Context annotation but no luck. > >> > > >> > -- > >> > Regards, > >> > Shashank Rachamalla > >> > > >> > >> > >> > >> -- > >> Sergey Beryozkin > >> > >> Application Integration Division of Talend > >> http://sberyozkin.blogspot.com > >> > > > > > > > > -- > > Regards, > > Shashank Rachamalla > > > > > > -- > Sergey Beryozkin > > Application Integration Division of Talend > http://sberyozkin.blogspot.com > -- Regards, Shashank Rachamalla
