Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] NPE while using LTW in tomcat.

Hi Andy,

I specify the load time weaver i.e. aspectjweaver-1.6.1.jar as javaagent in catalina.bat.

Also, to provide you additional details, the OperationTrail annotation is being used to annotate the methods in the Struts2(xwork) Action classes, which are instantiated and the methods are invoked reflectively by the struts framework.

The example code would be:

public class MyAction extends com.opensymphony.xwork2.ActionSupport{
	
	@OperationTrail(....)
	public String actionMethod(){
		...
		...
	}
}

Is there a patch available for this problem?

Appreciate your help.

Thanks,
Shashi

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Thursday, June 04, 2009 8:49 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] NPE while using LTW in tomcat.

Hi Shashi,

I've not seen that problem before.  The code is asking for the
annotations on an annotation type (presumably your OperationTrail) but
has already discarded some information it needed.  I imagine the
difference in what you see when building the jar and when running it
later is due to ordering - whether the annotation is dealt with before
or after the aspect.

Although I can't recreate it, it looks like that code needs some
changes, so I will make those now.  I've raised
https://bugs.eclipse.org/bugs/show_bug.cgi?id=279120 to track it.

You aren't using any special options for load time weaving are you?

cheers,
Andy

2009/6/3 Shashikant Kale <Shashikant.Kale@xxxxxxxxxxxxxxxx>:
> Hi,
>
>
>
> I am using aspectj LTW (aspectjweaver-1.6.1) for weaving an aspect available
> in another jar within my web application code.
>
>
>
> While building the jar which contains the aspect, using maven, I have JUnits
> which run without any problems using LTW.
>
>
>
> My aspect code looks as below
>
>       @Around("execution (@com.arisglobal.aglite.annotations.OperationTrail
> public * *(..)) && this(executor)")
>
>       public Object auditOperation(ProceedingJoinPoint thisJoinPoint,
>
>                   Object executor) {
>
>             ...
>
> ... aspect code
>
> ...
>
>             }
>
>
>
> However when I deploy the application in tomcat (with
> javaagent:aspectjweaver-1.6.1.jar option), I get a NPE which I have pasted
> below.
>
>
>
> Jun 4, 2009 12:06:18 PM org.aspectj.weaver.tools.Jdk14Trace error
>
> SEVERE: com/arisglobal/aglite/services/actiontrail/ActionTrailAspect
>
> java.lang.NullPointerException
>
>         at
> org.aspectj.weaver.bcel.BcelObjectType.getAnnotationTargetKinds(BcelO
>
> bjectType.java:612)
>
>         at
> org.aspectj.weaver.ReferenceType.getAnnotationTargetKinds(ReferenceTy
>
> pe.java:265)
>
>         at
> org.aspectj.weaver.patterns.SignaturePattern.checkForIncorrectTargetK
>
> ind(SignaturePattern.java:112)
>
>         at
> org.aspectj.weaver.patterns.SignaturePattern.checkForIncorrectTargetK
>
> ind(SignaturePattern.java:94)
>
>         at
> org.aspectj.weaver.patterns.SignaturePattern.resolveBindings(Signatur
>
> ePattern.java:87)
>
>         at
> org.aspectj.weaver.patterns.KindedPointcut.resolveBindings(KindedPoin
>
> tcut.java:262)
>
>         at
> org.aspectj.weaver.patterns.AndPointcut.resolveBindings(AndPointcut.j
>
> ava:75)
>
>         at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:196)
>
>         at
> org.aspectj.weaver.bcel.AtAjAttributes.handleAroundAnnotation(AtAjAtt
>
> ributes.java:1308)
>
>         at
> org.aspectj.weaver.bcel.AtAjAttributes.readAj5MethodAttributes(AtAjAt
>
> tributes.java:403)
>
>         at
> org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java
>
> :189)
>
>         at org.aspectj.weaver.bcel.BcelMethod.<init>(BcelMethod.java:96)
>
>         at
> org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectT
>
> ype.java:264)
>
>         at
> org.aspectj.weaver.bcel.LazyClassGen.<init>(LazyClassGen.java:303)
>
>         at
> org.aspectj.weaver.bcel.BcelObjectType.getLazyClassGen(BcelObjectType
>
> .java:524)
>
>         at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1728)
>
>         at
> org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1
>
> 696)
>
>         at
> org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:145
>
> 8)
>
>         at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1244)
>
>         at
> org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.
>
> java:423)
>
>         at
> org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.jav
>
> a:286)
>
>         at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:95)
>
>         at
> org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(C
>
> lassPreProcessorAgentAdapter.java:52)
>
>         at
> sun.instrument.TransformerManager.transform(TransformerManager.java:1
>
> 22)
>
>         at
> sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java
>
> :155)
>
>         at java.lang.ClassLoader.defineClass1(Native Method)
>
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>
>
>
> I also tried using aspectjweaver-1.6.4 version however got the same error.
>
>
>
> Could somebody please point to any solution?
>
>
>
> Thanks in advance,
>
> Shashi
>
> ________________________________
> Legal Notice: This transmission, including any attachments, is confidential,
> proprietary, and may be privileged. It is intended solely for the intended
> recipient. If you are not the intended recipient, you have received this
> transmission in error and you are hereby advised that any review,
> disclosure, copying, distribution, or use of this transmission, or any of
> the information included therein, is unauthorized and strictly prohibited.
> If you have received this transmission in error, please immediately notify
> the sender by reply and permanently delete all copies of this transmission
> and its attachments
> ________________________________
>
> _______________________________________________
> 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

Legal Notice: This transmission, including any attachments, is confidential, proprietary, and may be privileged. It is intended solely for
the intended recipient. If you are not the intended recipient, you have received this transmission in error and you are hereby advised that any
review, disclosure, copying, distribution, or use of this transmission, or any of the information included therein, is unauthorized and strictly
prohibited. If you have received this transmission in error, please immediately notify the sender by reply and permanently delete all copies of
this transmission and its attachments



Back to the top