Correction, see below:
Alexander Kriegisch schrieb am 03.03.2019 10:11:
Without an MCVE it is difficult to say anything definitive, but in general you seem to have one of two possible problems:
- Class visibility issues due to classloader isolation inside your container (application server): Maybe the two classloaders loading the aspect JAR and the WAR/EAR to be woven are isolated from each other.
- Class-loading order: Maybe your aspect JAR is loaded after the target classes have already been
wovenloaded.There might be other possible causes, I am by no means a container expert because I mainly work with Java SE and without application servers. I think you need to change your configuration in order to address this issue. What to do exactly is beyond my knowledge. Maybe Andy knows more. Maybe it would also help to push an MCVE to GitHub for everyone to reproduce to problem.
--
Alexander Kriegisch
https://scrum-master.deyev yev schrieb am 02.03.2019 16:19:
I am trying to "Weave" a third-party jar with AspectJ using aspectj agent.
First test case:
MyAspectJImpl.jar - contains class with my aspect and aop.xml (with debug enabled)inside Meta-inf with correct mapping, and a test main class.
third-party.jar
aspectJ core jars.
I execute main class in commandline
java -javaagent:aspectjweaver.jar -cp ...
on console see that that third party class was weaved, and my implementation works.
Second test case:
I move to weblogic aspectj agent is set in script that starts weblogic. thirparty jar is added to classpath in that script.
in weblogic log I see that my aop was loaded
[ChangeAwareClassLoader@48537e4f] info AspectJ Weaver Version 1.7.1 built on Thursday Sep 6, 2012 at 16:39:22 GMT [ChangeAwareClassLoader@48537e4f] info register classloader weblogic.utils.classloaders.ChangeAwareClassLoader@48537e4f [DependencyClassLoader@4d5932c7] info using configuration <path_to_my_aop.xml>
But this time i don't see in the log:
debug weaving '<third.party.class>'
I do see other weavings classes (from other aop.xml that are also deployed).
(i verified that other aop.xmls don't exclude the thirdparty )for example:
[GenericClassLoader@62b46385] debug weaving 'com.core.BasicSessionBean'
(this class is inside an ear which is deployed)
I also verified that third party class was loaded (verbose:class).
Any idea how to identify why that class was not weaved?
The only difference that I see, that weaved classes are inside deployed ear file.
Thirdparty classes are inside jar that added to classpath when starting weblogic.Server.
I can provide aop.xml but I don't think it's important because it worked in my first test case.
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/aspectj-users