Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 17397 invoked from network); 17 Jul 2009 16:03:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jul 2009 16:03:33 -0000 Received: (qmail 40079 invoked by uid 500); 17 Jul 2009 16:04:39 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 40016 invoked by uid 500); 17 Jul 2009 16:04:39 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 40005 invoked by uid 99); 17 Jul 2009 16:04:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jul 2009 16:04:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jul 2009 16:04:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CB6CE234C044 for ; Fri, 17 Jul 2009 09:04:14 -0700 (PDT) Message-ID: <40268788.1247846654818.JavaMail.jira@brutus> Date: Fri, 17 Jul 2009 09:04:14 -0700 (PDT) From: "Hendy Irawan (JIRA)" To: issues@cxf.apache.org Subject: [jira] Commented: (CXF-2345) Returning AOP/CGLIB proxy as Subresource throws Fault "object is not an instance of declaring class" In-Reply-To: <805310334.1247793434949.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732585#action_12732585 ] Hendy Irawan commented on CXF-2345: ----------------------------------- Thank you so much Sergey for the confirmed fix. I'll try if the following workaround will work for now: public SubResource getSub() { return (SubResource)appCtx.getBean("subResource"); } Since it's on topic, I'd like to ask: 1. what's the CXF recommended best practice of subresource with Spring+CXF? Java new with manual setters; Spring AOP lookup-method, Spring appCtx.getBean(), or Spring AOP with @Configurable ? or another technique? 2. what's really the difference between @RolesAllowed in JAX-RS class and in JAX-RS method? Isn't annotating the class means the whole resource is "secured"? (i.e. I don't see a point in annotating all methods of a class with the same annotation) > Returning AOP/CGLIB proxy as Subresource throws Fault "object is not an instance of declaring class" > ---------------------------------------------------------------------------------------------------- > > Key: CXF-2345 > URL: https://issues.apache.org/jira/browse/CXF-2345 > Project: CXF > Issue Type: Bug > Components: REST > Affects Versions: 2.2.2 > Reporter: Hendy Irawan > Assignee: Sergey Beryozkin > Fix For: 2.2.3, 2.3 > > > Test case: > RootResource.java : > public class RootResource { > @Path("subresource") > public abstract SubResource getSubResource(); > } > In spring-beans.xml: > > > > > Then the AOP proxied SubResource: > @RolesAllowed({"ROLE_USER"}) // activate Spring Security global method annotations > public class SubResource { > } > Getting the /subresource will throw exception: > org.apache.cxf.interceptor.Fault: object is not an instance of declaring class while invoking > Tried this workaround but not working: Make SubResource implement an interface then on RootResource.getSubResource() use interface as the return type, not the class -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.