Skip to main content

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

Just to add to Matthew’s comments, you might also try using include in your aop.xml file, e.g.,

 

                <weaver options="-verbose">
                        <include within="pruebasmundivia..*"/>
                </weaver>

Assuming you only need to match join points defined in this package structure (as is likely true from the aspect you wrote). As a style matter, I’d add a matching && within(pruebasmundivia..*) to the pointcut below so that this is purely an optimization and the weaving includes (or excludes) are never having an effect on where a pointcut matches.

 

With respect to weaving in Tomcat, the Glassbox open source project uses AspectJ for performance monitoring in Tomcat and other popular containers. We generally weave all applications and container code by putting our shared aspect jar in the common/lib folder. However, to monitor a single application you can just put the jar in a Web application’s WEB-INF/lib folder, to further reduce the scope of application. You might find it useful to extend Glassbox to support the connection monitoring you are doing, too. I’d like to have AspectJ users interested in monitoring performance build a common library for what and how to monitor.

 

Cheers,

Ron

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Matthew Webster
Sent: Wednesday, August 23, 2006 8:59 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: Fw: [aspectj-users] NPE in LTW with aspectJ 1.5.2a

 


I assume the NPE has gone which probably means the original bug is fixed. The reason org.apache classes are being passed to the weaver (but not necessarily woven unless a pointcut matched) is because you aop.xml file no longer excludes them. You could try:

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

                        <exclude within="org.apache..*"/>
                </weaver>
</aspectj>


However you may have deployed the aop.xml and aspect too "high" in the class loader hierarchy so it is trying to weave more than you need. If you post your configuration others on this list with more Tomcat & AspectJ experience might give you some advice.

The AbortException is probably caused by an earlier error message. Do you have the whole log starting with the AspectJ version message?

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/[1]


mhoram@xxxxxxxxxxxx

23/08/2006 14:02

To

Matthew Webster/UK/IBM@IBMGB

cc

 

Subject

Re: Fw: [aspectj-users] NPE in LTW with aspectJ 1.5.2a

 

 

 




Thanks for the forward, i haven´t receive the original answer.

Unfortunately the problem continues altough has change, the exception is
not the same but it continues to weaving all classes despite my aop.xml
file

Thats and example of the output:

[StandardClassLoader@6744085] info weaving
'org.apache.catalina.startup.CopyPar
ntClassLoaderRule'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.startup.Context
uleSet'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.startup.SetCont
xtPropertiesRule'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.startup.CreateL
aderRule'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.startup.Cluster
uleSet'
[StandardClassLoader@6744085] info weaving
'org.apache.tomcat.util.Introspectio
Utils'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.ServerFactory'
[StandardClassLoader@6744085] info weaving
'org.apache.catalina.deploy.NamingRe
ources'

Here´s the error:

org.aspectj.bridge.AbortException: trouble in:
abstract class
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$StringI
mpl extends com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl:
 protected transient void <init>(Class, javax.xml.namespace.QName[]):
                   ALOAD_0     //
