cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with LoadTimeWeaving

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Satya.

In the Spring 2.5 reference doc, in the Table 6.1. DefaultContextLoadTimeWeaver LoadTimeWeavers at this [link|http://static.springsource.org/spring/docs/2.5.6/reference/aop.html#aop-aj-ltw-environments], you can see the LoadTimeWeaver implementation class named InstrumentationLoadTimeWeaver. Well, in according to the table it could be applied to JVM direclty.

I'm not sure but you could try locally by modifing how the server is started up by adding -javaagent:path/to/spring-agent.jar.

For this task you must review the SAP Note 597187 - J2EE crashes with OutOfMemory on SUN JDK.

Kindest regards.

Manuel Loayza