diff --git a/src/main/java/com/profiler/TomcatProfiler.java b/src/main/java/com/profiler/TomcatProfiler.java index 9fa8f6e71..488e0d5f2 100644 --- a/src/main/java/com/profiler/TomcatProfiler.java +++ b/src/main/java/com/profiler/TomcatProfiler.java @@ -47,19 +47,28 @@ public class TomcatProfiler implements ClassFileTransformer { String[] paths = getTomcatlibPath(); this.byteCodeInstrumentor = new JavaAssistByteCodeInstrumentor(paths); this.modifierRepository = createModifierRegistry(byteCodeInstrumentor); - } - private String[] getTomcatlibPath() { - String catalinaHome = System.getProperty("catalina.home"); - if (catalinaHome == null) { - return null; - } - if (logger.isLoggable(Level.INFO)) { - logger.info("CATALINA_HOME=" + catalinaHome); - } - return new String[] {catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar"}; - } + private String[] getTomcatlibPath() { + String catalinaHome = System.getProperty("catalina.home"); + + if (catalinaHome == null) { + return null; + } + + if (logger.isLoggable(Level.INFO)) { + logger.info("CATALINA_HOME=" + catalinaHome); + } + + // TODO This is draft. How can we support both Tomcat and BLOC without this configuration? + String type = System.getProperty("hippo.servertype", "tomcat"); + + if (type.equals("bloc")) { + return new String[] { catalinaHome + "/server/lib/catalina.jar", catalinaHome + "/common/lib/servlet-api.jar" }; + } else { + return new String[] { catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar" }; + } + } private ModifierRegistry createModifierRegistry(ByteCodeInstrumentor byteCodeInstrumentor) { DefaultModifierRegistry modifierRepository = new DefaultModifierRegistry(byteCodeInstrumentor, profilerConfig);