Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: (RESOLVED?) RE: [aspectj-users] Important aspects of JDK 1.4 weaving


Bo,

Replacing the system class loader is tricky so that's why we supply a script. You can't remove the old loader as there would be nothing to load the new loader  (unless you put it in ext or boot and that wouldn't be acceptable). This technique is not appropriate for use with application servers (just simple command line programs) that's why we have the agents including the one for JRockit which is described here http://www.eclipse.org/aspectj/doc/released/devguide/ltw-agents.html and works with JDK 1.4. What's your issue with JRockit?

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/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        <aspectj-users@xxxxxxxxxxx>
cc:        
Subject:        (RESOLVED?) RE: [aspectj-users] Important aspects of JDK 1.4 weaving


A little more research uncovered the issue I was having, and provided some
insight into 1.4 loadtime weaving.

It appears that the way aspectj JDK1.4 loadtime weaving works is by
purposefully denying the SUN classloader access to your application classes.
The way this is done is by denying it access to the CLASSPATH list itself.
The only thing allowed in the classpath is the aspectjweaver.jar classes --
everything else appears to be verbotten.  

If my theory is correct, the -Djava.system.class.loader appears to NOT be
replacing the SUN classloader as much as supplementing it for cases when a
class can not be found by the standard system classloader.  Since the
CLASSPATH is practically empty, that would pretty much be all the time.

In those cases, the JVM allows the -Djava.system.class.loader (in this case
aspectj) to take over and load the classes itself, thereby permitting
weaving to occur.  Since the -Daj.class.path variable DOES contain the path
to all relevant classes, aspectj has full access to everything it needs to
do the job the SUN classloader normally does, plus its own special AOP magic
of course.

And it works -- until it doesn't, as is the case with BEA WebLogic 8.1.
Applying the above Logic (emptying the CLASSPATH variable of all entries
except for aspectj and moving those entries to -Daj.class.path) creates
whole other issues (Shown below).  Still trying to figure out what that
means.  The BEA site is all about using jrocket for loadtime weaving, and
that's unacceptable to me...

Anyway, enjoy the info for what its worth!  Hopefully some large brained
individual can come along and tell me how close my theory is to
correctitude!

- Bo

"C:\dev\bea810\jdk142_08\bin\java" -client -classpath
c:\dev\libs\aspectj-1.5.1_a\lib\aspectjweaver.jar
-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader
"-Daj.class.path=C:\dev\aspects.jar;C:\dev\bea810\jdk142_08\lib\tools.jar;C:
\dev\bea810\WEBLOG~1\server\lib\weblogic_sp.jar;C:\dev\bea810\WEBLOG~1\serve
r\lib\weblogic.jar;C:\dev\bea810\WEBLOG~1\common\eval\pointbase\lib\pbserver
44.jar;C:\dev\bea810\WEBLOG~1\common\eval\pointbase\lib\pbclient44.jar;C:\de
v\bea810\jdk142_08\jre\lib\rt.jar;C:\dev\bea810\WEBLOG~1\common\eval\pointba
se\lib\pbclient44.jar;C:\dev\bea810\jdk142_08\jre\lib\rt.jar;C:\dev\bea810\W
EBLOG~1\server\lib\webservices.jar" "-Daj.aspect.path=C:\dev\aspects.jar"
-Xms32m -Xmx200m -XX:MaxPermSize=128m  -Dlog4j.config=log4j.properties
-Dcom.bea.medrec.xml.incoming=incoming
-Dphys.app.wsdl.url=""> -Dweblogic.Name=MedRecServer -Dweblogic.ProductionModeEnabled=
-Djava.security.policy="C:\dev\bea810\WEBLOG~1\server\lib\weblogic.policy"
weblogic.Server
***************************************************************************
The WebLogic Server did not start up properly.
java.lang.ExceptionInInitializerError
       at
weblogic.management.internal.BootStrap.<clinit>(BootStrap.java:118)
       at
weblogic.security.internal.BootProperties.<clinit>(BootProperties.jav
a:38)
       at
weblogic.security.internal.ServerAuthenticate.main(ServerAuthenticate
.java:98)
       at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:334)
       at weblogic.Server.main(Server.java:32)
Caused by: java.lang.NullPointerException
       at weblogic.Home.<init>(Home.java:29)
       at weblogic.Home.getInstance(Home.java:86)
       at weblogic.Home.getPath(Home.java:94)
       at
weblogic.management.internal.BootStrapConstants.<clinit>(BootStrapCon
stants.java:100)
       ... 5 more

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


Back to the top