Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] NPE in LTW with aspectJ 1.5.2a


Yes I do think you are experiencing https://bugs.eclipse.org/bugs/show_bug.cgi?id=151182. Unfortunately it is not fixed in the driver you are using (which is not intended for general consumption and will be described as such shortly). We have been experiencing problems with our upload process but there is a new "Last Known Good developer build " on the Web site today that you can try. Please let us know if it works and we can (finally) close the bug report.

The fact that your org.apache class is being woven is related to the bug. Under certain conditions there is a race condition creating the AspectJ weaving adaptor. The thread that gets the NPE is using the adaptor before it is initialized including the set of include/excludes.

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



mhoram@xxxxxxxxxxxx
Sent by: aspectj-users-bounces@xxxxxxxxxxx

23/08/2006 09:04

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] NPE in LTW with aspectJ 1.5.2a





Hi all:

I´m trying to use LTW to integrate a debugging aspect into my application
using:

Tomcat 5.5

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

And AspectJ 1.5.2a

I get the following error:

info weaving 'org/apache/catalina/storeconfig/WrapperListenerSF'
java.lang.NullPointerException
       at
org.aspectj.weaver.bcel.BcelWeaver.weaveParentTypeMungers(BcelWeaver.
java:1367)
       at
org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:12
37)
       at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1072)
       at
org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.
java:284)
       at
org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.jav
a:212)
       at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:65)
       at
org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(C
lassPreProcessorAgentAdapter.java:55)
       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)
       at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
       at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
       at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
       at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:164)
       at
org.apache.catalina.storeconfig.StoreFactoryRule.newInstance(StoreFac
toryRule.java:121)
       at
org.apache.catalina.storeconfig.StoreFactoryRule.begin(StoreFactoryRu
le.java:87)
       at
org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1
275)
       at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle
ment(AbstractSAXParser.java:533)
       at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanStartElement(XMLDocumentFragmentScannerImpl.java:878)
       at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
       at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
       at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:834)
       at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:764)
       at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:148)
       at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1242)
       at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1580)
       at
org.apache.catalina.storeconfig.StoreLoader.load(StoreLoader.java:241
)
       at
org.apache.catalina.storeconfig.StoreConfigLifecycleListener.createMB
ean(StoreConfigLifecycleListener.java:74)
       at
org.apache.catalina.storeconfig.StoreConfigLifecycleListener.lifecycl
eEvent(StoreConfigLifecycleListener.java:57)
       at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
       at
org.apache.catalina.core.StandardServer.start(StandardServer.java:705
)
       at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

The aspect works fine when using Iajc instead LTW, this is the aspect i use:

package com.mundivia.aopmonitor;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;


@Aspect
public class QuiterMonitorAspect {

   private static Monitor monitor;

   private static Logger logger = Logger
   .getLogger(QuiterMonitorAspect.class);

   @Pointcut(" execution(* com.quiter..*(..))")
   public void metodosQuiter(){

   }

   @Pointcut(" execution(*
pruebasmundivia.pool.implementaciones.AfinityCacheTiempoConexionConexionesDMSPoolSinTimer.*Conexion(..))")
   public void metodosPool(){

   }

   @Pointcut(" execution(* asjava.uniobjects.*(..))")
   public void metodosUniverse(){

   }

   @Pointcut(" execution(*
pruebasmundivia.pool.implementaciones.CommonsBasedConexionesDMSPool.*Conexion(..))")
   public void metodosCommonsPool(){

   }

   @Pointcut(" execution(*
pruebasmundivia.pool.implementaciones.HashTableBasedAfinityCacheSinTimer.comprobarContenido(..))")
   public void metodosCache(){

   }


   /*@Around("metodosQuiter()||metodosMundivia()")*/
   @Around("metodosPool()")
   public Object aspecto(ProceedingJoinPoint jp){
      // monitor=MonitorFactory.start(jp.getSignature().toLongString());
       Object devolver=null;
       long t1=0,t2=0;
       try {
           t1=System.nanoTime();
           devolver=jp.proceed();
           t2=System.nanoTime();
       } catch (Throwable e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }finally{
           System.out.println(t2-t1);
          // monitor.stop();
           //logger.debug(monitor.toString());
          // System.out.println(monitor);
       }
       return devolver;


   }

//    @Pointcut("execution (* *(..))")
//    public void capaWeb(){
//
//    }
//
//    @Pointcut("execution(* *(..))")
//    public void capaDao(){
//
//    }
//
//    @Pointcut("execution(* *(..))")
//    public void capaModelo(){
//
//    }



}

And my aop.xml file store in a jar placed in tomcat/common/lib

<aspectj>
                <aspects>
                         <aspect name="com.mundivia.aopmonitor.QuiterMonitorAspect" />
                                 <include within="com.mundivia.aopmonitor.QuiterMonitorAspect" />
                </aspects>
                <weaver options="-verbose">
                                 <include within="asjava..*" />
                </weaver>
</aspectj>

It seems i´m having this bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=151182

Can anyone confirm it?

Other cuestion, why is weaver trying to weave org.apache classes when i
have not include them in the weaver section?

I send zip file with the aspect and the aop.xml file just in case anyone
want to take a look

Thanks._______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Attachment: QuiterJamonMonitor.zip
Description: Zip archive


Back to the top