Looks like the context being imported affects the runtime resolution, but that is all I can assume. I wish I could help but I'm afraid there's nothing I can do without seeing a test case. A simple configuration alone, showing the way imported contexts are being configured, will help: replace all the class names. remove the redundant config, just the bare minimum will do.
Try enforcing CGLIB; try debugging, download the CXF 2.2.6 source and put a breakpoint in JAXRSInvoker. Hope we can get to the bottom of this problem Sergey On Mon, Apr 4, 2011 at 7:38 PM, jjurkiew <[email protected]> wrote: > I tried CXF 2.2.12 and 2.3.3 > > Still pretty much get the same error: > > java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: object is not > an instance of declaring class while invoking public > javax.xml.bind.JAXBElement > ourPackage.OurClass.query(java.lang.String,java.lang.String) throws > OurException with params [navigation, /]. > > > org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:102) > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:315) > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) > > > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) > > > org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) > > > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) > > > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:344) > > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:110) > > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:98) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:95) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:79) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:120) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:108) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150) > > > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) > > > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) > ... > java.lang.IllegalArgumentException: object is not an instance of declaring > class > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > java.lang.reflect.Method.invoke(Unknown Source) > > > org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173) > > > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89) > org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:153) > org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:87) > > > > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) > java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) > java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) > java.util.concurrent.FutureTask.run(Unknown Source) > > > org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) > > > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) > > > org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) > > > org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) > > > org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149) > > > org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108) > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > > > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:344) > > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:110) > > > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:98) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:95) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:79) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:120) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:55) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:36) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:108) > > > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) > > > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150) > > > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) > > > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) > > > > On 4/4/11 1:25 PM, "Sergey Beryozkin" <[email protected]> wrote: > > Hi > > A lot of improvements have been done since 2.2.6 in the way Spring AOP > proxies can be dealt with, this error was reported awhile back and it was > due to JAXRSInvoker trying to invoke on the proxy as opposed to the wrapped > service object. > > One thing you might want to try is to enforce a CGLIB proxification in the > importing context, see an example in the end of this section: > http://cxf.apache.org/docs/jax-rs.html#JAX-RS-JAXRSandSpringAOP > > Another option is to experiment with registering a custom invoker, see > http://cxf.apache.org/docs/jax-rs-filters.html#JAX-RSFilters-Custominvokers > > What you can try to do in this custom invoker is to replace the proxy > resourceObject being passed to it in the invoke() with the real object, > using org.apache.cxf.common.util.ClassHelper.getRealObject(object), or may > be just copying the relevant code from JAXRSInvoker in say CXF 2.2.11 tag > > Try moving the CXF version a bit till it starts working... > > Sure, no problems re providing the vague info :-). That said, you may just > want to try to emulate it all, just have a single basic root resource (a > single method only) and have some basic app contexts imported too, anything > that can help to reproduce it, I think it should work on the trunk, but I'd > like to try to reproduce the issue. > > Cheers, Sergey > > On Mon, Apr 4, 2011 at 5:56 PM, jjurkiew <[email protected]> wrote: > > The CXF version is 2.2.6 if I can believe the jar names bundled in our > application stack. > > Sincerely, > -- Jared > > > On 4/4/11 12:54 PM, "jjurkiew" <[email protected] < > http://[email protected]> > wrote: > > Unfortunately I can’t since it is an internal application. I have to be > vague about it. It’s definitely a Spring setup. All I did was follow the > other team’s suggestion of importing their bean config via: > > <import resource="classpath:META-INF/ourFramework/our_core.xml" /> > <import resource="classpath:META-INF/spring/framework.xml" /> > > With that imported, our CXF services fail. Without it, ours work. > > Can you give me pointers of where to dig or what to look for in files (such > as those noted above) that might be the cause? I know it’s not very > helpful to you to be vague, but I have to be careful with IP. > > Sincerely, > -- Jared > > > On 4/4/11 12:43 PM, "Sergey Beryozkin" <[email protected] < > http://[email protected]> > wrote: > > Hi, > > That is a Spring proxy issue, a complete error message explains it. > How do you import ? Is it an application context which is being imported, > or packages (via Import-Package) ? > What CXF version do you use ? Can you prepare a simple test or bundle for > me to try it locally ? > > Cheers, Sergey > > > On Mon, Apr 4, 2011 at 5:30 PM, jjurkiew <[email protected] < > http://[email protected]> > wrote: > > The function it fails on with the rest of the stack is: > > org.apache.cxf.interceptor.Fault: object is not an instance of declaring > class while invoking public javax.xml.bind.JAXBElement <Our Package>.<Our > Class>.que > ry(java.lang.String,java.lang.String) > at > org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:159) > > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:133) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:130) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:82) > > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) > > And I checked the function def denoted in the class: > @Path("/registry") > public class OurClass implements OurInterface { > > @GET > @Produces({JSON_CONTENT_TYPE, XML_CONTENT_TYPE}) > public JAXBElement query( > @QueryParam("id") @DefaultValue("") String id, > @QueryParam("xpath") @DefaultValue("/") String xpath) > > So it does have a get with the denoted return type. This only throws when > I import a set of CXF classes from another team. If it’s just our code in > the app, works fine. As soon as I import their code, blows up. > > I’m trying to get trace turned on now to see if I can figure out what is > going on. > > Sincerely, > -- Jared > > > > On 4/4/11 12:07 PM, "Sergey Beryozkin" <[email protected] < > http://[email protected]> <http://[email protected]> > wrote: > > Hi > > What most likely happens is that you have a JAX-RS resource method with a > single @Path annotation (but no @GET/@POST) which returns JAXBElement - if > it is the case then JAXBElement will be assumed to be a JAX-RS subresource. > > Can you double check it please ? If you can't find the cause then please > post a sample resource & configuration which I can try to reproduce a > problem > > Fine/trace-level logging will tell you all about the resolution process as > well, > > Cheers, Sergey > > On Mon, Apr 4, 2011 at 4:37 PM, Jared_J <[email protected] < > http://[email protected]> <http://[email protected]> > wrote: > > In an application I'm working on, I import two sets of CXF-based classes to > implement some basic rest services. I find that when both are imported, I > get this error when I try to access one of the services: > > CXF object is not an instance of declaring class while invoking public > javax.xml.bind.JAXBElement > > But it tells me little else, such as what the classname actually was that > it > got. Is there any simple way to track down the source of this error? Is > there tracing that can be turned on in CXF? Any advice would be vastly > appreciated. > > Sincerely, > -- Jared > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/Trying-to-track-down-cause-of-a-vague-CXF-error-tp4282081p4282081.html > Sent from the cxf-user mailing list archive at Nabble.com. > > > > > > > > -- Sergey Beryozkin Application Integration Division of Talend <http://www.talend.com> http://sberyozkin.blogspot.com
