Interaction with AOP

Questions about YourKit Java Profiler
Post Reply
cahaverl
Posts: 3
Joined: Mon Jun 16, 2008 8:57 pm

Interaction with AOP

Post by cahaverl »

I'm using YourKit 7.5.2 with JBoss 4.0.4 and Spring framework 2.0.6. When I try to start up my .ear file under the profiler from Eclipse 3.3, I get an exception and the deployment is aborted. When I run directly with no profiling, the code starts up fine. I tried this with both JDK 1.5.0 and 1.6 under MacOS Leopard. The Exception follows.

Carl

Code: Select all

13:05:57,442 INFO  [ContentDomainAuthenticationFilter] Setting LandingPageBaseUrl: https://www.next-dev.sflab.acrobat.com
13:05:57,717 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventMessengingListener' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot create inner bean 'jmsQueueParent$child#5513f9a2' of type [org.springframework.jndi.JndiObjectFactoryBean] while setting bean property 'destination'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueParent$child#5513f9a2' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: java.lang.ClassFormatError: Illegal exception table range in class file $Proxy71
Caused by: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueParent$child#5513f9a2' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: java.lang.ClassFormatError: Illegal exception table range in class file $Proxy71
Caused by: 
java.lang.IllegalArgumentException: java.lang.ClassFormatError: Illegal exception table range in class file $Proxy71
	at java.lang.reflect.Proxy.getProxyClass(Proxy.java:514)
	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
	at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:117)
	at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
	at org.springframework.jndi.JndiObjectFactoryBean$JndiObjectProxyFactory.createJndiObjectProxy(JndiObjectFactoryBean.java:282)
	at org.springframework.jndi.JndiObjectFactoryBean$JndiObjectProxyFactory.access$000(JndiObjectFactoryBean.java:265)
	at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:173)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

Hello Carl

Please look into this thread: http://forums.yourkit.com/viewtopic.php?t=782

This seems related. The problem was that AspectJ incorrectly instrumented the bytecode when it ran with profiler. The problem appeared for certain application only with profiler because the profiler (correctly!) instrumented the bytecode inserting instructions which AspectJ, in its turn, handled incorrectly.

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

P.S.:

The workaround for that AspectJ bug was to ensure that AspectJ instrumentation is performed _before_ the profiler's instrumentation.

To achieve this, profiling and AspectJ weaving should be manually configured by placing corresponding VM parameters in appropriate order (first -agentpath:full_path_to_yjpagent.dll for the profiler, then -javaagent for aspectjweaver), and using "Run" instead of "Profile". Using "Profile", the parameter order depends on Eclipse internals implementation detail and cannot be affected.
cahaverl
Posts: 3
Joined: Mon Jun 16, 2008 8:57 pm

Post by cahaverl »

That works. Thanks.
Post Reply