1

I m doing java instrumentation with BCEL. my java agent i m testing against some Java webapp, which is running on tomcat8.0 server. If i don't do instrumentation on every class loads in JVM (or don't do instrumentation on package starting with java, javax... org.apache/* ) then it works fine..

but if i do instrumentation on tomcat(package org.apache/*) then i get "StackMapTable error: bad offset" error.

 2015-05-30 20:11:44 Commons Daemon procrun stderr initialized
 java.lang.VerifyError: StackMapTable error: bad offset
 Exception Details:
 Location:
  org/apache/catalina/startup/Bootstrap.createClassLoader(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader; @0: new
Reason:
 Invalid stackmap specification.
 Current Frame:
 bci: @36
 flags: { }
 locals: { 'org/apache/catalina/startup/Bootstrap', 'java/lang/String', 'java/lang/ClassLoader', 'java/lang/String' }
stack: { }

 Bytecode:
 0x0000000: bb00 1259 b700 132b 3a10 1402 1219 10b8
 0x0000010: 0208 1910 b600 1412 153a 1014 0214 1910
0x0000020: b802 0819 10b6 0014 b600 163a 1014 0216
0x0000030: 1910 b802 0819 10b8 0017 4e2d c600 102d
0x0000040: 1218 3a0d 190d b600 1999 0005 2cb0 2a2d
0x0000050: 3a10 1402 1819 10b8 0208 1910 b600 1a4e
0x0000060: bb00 1b59 b700 1c3a 042d 3a10 1402 1a19
0x0000070: 10b8 0208 1910 b800 1d3a 0519 053a 0619
0x0000080: 06be 3607 0336 0815 0815 07a2 0119 1906
0x0000090: 1508 323a 09bb 001e 5919 093a 1014 021c
0x00000a0: 1910 b802 0819 10b7 001f 3a0a 1904 bb00
0x00000b0: 2059 1909 b200 213a 0b3a 1014 021e 1910
0x00000c0: b802 0819 1019 0bb7 0022 3a0d 190d b900
0x00000d0: 2302 0057 a700 ca3a 0a19 0912 253a 1014
0x00000e0: 0220 1910 b802 0819 10b6 0026 9900 4919
0x00000f0: 0903 1909 b600 2712 25b6 0027 6436 0f36
0x0000100: 0e15 0e15 0fb6 0028 3a09 1904 bb00 2059
0x0000110: 1909 b200 293a 0b3a 1014 0222 1910 b802
0x0000120: 0819 1019 0bb7 0022 3a0d 190d b900 2302
0x0000130: 0057 a700 6c19 0912 2a3a 1014 0224 1910
0x0000140: b802 0819 10b6 0026 9900 2e19 04bb 0020
0x0000150: 5919 09b2 002b 3a0b 3a10 1402 2619 10b8
0x0000160: 0208 1910 190b b700 223a 0d19 0db9 0023
0x0000170: 0200 57a7 002b 1904 bb00 2059 1909 b200
0x0000180: 2c3a 0b3a 1014 0228 1910 b802 0819 1019
0x0000190: 0bb7 0022 3a0d 190d b900 2302 0057 8408
0x00001a0: 01a7 fee6 1904 2c3a 113a 0c19 0c19 11b8
0x00001b0: 002d b0                                
Exception Handler Table:
bci [149, 212] => handler: 215
Stackmap Table:
append_frame(@36,Object[#191])
same_frame(@38)
full_frame(@71,{Object[#192],Object[#191],Object[#193],Object[#191],Object[#194],Object[#129],Object[#129],Integer,Integer},{})
full_frame(@119,{Object[#192],Object[#191],Object[#193],Object[#191],Object[#194],Object[#129],Object[#129],Integer,Integer,Object[#191]},{Object[#195]})
same_frame(@173)
same_frame(@206)
chop_frame(@226,1)
chop_frame(@232,3)

i know tomcat is running before instrumentation started. but according to run time instrumentation, instrumentation only happen when a class is about to load not after loading.since tomcat is already running so those classes are already in JVM, i m only instrumenting new classes which brought to JVM, so it doesnt matter if tomcat is running or not because i m not touching classes which are already in JVM. do anyone has idea?

rahulk
  • 175
  • 3
  • 15

1 Answers1

0

Try adding "-XX:-UseSplitVerifier" JVM argument while running the application that may solve your problem.

Ulhas N
  • 316
  • 4
  • 17