pinpoint-apm/pinpoint · error · IllegalArgumentException

invalid oracle jdbc url. expected token:(thin or oci) url:<u

Error message

invalid oracle jdbc url. expected token:(thin or oci) url:<url>

What it means

OracleNetConnectionDescriptorParser.parse(url) expects the normalized JDBC URL to start with a driver-type token: 'thin' or 'oci'. If it starts with neither, it throws IllegalArgumentException('invalid oracle jdbc url. expected token:(thin or oci) url:...').

Source

Thrown at agent-module/plugins/oracle-jdbc/src/main/java/com/navercorp/pinpoint/plugin/jdbc/oracle/parser/OracleNetConnectionDescriptorParser.java:52

    public OracleNetConnectionDescriptorParser(String url) {
        this.url = url;
        this.normalizedUrl = url.toLowerCase();
        this.tokenizer = new OracleNetConnectionDescriptorTokenizer(normalizedUrl);
    }

    public KeyValue<?> parse() {
        // You can find driver spec here: http://docs.oracle.com/cd/B14117_01/java.101/b10979/urls.htm
        // It's for 10g but maybe 11g would be same.
        
        int position;
        if (normalizedUrl.startsWith(THIN)) {
            position = nextPosition(THIN);
            driverType = DriverType.THIN;
        } else if(normalizedUrl.startsWith(OCI)) {
            position = nextPosition(OCI);
            driverType = DriverType.OCI;
        } else {
            throw new IllegalArgumentException("invalid oracle jdbc url. expected token:(" + THIN + " or " + OCI + ") url:" + url);
        }

        // skip thin string
        this.tokenizer.setPosition(position);

        this.tokenizer.parse();
        KeyValue<?> keyValue = parseKeyValue();

        checkEof();

        return keyValue;
    }

    private void checkEof() {
        Token eof = this.tokenizer.nextToken();
        if (eof == null) {
            throw new OracleConnectionStringException("parsing error. expected token:'EOF' token:null");
        }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Use jdbc:oracle:thin:@... or jdbc:oracle:oci:@... URL syntax
  2. Check that the driver type segment wasn't accidentally stripped before parsing
  3. Verify the URL matches the forms the parser supports (@host:port:sid, @(DESCRIPTION=...), etc.)
  4. Log/inspect the exact url value in the exception to see what was actually passed

Example fix

// before
jdbc:oracle:kprbz:@(DESCRIPTION=...)
// after
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=h)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))
Defensive patterns

Strategy: validation

Validate before calling

String norm = url.toLowerCase();
if (!(norm.contains(":thin:") || norm.contains(":oci:") || norm.startsWith("thin") || norm.startsWith("oci"))) {
    throw new IllegalArgumentException("unsupported oracle url: " + url);
}

Type guard

static boolean hasSupportedDriverType(String u) {
    String n = u == null ? "" : u.toLowerCase();
    return n.contains("thin") || n.contains("oci");
}

Try / catch

try {
    OracleNetConnectionDescriptorParser.parse(url);
} catch (IllegalArgumentException e) {
    // url lacks thin/oci token — reject or normalize the URL
}

Prevention

When it happens

Trigger: Calling parse() with a JDBC URL whose prefix (after normalization) is not 'thin' or 'oci' — e.g. unknown driver types, already-stripped URLs, or non-descriptor URLs like jdbc:oracle:drizzle:@....

Common situations: Using an unsupported Oracle driver type in the URL; passing a raw host[:port][/service] URL to the descriptor parser instead of a @(...)/@(DESCRIPTION...) form; older/newer Oracle URL syntax variants.

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/d1d455186f5d15bf. Report an issue: GitHub.