Hi,
I'm having basically the same problem, injection of beans into non-spring managed objects is working fine when I run unit tests, but not when running the application in appserver (Resin).
Both executions are within my IDE (Eclipse), I am running Resin as a regular java app in Eclipse for simplicity, and the aspectj jars are on the classpath in both cases.
When starting the unit test I have to provide the VM arg : -javaagent:${MAVEN_REPO}/org.springframework/jars/spring-agent-2.5.5.jar , otherwise there is an error message.
In the resin execution, it picks up the ReflectiveLoadTimeWeaver automatically, however unless I supply the javaagent there is no aspectj related log output - very odd?
Here is output from the unit test excecution (some trimming of unrelated stuff in logs to make it readable)
Code:
2008-10-14 18:35:51,132 INFO [main] org.springframework.context.weaving.DefaultContextLoadTimeWeaver - Found Spring's JVM agent for instrumentation
[AppClassLoader@9fbe93] info AspectJ Weaver Version 1.6.0 built on Wednesday Apr 23, 2008 at 20:27:36 GMT
[AppClassLoader@9fbe93] info register classloader sun.misc.Launcher$AppClassLoader@9fbe93
[AppClassLoader@9fbe93] info using configuration file:/Users/christian/.maven/repository/org.springframework/jars/spring-aspects-2.5.5.jar!/META-INF/aop.xml
[AppClassLoader@9fbe93] info register aspect org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect
[AppClassLoader@9fbe93] info register aspect org.springframework.transaction.aspectj.AnnotationTransactionAspect
2008-10-14 18:35:54,870 INFO [main] org.springframework.jdbc.datasource.DriverManagerDataSource - Loaded JDBC driver: com.mysql.jdbc.Driver
[AppClassLoader@9fbe93] weaveinfo Extending interface set for type 'estalea.ir.am.member.domain.Member' (Member.java) to include 'org.springframework.beans.factory.aspectj.AbstractInterfaceDrivenDependencyInjectionAspect$ConfigurableDeserializationSupport' (D:\projects\spring\spring\aspectj\src\org\springframework\beans\factory\aspectj\AnnotationBeanConfigurerAspect.aj)
[AppClassLoader@9fbe93] weaveinfo Extending interface set for type 'estalea.ir.am.member.domain.Member' (Member.java) to include 'org.springframework.beans.factory.aspectj.ConfigurableObject' (D:\projects\spring\spring\aspectj\src\org\springframework\beans\factory\aspectj\AnnotationBeanConfigurerAspect.aj)
[AppClassLoader@9fbe93] weaveinfo Type 'estalea.ir.am.member.domain.Member' (Member.java) has intertyped method from 'org.springframework.beans.factory.aspectj.AbstractInterfaceDrivenDependencyInjectionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\beans\factory\aspectj\AbstractInterfaceDrivenDependencyInjectionAspect.aj:'java.lang.Object org.springframework.beans.factory.aspectj.AbstractInterfaceDrivenDependencyInjectionAspect$ConfigurableDeserializationSupport.readResolve()')
[AppClassLoader@9fbe93] weaveinfo Join point 'initialization(void org.springframework.beans.factory.aspectj.ConfigurableObject.<init>())' in Type 'estalea.ir.am.member.domain.Member' (Member.java:101) advised by before advice from 'org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\beans\factory\aspectj\AbstractDependencyInjectionAspect.aj:78) [with runtime test]
[AppClassLoader@9fbe93] weaveinfo Join point 'initialization(void org.springframework.beans.factory.aspectj.ConfigurableObject.<init>())' in Type 'estalea.ir.am.member.domain.Member' (Member.java:101) advised by afterReturning advice from 'org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\beans\factory\aspectj\AbstractDependencyInjectionAspect.aj:87) [with runtime test]
and corresponding from the resin execution, with the -javaagent flag: (note the lack of "Member.java" weaving)
Code:
2008-10-14 19:11:05,275 INFO [main] org.springframework.context.weaving.DefaultContextLoadTimeWeaver - Found Spring's JVM agent for instrumentation
2008-10-14 19:11:17,512 INFO [main] org.springframework.orm.hibernate3.HibernateTransactionManager - Using DataSource [DBPool[jdbc/iramDS]] of Hibernate SessionFactory for HibernateTransactionManager
[EnvironmentClassLoader@32b694] info AspectJ Weaver Version 1.6.0 built on Wednesday Apr 23, 2008 at 20:27:36 GMT
[EnvironmentClassLoader@32b694] info register classloader com.caucho.loader.EnvironmentClassLoader@32b694
[EnvironmentClassLoader@32b694] info using configuration file:/Users/christian/.maven/repository/org.springframework/jars/spring-aspects-2.5.5.jar!/META-INF/aop.xml
[EnvironmentClassLoader@32b694] info register aspect org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect
[EnvironmentClassLoader@32b694] info register aspect org.springframework.transaction.aspectj.AnnotationTransactionAspect
2008-10-14 19:11:31,657 INFO [main] org.springframework.security.intercept.AbstractSecurityInterceptor - Validated configuration attributes
2008-10-14 19:11:31,777 WARN [main] org.springframework.security.intercept.AbstractSecurityInterceptor - Could not validate configuration attributes as the ObjectDefinitionSource did not return a ConfigAttributeDefinition collection
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(int $Proxy68.hashCode())' in Type '$Proxy68' (no debug info available) advised by before advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:60) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(int $Proxy68.hashCode())' in Type '$Proxy68' (no debug info available) advised by afterThrowing advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:67) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(int $Proxy68.hashCode())' in Type '$Proxy68' (no debug info available) advised by afterReturning advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:77) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(int $Proxy68.hashCode())' in Type '$Proxy68' (no debug info available) advised by after advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:82) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(estalea.base.entity.PersistentEntity $Proxy68.get(long))' in Type '$Proxy68' (no debug info available) advised by before advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:60) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(estalea.base.entity.PersistentEntity $Proxy68.get(long))' in Type '$Proxy68' (no debug info available) advised by afterThrowing advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:67) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(estalea.base.entity.PersistentEntity $Proxy68.get(long))' in Type '$Proxy68' (no debug info available) advised by afterReturning advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:77) [with runtime test]
[EnvironmentClassLoader@32b694] weaveinfo Join point 'method-execution(estalea.base.entity.PersistentEntity $Proxy68.get(long))' in Type '$Proxy68' (no debug info available) advised by after advice from 'org.springframework.transaction.aspectj.AnnotationTransactionAspect' (D:\projects\spring\spring\aspectj\src\org\springframework\transaction\aspectj\AbstractTransactionAspect.aj:82) [with runtime test]
Here is the corresponding resin output *without* the -javaagent flag - no aspectj related stuff at all even though log output flags set..
Code:
2008-10-14 19:19:48,562 INFO [main] org.springframework.context.weaving.DefaultContextLoadTimeWeaver - Using a reflective load-time weaver for class loader: com.caucho.loader.EnvironmentClassLoader
2008-10-14 19:19:59,525 INFO [main] org.springframework.orm.hibernate3.HibernateTransactionManager - Using DataSource [DBPool[jdbc/iramDS]] of Hibernate SessionFactory for HibernateTransactionManager
coming_file_cache,ir_ap_incoming_file_cache_mon,ir_ap_status_page,ir_ap_conversion_file_loader]; root of factory hierarchy
2008-10-14 19:20:01,912 INFO [main] org.springframework.ui.velocity.VelocityEngineFactoryBean - Loading Velocity config from [class path resource [velocity.properties]]
Any help greatly appreciated,
/ Christian