Skip to content

fix(gcp): register nested URL protocol handler in GcfJarLauncher - #1434

Open
akenra wants to merge 1 commit into
spring-cloud:mainfrom
akenra:bugfix/gh-1336
Open

fix(gcp): register nested URL protocol handler in GcfJarLauncher#1434
akenra wants to merge 1 commit into
spring-cloud:mainfrom
akenra:bugfix/gh-1336

Conversation

@akenra

@akenra akenra commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

hi, @olegz!

I decided to try and fix this issue due to popular demand.

As far as I can tell, GcfJarLauncher's constructor bypasses Launcher.launch() and creates a LaunchedClassLoader directly. Unlike Launcher.launch(), the constructor never called Handlers.register(), which meant the JVM could not resolve nested: URLs. When JarUrlClassLoader tried to resolve BOOT-INF/lib/ entries it threw java.net.MalformedURLException: unknown protocol: nested.

So I replaced the commented-out JarFile.registerUrlProtocolHandler() (which registered the jar: protocol in Spring Boot 2.x) with Handlers.register(), the Boot 4.x equivalent that registers the nested: protocol handler.

Fixes gh-1336

GcfJarLauncher's constructor bypasses Launcher.launch() and creates a
LaunchedClassLoader directly. Unlike Launcher.launch(), the constructor
never called Handlers.register(), which meant the JVM could not resolve
nested: URLs. When JarUrlClassLoader tried to resolve BOOT-INF/lib/
entries it threw java.net.MalformedURLException: unknown protocol: nested.

Replace the commented-out JarFile.registerUrlProtocolHandler() (which
registered the jar: protocol in Spring Boot 2.x) with
Handlers.register(), the Boot 4.x equivalent that registers the nested:
protocol handler.

Fixes spring-cloudgh-1336

Signed-off-by: akenra <37288280+akenra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring Cloud Function on GCP not compatible with Spring Boot 4.x

1 participant