Announcement Announcement Module
Collapse
No announcement yet.
noclassdef error for spring instrument jar while passing javaagent argument Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • noclassdef error for spring instrument jar while passing javaagent argument

    Hi,
    i am trying to do spring LTW.
    for this i have enabled following in config xml
    Code:
    <context:spring-configured/>
       <context:load-time-weaver/>
       <aop:aspectj-autoproxy/>
    i am passing -javaagent argument to VM, poiniting to org.springframework.instrument-3.0.5.RELEASE.jar
    Code:
    -javaagent:D:\org.springframework.instrument-3.0.5.RELEASE.jar
    but i get NoClassDefFoundError while runing application
    i use @aspect annotation style coding
    my app is simple java application.so i guess there shouldnt be any issue of web server.

    please point proper way for spring LTWeaving.
    i am able to run aop enabled app untill i dont use DI of pojo's to aspect classes.
    but to have DI in my aspect classes i wanted LTW

    share ur experience regarding such a senario.
    thanks
    Narayan

  • #2
    Some questions:
    - are you trying to use AspectJ instead of Spring AOP?
    - What is the class for which you are getting NoClassDefFoundError?
    - Are you running a webapp or stand along app?
    - Are you running from withing eclipse or maven or other?

    Comment


    • #3
      hi,
      1>i am trying for spring LTW.annotation <context:load-time-weaver/> in config xml is no more there which i guess is not needed in case of spring weaving
      2>i get NoClassDefError for main class in spring-instrumentation jar which i pass as -javaagent argument
      3>its a standalone j2se app
      4>running it with in eclipse only.

      if you can explain on when exctaly we need LTW instead of CTW.because using CTW am able to run application perfactly.

      thanks
      narayan

      Comment


      • #4
        Make sure you have all needed dependencies. It seems you are missing spring-instrument jar.

        As per the documentation ( http://static.springsource.org/sprin...rence/aop.html especially section 7.8.4 Load-time weaving with AspectJ in the Spring Framework ):
        Required libraries (JARS)
        At a minimum you will need the following libraries to use the Spring Framework's support for AspectJ LTW:

        spring-aop.jar (version 2.5 or later, plus all mandatory dependencies)

        aspectjrt.jar (version 1.5 or later)

        aspectjweaver.jar (version 1.5 or later)

        If you are using the Spring-provided agent to enable instrumentation, you will also need:

        spring-instrument.jar
        Make sure you have all those Jars in your classpath.

        Regards.

        Comment

        Working...
        X