Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Method not visible using this in pointcut

On Wed, Oct 22, 2008 at 4:34 PM, Luiz Antonio Soares Filho
<luiz@xxxxxxxxxxxxxx> wrote:
> Hello Ramnivas,
>
> I read your book AspectJ in Action and it helped me a lot to make my
> graduate thesis that I will finish in the end of this year.
>
> Well, I'm using LTW and when I use a privileged aspect the error turns into
> a warning:
> "this affected type is not exposed to the weaver:
> com.bea.wlw.netui.pageflow.FlowController (needed for privileged access)
> [Xlint:typeNotExposedToWeaver]"

This is probably another error, which now only becomes visible after
advising the private method. I'm not sure exactly how this error can
occur during LTW, but did you i.e. make sure that
com.bea.wlw.netui.pageflow.FlowController is on your classpath?

~David

> So I think that I cannot go this way.
>
> Then I tried to use reflection to make it works, but I had problems when I
> was testing and these problems aren't related to the use of reflection.
>
> The problems that appear in the server application console are:
>
> [GenericClassLoader@1e9d337] error can't determine modifiers of missing type
> com
> .bea.wlw.netui.pageflow.FormData
> when processing type mungers ejb.manager.DocumentoSessionRemote
> when processing type mungers
> when weaving
>  [Xlint:cantFindType]
> [GenericClassLoader@1e9d337] error can't determine modifiers of missing type
> com
> .bea.wlw.netui.pageflow.PageFlowController
> when processing type mungers ejb.manager.DocumentoSessionRemote
> when processing type mungers
> when weaving
>  [Xlint:cantFindType]
>
> These problems are printed repeatedly and only the classes that appear in
> "when processing type mungers ejb.manager.DocumentoSessionRemote" changes.

Looks like the same error as without reflection to me.

> Any idea?
>
> Thanks,
> Luiz Antonio

~David

> 2008/10/22 Ramnivas Laddad <ramnivas@xxxxxxxxxxxxxxx>
>>
>> You may mark the aspect as 'privileged'.
>> public privileged aspect ... {
>>    ...
>> }
>> Alternatively, you may use reflection along with the
>> AccessibleObject.setAccessible() method.
>> -Ramnivas
>>
>> On Wed, Oct 22, 2008 at 4:45 PM, Luiz Antonio Soares Filho
>> <luiz@xxxxxxxxxxxxxx> wrote:
>>>
>>> Hello,
>>>
>>> I have a join point that need to expose the type of the instance.
>>> I used this(type) pointcut. When I call the method getRequest() from the
>>> type this error occurs:
>>> "The method getRequest() from the type FlowController is not visible"
>>>
>>> I think this error is happening possibly because getRequest is a private
>>> method from FlowController. How can I solve this?
>>>
>>> Here is my code:
>>>
>>> private pointcut tratarExcecao(Exception ex, String actionName,
>>> PageFlowController page) :
>>>         execution(* *Controller.exception(..)) &&
>>>             args(ex, actionName, *, *) && this(page);
>>>
>>>     before(Exception ex, String actionName, PageFlowController page) :
>>> tratarExcecao(ex, actionName, page) {
>>>         String displayMessage;
>>>         if (AppException.isMensagemNegocio(ex)) {
>>>             String keyError = AppException.obtemKeyErro(ex);
>>>             displayMessage = "Erro: " + actionName;
>>>
>>> page.getRequest().setAttribute("errorMessage",displayMessage); //ERROR HERE
>>>         }
>>>     }
>>>
>>>
>>> Luiz Antonio
>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>>
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top