Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Issue with LoadTimeWeaving

I'm using AspectJ Weaving in my code.

When I run in standalone mode, I'm giving the JVM argument as -javaagent:WebContent/WEB-INF/lib/spring-agent.jar

and it is running fine.

But I need to invoke that from a Web Client in SAP NetWeaver 7.1 WebAS.

When running the application after deploying in SAP NetWeaver 7.1 WebAS, I'm getting the below exception,

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': 
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: 
ClassLoader [com.sap.engine.boot.loader.ResourceMultiParentClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. 
Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:spring-agent.jar

From the spring documentation, I understood that the LoadTimeWeaver specific to that server will be automatically picked up by default.

In my case, it is not found means, is my application server not suporting loadtimeweaving...?

I tried to specify the LoadTimeWeaver explicity using,

<context:load-time-weaver weaver-class="org.springframework.instrument.classloading .ReflectiveLoadTimeWeaver" />

Still, I'm getting the similar exception

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0': 
Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'loadTimeWeaver': 
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Could not instantiate bean class [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver]: 
Constructor threw exception; nested exception is java.lang.IllegalStateException: 
ClassLoader [com.sap.engine.boot.loader.ResourceMultiParentClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method.

Any resolution for my issue please...!

Former Member
Not what you were looking for? View more on this topic or Ask a question