Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ third-party class is not weaved in weblogic

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 woven loaded.
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

yev 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.


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 '<>'

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.


Back to the top