pinpoint-apm/pinpoint · error · OracleConnectionStringException

Syntax error.

Error message

Syntax error. <token>

What it means

parseKeyValue()'s while loop handles TYPE_KEY_START, TYPE_KEY_END and TYPE_LITERAL; the final else is a safety net that fires when an unexpected token type (e.g. an EOF token) reaches the loop, so the descriptor ended in the middle of a key-value structure. The thrown message includes the offending token text for diagnosis.

Solutions

  1. Ensure the descriptor is complete and balanced — every '(' has a matching ')' and every '=' a value
  2. Check that env/template variables in the URL are actually resolved before parsing
  3. Re-copy the URL from the authoritative tnsnames.ora or connection string source
  4. Use the simple jdbc:oracle:thin:@host:port:SID format to sidestep descriptor parsing

Example fix

// before
String url = "jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME="; // ends mid-value
// after
String url = "jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=svc)))";
Defensive patterns

Strategy: validation

Validate before calling

static boolean descriptorWellFormed(String url) {
    return url != null && url.contains("=@") == false && url.endsWith(")") && isBalanced(url)
        && !url.contains("$"); // reject unexpanded template variables
}

Try / catch

try {
    parser.parse(url);
} catch (OracleConnectionStringException e) {
    log.error("Unexpected token in Oracle descriptor (likely EOF mid-structure): {}", url, e);
    throw new ConfigurationException("Malformed oracle descriptor", e);
}

Prevention

When it happens

Trigger: An EOF or otherwise unhandled token reaching parseKeyValue before a return — e.g. a descriptor ending with '(KEY=' or an unterminated nested block, where lookAheadToken returns EOF instead of null.

Common situations: Truncated URLs from environment variables cut off mid-descriptor; secrets/URLs split across lines with the second line lost; template placeholders like ${...} left unexpanded inside the descriptor producing odd tokens.

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

Appendix: source

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

                if (nonTerminalValue) {
                    throw new OracleConnectionStringException("Syntax error. expected token:'(' or ')' :" + token.getToken());
                }
                // We already have checked current token by lookAheadToken(). Proceed to next token.
                this.tokenizer.nextPosition();

                keyValue.setValue(token.getToken());
                this.tokenizer.checkEndToken();
                return keyValue.build();
            } else if(token.getType() == OracleNetConnectionDescriptorTokenizer.TYPE_KEY_END){
                this.tokenizer.nextPosition();
                // This could happen if value is empty.
                // Does it allow empty value?
                return keyValue.build();
            } else {
                // Cannot reach here because we checked all those possible cases, START, END and LITERAL.
                // Adding new token type could cause error.
                // In case of syntax error, EOF can come to here. 
                throw new OracleConnectionStringException("Syntax error. " + token.getToken());
            }
        }

    }

}

View on GitHub (pinned to 744c3d3075)