pinpoint-apm/pinpoint · error · IllegalArgumentException

!/ not found

Error message

!/ not found 

What it means

Thrown by JavaAgentPathResolver.getJarLocation when the class location URL uses the 'jar' protocol but its path does not contain the '!/' separator that separates the jar file path from the entry inside it. The resolver cannot extract the agent jar path from such a URL, so it fails fast with IllegalArgumentException.

Source

Thrown at agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JavaAgentPathResolver.java:101

            // get bootstrap.jar location
            String jarLocation = getJarLocation(this.className);
            logger.info("agentPath:" + jarLocation);
            // escape windows leading slash
            return Paths.get(URI.create(jarLocation));
        }

        String getJarLocation(String className) {
            final String internalClassName = className.replace('.', '/') + ".class";
            final URL classURL = getResource(internalClassName);
            if (classURL == null) {
                return null;
            }

            if ("jar".equals(classURL.getProtocol())) {
                String path = classURL.getPath();
                int jarIndex = path.indexOf("!/");
                if (jarIndex == -1) {
                    throw new IllegalArgumentException("!/ not found " + path);
                }
                final String agentPath = path.substring(0, jarIndex);
                return agentPath;
            }
            // unknown
            return null;
        }

        private URL getResource(String internalClassName) {
            return ClassLoader.getSystemResource(internalClassName);
        }

    }

    @Deprecated
    static class InputArgumentAgentPathFinder implements AgentPathFinder {

        private final BootLogger logger = BootLogger.getLogger(getClass());

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Launch the agent as designed: use -javaagent pointing directly at pinpoint-bootstrap.jar on a plain classloader
  2. Check the logged URL path to see why '!/' is missing; avoid nested-jar launchers for the agent bootstrap
  3. If embedded, ensure the bootstrap jar is on the filesystem as a real file, not inside another jar
  4. Fall back to resolving the agent path via java.class.path or the -javaagent system property instead

Example fix

// before
java -cp app.jar org.springframework.boot.loader.JarLauncher // bootstrap class resolved via nested jar URL -> '!/ not found'
// after
java -javaagent:/opt/pinpoint-agent/pinpoint-bootstrap.jar -jar app.jar // resolver finds real jar path
Defensive patterns

Strategy: fallback

Validate before calling

URL loc = PinpointAgent.class.getProtectionDomain().getCodeSource().getLocation();
if ("jar".equals(loc.getProtocol()) && !loc.getPath().contains("!/")) { log.warn("malformed jar URL: " + loc); }

Type guard

boolean hasJarSeparator(URL u) { return "jar".equals(u.getProtocol()) && u.getPath().contains("!/"); }

Try / catch

try { String loc = resolver.getJarLocation(); } catch (IllegalArgumentException e) { // fall back to -javaagent system property parsing }

Prevention

When it happens

Trigger: Locating PinpointAgent.class where the classloader returns a jar-protocol URL with a malformed/nonstandard path (no '!/'), e.g. unusual nested jar URL schemes, custom classloading setups, or running via exotic launchers (Spring Boot nested jars, IDE run wrappers).

Common situations: Launching the pinpoint agent inside frameworks that remap jar URLs (Spring Boot fat jar, OSGi, one-jar); IDE-launched agents; shaded or repackaged bootstrap jars.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/6dc1154981b2d5d3. Report an issue: GitHub.