add spring-agent dependency
<dependency>
  <groupid>org.springframework</groupid>
  <artifactid>spring-agent</artifactid>
  <scope>test</scope>
</dependency>


also add arg-line to maven-surefire-plugin e.g.
        
<argLine>-javaagent:${user.home}/.m2/repository/org/springframework/spring-agent/2.5.6/spring-agent-2.5.6.jar</argLine>

http://ketilsjavablog.blogspot.com/2009/01/loadtimeweaver-in-unit-tests-with.html

hth
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Wed, 27 May 2009 17:45:02 -0400
> Subject: issue with load time weaving and Maven
> From: mknut...@baselogic.com
> To: users@maven.apache.org
> 
> I have an issue trying to use Load Time weaving with Spring.
> 
> With the addition of the weaving context:
> *<context:load-time-weaver />*
> 
> I get this error when running :
> *Caused by: 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
> [sun.misc.Launcher$AppClassLoader] 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
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> *
> 
> I see some posts talk about the same issue with Jetty:
> *http://forum.springsource.org/archive/index.php/t-58666.html
> *
> 
> then a fix would be to add:
> *When I start maven jetty:run with the following set:
> set MAVEN_OPTS=-javaagent:"C:\Documents and
> Settings\Administrator\.m2\repository\org\springfr
> amework\spring-agent\2.5.4\spring-agent-2.5.4.jar"
> *
> 
> But I tried that and it does not work.
> 
> I also have the dependency like this:
> *<dependency>
> <groupId>org.springframework</groupId>
> <artifactId>spring-agent</artifactId>
> <version>${spring.version}</version>
> <scope>provided</scope>
> </dependency>
> *
> 
> 
> Can anyone help me to get Maven to play well?
> 
> 
> ---
> Thank You…
> 
> Mick Knutson, President
> 
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (866) BLiNC-411: (254-6241-1)
> f. (415) 685-4233
> 
> Website: http://baselogic.com
> Linked IN: http://linkedin.com/in/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
> ---

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage1_052009

Reply via email to