hibernate/hibernate-orm · error · SchemaManagementException
Unable to open specified script source url [
Error message
Unable to open specified script source url [
What it means
Raised when a script SOURCE given as a URL cannot be opened: url.openStream() threw IOException. Two practical traps: the original IOException is NOT chained (message-only exception), so the real reason is hidden; and the charset name is embedded in the message because an unsupported charset makes the InputStreamReader constructor throw UnsupportedEncodingException — an IOException caught here. Diagnose by opening the URL yourself.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/tool/schema/internal/exec/ScriptSourceInputFromUrl.java:53
this.url = url;
this.charsetName = charsetName;
}
@Override
public String getScriptDescription() {
return url.toExternalForm();
}
@Override
protected Reader prepareReader() {
try {
final var stream = url.openStream();
return charsetName != null
? new InputStreamReader( stream, charsetName )
: new InputStreamReader( stream );
}
catch (IOException e) {
throw new SchemaManagementException(
"Unable to open specified script source url [" + url + "] for reading (" + charsetName + ")"
);
}
}
@Override
protected void releaseReader(Reader reader) {
try {
reader.close();
}
catch (IOException e) {
LOG.warn( "Unable to close file reader for generation script source" );
}
}
@Override
public boolean containsScript(URL url) {
return this.url.equals( url );View on GitHub (pinned to fad1729dce)
Solutions
- Probe the URL yourself (url.openStream() in try-with-resources) to see the real IOException Hibernate swallowed.
- Fix the resource location; re-verify the URL after repackaging — fat jars change nested-jar URLs.
- If it is a plain file, use a plain path or a verified file: URL rather than a stale one.
- Use a standard charset name (UTF-8) for the script charset setting.
Example fix
// diagnosis snippet — reveals the hidden IOException
try ( var in = url.openStream() ) { /* resource is fine */ }
catch ( IOException e ) { e.printStackTrace(); /* real cause: 404, missing jar entry, charset */ } Defensive patterns
Strategy: validation
Validate before calling
try ( var ignored = url.openStream() ) {
// resource openable
}
catch ( IOException e ) {
throw new IllegalStateException( "Import script URL not openable: " + url, e ); // shows the real IOException
} Prevention
- Validate script-source URLs with an openStream() probe during startup smoke tests.
- Avoid fragile nested-jar URLs for long-lived config; prefer filesystem paths for import scripts.
- Percent-encode URLs correctly and test resource resolution after every repackaging.
- Use standard charset names; include the charset in your diagnosis when it appears in the message.
When it happens
Trigger: jakarta.persistence.sql-load-script-source / hibernate.hbm2ddl.import_files value is a URL (file:, http:, jar:) whose resource is missing (404, deleted from jar, renamed resource), or the configured charset name is unsupported. Stream-open failures on remounted/invalidated jars also land here.
Common situations: Spring Boot fat-jar repackaging changing nested resource URLs, script moved between modules, typo in resource name, malformed URL, exotic charset name passed for import script decoding.
Related errors
- Error resolving legacy import resource : %s
- Unable to open specified script target file [
- Unable to determine JAR Url from <url>. Cause: <cause>
- Could not access specified jar-file: <jarFileReference>
- Unable to convert jar File to URL [<jarFileReference>]
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/7771d1f6cd0ada08.
Report an issue: GitHub.