Lcom/sun/xml/bind/v2/model/impl/RuntimeBuilti
nLeafInfoImpl$StringImpl; this   (line 100)
                   ALOAD_1     // Ljava/lang/Class; type
                   ALOAD_2     // [Ljavax/xml/namespace/QName; typeNames
                   ACONST_NULL
                   INVOKESPECIAL
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinL
eafInfoImpl.<init>
(Ljava/lang/Class;[Ljavax/xml/namespace/QName;Lcom/sun/xml/bi
nd/v2/model/impl/RuntimeBuiltinLeafInfoImpl$1;)V
   constructor-execution(void
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeaf
InfoImpl$StringImpl.<init>(java.lang.Class, javax.xml.namespace.QName[]))
   |               RETURN   (line 101)
   constructor-execution(void
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeaf
InfoImpl$StringImpl.<init>(java.lang.Class, javax.xml.namespace.QName[]))
 end protected transient void <init>(Class, javax.xml.namespace.QName[])

 public abstract String print(Object) throws
com.sun.xml.bind.api.AccessorExcep
tion;

 public void writeText(com.sun.xml.bind.v2.runtime.XMLSerializer, Object,
Strin
g) throws java.io.IOException, org.xml.sax.SAXException,
javax.xml.stream.XMLStr
eamException, com.sun.xml.bind.api.AccessorException:
                   ALOAD_1     //
Lcom/sun/xml/bind/v2/runtime/XMLSerializer; w
  (line 106)
                   ALOAD_0     //
Lcom/sun/xml/bind/v2/model/impl/RuntimeBuilti
nLeafInfoImpl$StringImpl; this
                   ALOAD_2     // Ljava/lang/Object; o
                   INVOKEVIRTUAL
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinL
eafInfoImpl$StringImpl.print (Ljava/lang/Object;)Ljava/lang/String;
                   ALOAD_3     // Ljava/lang/String; fieldName
                   INVOKEVIRTUAL
com.sun.xml.bind.v2.runtime.XMLSerializer.text
(Ljava/lang/String;Ljava/lang/String;)V
                   RETURN   (line 107)
 end public void writeText(com.sun.xml.bind.v2.runtime.XMLSerializer,
Object, S
tring) throws java.io.IOException, org.xml.sax.SAXException,
javax.xml.stream.XM
LStreamException, com.sun.xml.bind.api.AccessorException

 public void writeLeafElement(com.sun.xml.bind.v2.runtime.XMLSerializer,
com.su
n.xml.bind.v2.runtime.Name, Object, String) throws java.io.IOException,
org.xml.
sax.SAXException, javax.xml.stream.XMLStreamException,
com.sun.xml.bind.api.Acce
ssorException:
                   ALOAD_1     //
Lcom/sun/xml/bind/v2/runtime/XMLSerializer; w
  (line 110)
                   ALOAD_2     // Lcom/sun/xml/bind/v2/runtime/Name; tagName
                   ALOAD_0     //
Lcom/sun/xml/bind/v2/model/impl/RuntimeBuilti
nLeafInfoImpl$StringImpl; this
                   ALOAD_3     // Ljava/lang/Object; o
                   INVOKEVIRTUAL
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinL
eafInfoImpl$StringImpl.print (Ljava/lang/Object;)Ljava/lang/String;
                   ALOAD 4     // Ljava/lang/String; fieldName
                   INVOKEVIRTUAL
com.sun.xml.bind.v2.runtime.XMLSerializer.leaf
Element
(Lcom/sun/xml/bind/v2/runtime/Name;Ljava/lang/String;Ljava/lang/String;)
V
                   RETURN   (line 111)
 end public void
writeLeafElement(com.sun.xml.bind.v2.runtime.XMLSerializer, co
m.sun.xml.bind.v2.runtime.Name, Object, String) throws
java.io.IOException, org.
xml.sax.SAXException, javax.xml.stream.XMLStreamException,
com.sun.xml.bind.api.
AccessorException

 public volatile CharSequence print(Object) throws
com.sun.xml.bind.api.Accesso
rException:
                   ALOAD_0     //
Lcom/sun/xml/bind/v2/model/impl/RuntimeBuilti
nLeafInfoImpl$StringImpl; this   (line 98)
                   ALOAD_1     // Ljava/lang/Object; x0
                   INVOKEVIRTUAL
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinL
eafInfoImpl$StringImpl.print (Ljava/lang/Object;)Ljava/lang/String;
                   ARETURN
 end public volatile CharSequence print(Object) throws
com.sun.xml.bind.api.Acc
essorException

end abstract class
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$Str
ingImpl

       at
org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:47)

       at
org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageWriter.h
andleMessage(WeavingAdaptor.java:550)
       at
org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.
handleMessage(WeavingAdaptor.java:473)
       at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1641)
       at
org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1
562)
       at
org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:134
0)
       at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1160)
       at
org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.
java:331)
       at
org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.jav
a:237)
       at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76)
       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
org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:1779)
       at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:866)
       at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1319)
       at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1198)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       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
org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:1779)
       at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:866)
       at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1319)
       at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1198)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at
com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeT
ypeInfoSetImpl.java:25)
       at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(
RuntimeModelBuilder.java:78)
       at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(
RuntimeModelBuilder.java:41)
       at
com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:
97)
       at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeMode
lBuilder.java:44)
       at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContex
tImpl.java:320)
       at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.ja
va:198)
       at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
76)
       at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
55)
       at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
124)
       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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)

I got too this error:

GRAVE: Error inicializando punto final (endpoint)
java.net.BindException: Address already in use: JVM_Bind:9090
       at
org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoi
nt.java:297)
       at
org.apache.coyote.http11.Http11BaseProtocol.init(Http11BaseProtocol.j
ava:141)
       at
org.apache.catalina.connector.Connector.initialize(Connector.java:101
6)
       at
org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:580)
       at
org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:782)
       at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
       at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
       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.load(Bootstrap.java:247)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
23-ago-2006 15:01:09 org.apache.catalina.startup.Catalina load
GRAVE: Catalina.start
LifecycleException:  Fall¾ la inicializaci¾n del manejador de protocolo:
java.ne
t.BindException: Address already in use: JVM_Bind:9090
       at
org.apache.catalina.connector.Connector.initialize(Connector.java:101
8)
       at
org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:580)
       at
org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:782)
       at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
       at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
       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.load(Bootstrap.java:247)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
23-ago-2006 15:01:09 org.apache.catalina.startup.Catalina load

My aspect:

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;


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

   }

   /*@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;


   }


}

My aop.xml:

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

I´m using this build of aspectj the one that in the page is shown as Last
Known Good developer build.

http://www.eclipse.org/downloads/download.php?file=/technology/aspectj/dev/aspectj-DEVELOPMENT-20060822180527.jar

Thanks for the help.


> Subject
> 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/[1]
>
>
>
> 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
>
>
>
>
>
>


Back to the top