cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] Commented: (CXF-2345) Returning AOP/CGLIB proxy as Subresource throws Fault "object is not an instance of declaring class"
Date Fri, 17 Jul 2009 17:00:15 GMT


Sergey Beryozkin commented on CXF-2345:


You probably don't need to deal with the application context.
With the fix being in (you can try 2.2.3-snapshot may be on Monday or tomorrow) you won't
need to change anything at all.

Without the fix, you can do :

1. interface ResourceInterface {
         SubResource getSubResource();

   public ResourceImpl implements ResourceInterface {

and it will work, I've confirmed it in the Spring security system test. In this case you can
still have @RolesAllowed on SubResource  

2. public ResourceImpl {

         public SubResource getSubResource() {...}

in your case it would be equivalent to putting it on the SubResource class, because users
would need to be authorized to start working with this subresource, so I didn't recommend
putting RolesAllowed on every SubResource method

Does it clarify things a bit ?
cheers, Sergey

> Returning AOP/CGLIB proxy as Subresource throws Fault "object is not an instance of declaring
> ----------------------------------------------------------------------------------------------------
>                 Key: CXF-2345
>                 URL:
>             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:
> :
> public class RootResource {
>   @Path("subresource")
>   public abstract SubResource getSubResource();
> }
> In spring-beans.xml:
> <bean class="RootResource">
>   <lookup-method name="getSubResource" bean="subResource" />
> </bean>
> <bean id="subResource" class="SubResource" />
> 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
> 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.

View raw message