Re: [aspectwerkz-user] problem adding pointcut/advice
Alexandru Popescu <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[quote Brent Verner::on 3/28/2005 9:18 PM]
> Hi,
>
> I'm terribly new to this AOP magic, so I hope you'll forgive my
> misuse of terminology...
>
> I've been using AW 2.0 for a few weeks and it has been a huge success,
> but I've recently tried adding an execute pointcut and AW gives me the
> exception below. The relevant parts of my AW bits are below, as well.
> What can I do to get this pointcut to work?
>
>
> java.lang.Error: field info metadata structure could not be build for field: java/rmi/AccessException.detail:Ljava/lang/Throwable;
> at org.codehaus.aspectwerkz.transform.inlining.weaver.FieldSetFieldGetVisitor$ReplacePutFieldAndGetFieldInstructionCodeAdapter.getFieldInfo(FieldSetFieldGetVisitor.java:389)
> at org.codehaus.aspectwerkz.transform.inlining.weaver.FieldSetFieldGetVisitor$ReplacePutFieldAndGetFieldInstructionCodeAdapter.visitFieldInsn(FieldSetFieldGetVisitor.java:199)
>
> A snippet of my aop.xml...
>
> <aspect class="com.netavail.oup.aop.ItemLocator">
> <param name="serverName" value="some.domain.com"/>
> <param name="serverPort" value="80"/>
> <pointcut name="item" expression="execution( * a.b.c.d.getItem(..) )"/>
> <advice name="getItem" type="around" bind-to="item"/>
> </aspect>
>
> My aspect class...
>
> import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
> import org.codehaus.aspectwerkz.joinpoint.MethodRtti;
> import org.codehaus.aspectwerkz.AspectContext;
>
> public class ItemLocator {
> AspectContext context = null;
>
> public ItemLocator(final AspectContext context){
> this.context = context;
> }
>
> public Object getItem(JoinPoint jp) throws Throwable {
> System.err.print("XXX: getItem " + jp.getThis());
> /*
> try {
> MethodRtti method = (MethodRtti)jp.getRtti();
> Object params[] = method.getParameterValues();
> String url = (String)params[1];
> System.err.print("rewriting item url: " + url + " -> ");
> String name = context.getParameter("serverName");
> int port = Integer.parseInt(context.getParameter("serverPort"));
> String proto = "http:";
> if( ! url.startsWith("http:") ){
> url = "http:" + url;
> proto = "";
> }
> URL u = new URL(url);
> url = proto + "//" + name + ":" + port + u.getPath();
> System.err.println(url);
> params[1] = url;
> method.setParameterValues(params);
> }
> catch( Exception ex ){
> ex.printStackTrace();
> }
> */
> return jp.proceed();
> }
> }
>
>
Is this the only aspect you are defining? I cannot see why it should pass throught that piece of
code. Can you reproduce the problem in a small test unit?
cheers,
- --
:alex |.::the_mindstorm::.|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
iD8DBQFCSGnPOCPjdDT2FEURAi4nAJwL00dDuKkVX1AejO0ZxbRkxpEwvQCgr/KK
VGMey1jkBMtVyNRBkuji+SE=
=EhP7
-----END PGP SIGNATURE-----