Pivotal Knowledge Base

Follow

"NoSuchFieldError: ajc$cflowCounter$0" with instrumented Spring together with Insight enabled tcServer 2.1 (2015226)

 

Purpose

Instrumented Spring products are compile-time woven versions of the core Spring Framework, Web Services, Web Flow, and Security JARs, instrumented for management and monitoring. The instrumentation auto-discovers applications as managed resources, automatically exporting application beans to JMX for management.
 
On the other hand, Spring Insight uses AspectJ to snoop on operations in target web applications. Target web applications are loaded with a special classloader that dynamically instruments web applications at runtime. This double instrumentation often leads to problems known as overweaving. The exception you can encounter in this case is similar to this:
ERROR [org.springframework.web.context.ContextLoader] - java.lang.NoSuchFieldError: ajc$cflowCounter$0

Resolution

AspectJ 1.6.9 contains a support feature called overweaving. For more information, see Andy Clement's blog on AspectJ Overweaving. 

To enable overweaving in AspectJ, you must use option -Xset:overWeaving=true. In terms of tcServer (with Insight enabled), there are two options to enable the overweaving feature:
  • Use the latest version of tcServer (min. 2.1).
  • Update aspecjtweaver-*.jar present in lib with AspectJ 1.6.9 or later.
In both cases, the parameter -Daspectj.overweaving=true has to be used (bin/setenv.sh) in JVM_OPTS.


©VMware 2013

Comments

Powered by Zendesk