Skip to content

MalformedURLException when loading style sheets #24028

@beth-soptim

Description

@beth-soptim

Description of the bug

After updating our application from Vaadin 25.0.x to 25.1.0 we see the ERROR log entries when Vaadin loads style sheets.

The reason seems to be the change #23751.

VaadinServletService.getStaticResource(String) -> VaadinServletService.getStaticResource(ServletContent, String) -> ServletContext.getResource(String) but ServletContext.getResource(String) must be called with a path starting with / (see https://jakarta.ee/specifications/platform/11/apidocs/jakarta/servlet/servletcontext#getResource(java.lang.String))

2026-03-26 19:11:07,808 WARN [com.vaadin.flow.server.VaadinServletService] (default task-2) Error finding resource for 'lumo/lumo.css': java.net.MalformedURLException: UT010021: Path lumo/lumo.css must start with a /
at io.undertow.servlet@2.0.0.Alpha2//io.undertow.servlet.spec.ServletContextImpl.getResource(ServletContextImpl.java:298)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.VaadinServletService.getStaticResource(VaadinServletService.java:338)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.VaadinServletService.getStaticResource(VaadinServletService.java:259)
at deployment.xxxxxxxxx.war//com.vaadin.flow.internal.ResourceContentHash.openResource(ResourceContentHash.java:101)
at deployment.xxxxxxxxx.war//com.vaadin.flow.internal.ResourceContentHash.computeHash(ResourceContentHash.java:78)
at deployment.xxxxxxxxx.war//com.vaadin.flow.internal.ResourceContentHash.lambda$getContentHash$0(ResourceContentHash.java:73)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1724)
at deployment.xxxxxxxxx.war//com.vaadin.flow.internal.ResourceContentHash.getContentHash(ResourceContentHash.java:72)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.AppShellRegistry.lambda$addStyleSheets$9(AppShellRegistry.java:442)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:987)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.AppShellRegistry.addStyleSheets(AppShellRegistry.java:439)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.AppShellRegistry.createSettings(AppShellRegistry.java:277)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.AppShellRegistry.modifyIndexHtml(AppShellRegistry.java:332)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.communication.IndexHtmlRequestHandler.synchronizedHandleRequest(IndexHtmlRequestHandler.java:163)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:72)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1834)
at deployment.xxxxxxxxx.war//com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:402)
at deployment.xxxxxxxxx.war//com.vaadin.cdi.CdiVaadinServlet.service(CdiVaadinServlet.java:66)
at jakarta.servlet.api@6.1.0//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:723)
...

Expected behavior

In Vaadin 25.0.x there was no exception.

Minimal reproducible example

Using @StyleSheet(Lumo.STYLESHEET) on a custom AppShellConfigurator.

Versions

  • Vaadin / Flow version: 25.1.0
  • Java version: 25.0.2
  • OS version: AL 2023
  • Browser version (if applicable): all
  • Application Server (if applicable): Wildfly 39.0.1
  • IDE (if applicable): IntelliJ

Metadata

Metadata

Assignees

Type

Projects

Status

🔖 Normal Priority (P2)

Status

🔎Iteration reviews

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions