/** * Checks for the correct setup of the jvm parameters or tries to append the inspectit agent to * the bootstrap class loader search automatically (Java 6+ required). */ private static void checkForCorrectSetup() { try { // we can utilize the mechanism to add the inspectit-agent to the bootstrap classloader // through the instrumentation api. instrumentation.appendToBootstrapClassLoaderSearch(new JarFile(getInspectItAgentJarFileLocation())); instrumentCoreClasses = true; } catch (SecurityException e) { LOGGER.info("inspectIT Agent: Advanced instrumentation capabilities not detected due to security constraints..."); } catch (Exception e) { LOGGER.severe("Something unexpected happened while trying to get advanced instrumentation capabilities!"); e.printStackTrace(); // NOPMD } if (!instrumentCoreClasses) { // 2. try // find out if the bootclasspath option is set List<String> inputArgs = ManagementFactory.getRuntimeMXBean().getInputArguments(); for (String arg : inputArgs) { if (arg.contains("Xbootclasspath") && arg.contains("inspectit-agent.jar")) { instrumentCoreClasses = true; LOGGER.info("inspectIT Agent: Xbootclasspath setting found, activating core class instrumentation..."); break; } } } }
File agentFile = getInspectItAgentJarFileLocation(); if (isJar(agentFile.getAbsolutePath())) { addJarResource(agentFile);
Object realAgent = constructor.newInstance(getInspectItAgentJarFileLocation(), inst);