Ack, I need some help. I've gone over the 2.1 documentation (sections 6.8.1 and 6.8.4) several times and I cannot seem to get @Configurable working with load-time-weaving. There has to be something that I'm missing in my configuration but I cannot spot it. If anyone out there would be kind enough to go over my config and see if you can spot anytyhing, I'd be very grateful for the help.
JPA Entity
data-context.xmlCode:@Configurable @Entity public class StandardMenu extends BaseStandardMenu { @Transient StandardMenuDao standardMenuDao; public void setStandardMenuDao(StandardMenuDao standardMenuDao) { this.standardMenuDao = standardMenuDao; } @PrePersist @PreUpdate void doAudit() { if (id != null) { StandardMenu menu = standardMenuDao.getById(id); audits.add(new StandardMenuAudit(menu)); } modifiedBy = "foo"; // TODO replace with real value modifiedDate = new Date(); } }
META-INF/aop.xmlCode:<context:spring-configured/> <context:load-time-weaver/> <bean id="standardMenu" class="com.mycompany.menu.data.model.StandardMenu" scope="prototype"> <property name="standardMenuDao" ref="standardMenuDao"/> </bean> <bean id="standardMenuDao" class="com.mycompany.menu.data.dao.JpaStandardMenuDaoImpl"/>
Dependencies:Code:<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"> <aspectj> <weaver> <include within="com.mycompany.menu.data.model.*"/> </weaver> <aspects> <aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/> </aspects> </aspectj>
Code:spring-2.1-m3.jar spring-aspects-2.1-m3.jar spring-agent-2.1-m3.jar aspectjweaver-1.5.3.jar aspectjrjt-1.5.3.jar
In the JPA Entity above, standardMenuDao is always null according to my unit tests.
- edit -
I forgot to mention that I'm starting the jvm with the javaagent:
I get a nasty exception if I do not:Code:-javaagent:C:\dev\server\jboss-4.2.1.GA\lib\spring-agent-2.1-m3.jar
Code: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


Reply With Quote
