macon (1) [Avatar] Offline
#1
We've been using AspectJ 1.5.2 with Load Time Weaving (LTW) in a BEA Portal project. The EAR file has an internal WAR file and a host of internal JARs. One of the internal jars is an abstract aspect which we apply to our project using LTW and aop.xml. The aspect in question uses "around" advice.

We've discovered that we can apply and run this aspect against any code outside of the WAR (but inside the ear). When we try run code in the WAR with the aspect woven into that code we get an "IllegalAccessException" and a "NoAspectBoundException".

I turned on the -verbose option and according to the LTW the code in the WAR actually gets woven, but the exception still occurs. The exception happens when a method on the woven class is accessed. Here's a "scrubbed" (company info removed) stack trace of what's going on. Any recommendations or thoughts on why this is happening? We have a need to apply these aspects both in the WAR and in the surrounding EAR. (note the aspect is being woven in to "SimpleVO" which is a POJO).

Caused by: org.aspectj.lang.NoAspectBoundException: Exception while initializing com.XXX.YYY.governor.aspects.ConcreteGovernor: java.lang.IllegalAccessError: <init>
... 32 more
Caused by: java.lang.IllegalAccessError: <init>
at com.XXX.YYY.governor.aspects.ConcreteGovernor.<init>()V(Unknown Source)
at com.XXX.YYY.governor.aspects.ConcreteGovernor.ajc$postClinit()V(Unknown Source)
at com.XXX.YYY.governor.aspects.ConcreteGovernor.<clinit>()V(Unknown Source)
at jrockit.vm.RNI.getRunnableCode(I)I(Unknown Source)
at jrockit.vm.RNI.trampoline()V(Unknown Source)
at com.XXX.YYY.governor.aspects.ConcreteGovernor.aspectOf()Lcom/XXX/YYY/governor/aspects/ConcreteGovernor;(Unknown Source)
at com.XXX.portlet1.SimpleVO.getName()Ljava/lang/String;(SimpleVO.java:1)
at jrockit.reflect.NativeMethodInvoker.invoke0(Ljava/lang/Object;ILjava/lang/Object;[Ljava/lang/ObjectsmilieLjava/lang/Object;(Unknown Source)
at jrockit.reflect.NativeMethodInvoker.invoke(Ljava/lang/Object;[Ljava/lang/ObjectsmilieLjava/lang/Object;(Unknown Source)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava/lang/Object;[Ljava/lang/ObjectsmilieLjava/lang/Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source)
at com.bea.wlw.netui.script.el.util.ParseUtils.getProperty(Ljava/lang/Object;Ljava/lang/String;Lcom/bea/wlw/netui/util/cache/PropertyCachesmilieLjava/lang/Object;(ParseUtils.java:160)
at com.bea.wlw.netui.script.el.tokens.ExpressionToken.beanLookup(Ljava/lang/Object;Ljava/lang/ObjectsmilieLjava/lang/Object;(ExpressionToken.java:70)
at com.bea.wlw.netui.script.el.tokens.IdentifierToken.evaluate(Ljava/lang/ObjectsmilieLjava/lang/Object;(IdentifierToken.java:81)
at com.bea.wlw.netui.script.el.ExpressionTerm._evaluate(ILcom/bea/wlw/netui/script/el/VariableResolversmilieLjava/lang/Object;(ExpressionTerm.java:217)
at com.bea.wlw.netui.script.el.ExpressionTerm.evaluate(Lcom/bea/wlw/netui/script/el/VariableResolversmilieLjava/lang/Object;(ExpressionTerm.java:106)
at com.bea.wlw.netui.script.el.ParsedExpression.evaluate(Lcom/bea/wlw/netui/script/el/VariableResolversmilieLjava/lang/Object;(ParsedExpression.java:124)
at com.bea.wlw.netui.script.el.util.ParseUtils.evaluate(Ljava/lang/String;Lcom/bea/wlw/netui/script/el/VariableResolversmilieLjava/lang/Object;(ParseUtils.java:107)
at com.bea.wlw.netui.script.el.ExpressionEvaluatorImpl.evaluateStrict(Ljava/lang/String;Ljava/util/MapsmilieLjava/lang/Object;(ExpressionEvaluatorImpl.java:87)
at com.bea.wlw.netui.tags.AbstractBaseTag.evaluateExpressionInternal(Ljava/lang/String;Ljava/lang/StringsmilieLjava/lang/Object;(AbstractBaseTag.java:570)
at com.bea.wlw.netui.tags.AbstractBaseTag.evaluateExpression(Ljava/lang/String;Ljava/lang/StringsmilieLjava/lang/Object;(AbstractBaseTag.java:359)
at com.bea.wlw.netui.tags.html.Label.doEndTag()I(Label.java:520)
at jsp_servlet._com._XXX._portlet1.__index._jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponsesmilieV(index.jsp:23)
at weblogic.servlet.jsp.JspBase.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponsesmilieV(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava/lang/Object;(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lweblogic/servlet/internal/FilterChainImplsmilieV(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lweblogic/servlet/internal/FilterChainImplsmilieV(ServletStubImpl.java:526)
at weblogic.servlet.internal.TailFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChainsmilieV(TailFilter.java:2smilie
at weblogic.servlet.internal.FilterChainImpl.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponsesmilieV(FilterChainImpl.java:27)
at com.bea.p13n.servlets.PortalServletFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChainsmilieV(PortalServletFilter.java:293)
at weblogic.servlet.internal.FilterChainImpl.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponsesmilieV(FilterChainImpl.java:27)
at com.bea.wlw.netui.pageflow.PageFlowJspFilter.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Ljavax/servlet/FilterChainsmilieV(PageFlowJspFilter.java:250)