Openshift Kubernetes Application fail to startup on Jetty server: java.net.URISyntaxException: Expected authority at index 7

11/16/2021

I have an application running on a Jetty Server encapsulated in a Docker container. The same container deploys and works correctly on a local docker environment.

When deploying the container on OpenShift Kubernetes, Jetty errors with :

2021-11-13 18:07:01.667:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.q.QuickStartWebApp@39c0f4a{/,file:///opt/application/webapps/application/,UNAVAILABLE}{/application/}
java.lang.reflect.InvocationTargetException

Caused by:
java.lang.IllegalArgumentException: java.net.URISyntaxException: Expected authority at index 7: file://
	at org.eclipse.jetty.quickstart.AttributeNormalizer.toCanonicalURI(AttributeNormalizer.java:93)
	at org.eclipse.jetty.quickstart.AttributeNormalizer.add(AttributeNormalizer.java:208)

I understand the error is related to a URI which might be incorrectly formatted, but I'm struggling to understand where this one is configured, given that it works in a local docker environment.

Any suggestions on how to debug this are very welcome.

-- noviceata
jetty
kubernetes
openshift

1 Answer

11/19/2021

Looks like you have an incomplete file uri.

file://

That does not produce a valid URI on Java.

$ jshell
|  Welcome to JShell -- Version 11.0.12
|  For an introduction type: /help intro

jshell> new URI("file://")
|  Exception java.net.URISyntaxException: Expected authority at index 7: file://
|        at URI$Parser.fail (URI.java:2913)
|        at URI$Parser.failExpecting (URI.java:2919)
|        at URI$Parser.parseHierarchical (URI.java:3163)
|        at URI$Parser.parse (URI.java:3114)
|        at URI.<init> (URI.java:600)
|        at (#1:1)

More of the stacktrace would help identify where that is coming from.

-- Joakim Erdfelt
Source: StackOverflow