Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when starting jetty-ee10-maven-plugin #9463

Closed
Artur- opened this issue Mar 4, 2023 · 1 comment
Closed

NPE when starting jetty-ee10-maven-plugin #9463

Artur- opened this issue Mar 4, 2023 · 1 comment
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@Artur-
Copy link
Contributor

Artur- commented Mar 4, 2023

Jetty version(s)
12.0.0-SNAPSHOT

Java version/vendor
openjdk version "19.0.1" 2022-10-18

OS type/version
mac os

Description
Some of our tests fail to start jetty when using jetty-ee10-maven-plugin while jetty-ee9-maven-plugin works fine. The failure is

[DEBUG] loaded 2 HttpFieldPreEncoders
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED} added {SymlinkAllowedResourceAliasChecker@17374d87{base=null,protected=[]},MANAGED}
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED} added {org.eclipse.jetty.util.DecoratedObjectFactory[decorators=0],POJO}
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED} added {oeje10s.SessionHandler@62888459{STOPPED},AUTO}
[DEBUG] oeje10ss.ConstraintSecurityHandler@506bbd6f{STOPPED} added {org.eclipse.jetty.util.component.DumpableCollection@4f8b5433,POJO}
[DEBUG] oeje10s.SessionHandler@62888459{STOPPED} added {oeje10ss.ConstraintSecurityHandler@506bbd6f{STOPPED},AUTO}
[DEBUG] oeje10ss.ConstraintSecurityHandler@506bbd6f{STOPPED} added {oeje10s.ServletHandler@51780404{STOPPED},AUTO}
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED,h=oeje10s.SessionHandler@62888459{STOPPED}} added {org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler@7aafef4a,POJO}
[DEBUG]   (s) resourceBases = [/projectdirflow/flow-tests/test-pwa/public, /projectdirflow/flow-tests/test-pwa/src/main/webapp]
[DEBUG] STARTING oejur.ResourceFactoryInternals$LifeCycle@1ecf8977{STOPPED}
[DEBUG] STARTED @7445ms oejur.ResourceFactoryInternals$LifeCycle@1ecf8977{STARTED}
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED,h=oeje10s.SessionHandler@62888459{STOPPED}} added {oejur.ResourceFactoryInternals$LifeCycle@1ecf8977{STARTED},MANAGED}
[DEBUG] oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=null,a=STOPPED,h=oeje10s.SessionHandler@62888459{STOPPED}} added {org.eclipse.jetty.util.resource.ResourceFactory$2@29efc291,POJO}
[DEBUG]   (s) containerIncludeJarPattern = ^$
[DEBUG]   (f) webApp = oeje10mp.MavenWebAppContext@22d33f1c{ROOT,/,b=[file:///projectdirflow/flow-tests/test-pwa/public/, file:///projectdirflow/flow-tests/test-pwa/src/main/webapp/],a=STOPPED,h=oeje10s.SessionHandler@62888459{STOPPED}}
[DEBUG]   (f) webAppSourceDirectory = /projectdirflow/flow-tests/test-pwa/src/main/webapp
[DEBUG]   (f) webXml = /projectdirflow/flow-tests/test-pwa/${project.baseDir}/src/main/webapp/WEB-INF/web.xml
[DEBUG] -- end configuration --
[INFO] Configuring Jetty for project: Flow tests for PWA annotation
[DEBUG] Set system property vaadin.allow.appshell.annotations=false
[DEBUG] Set system property vaadin.reuseDevServer=false
[DEBUG] Set system property vaadin.devServerPort=0
[DEBUG] Set system property vaadin.frontend.hotdeploy=true
[DEBUG] Set system property vaadin.devmode.liveReload.enabled=false
[DEBUG] Set system property vaadin.devmode.vite.options=--host
[DEBUG] Set system property vaadin.eagerServerLoad=false
[INFO] Classes = /projectdirflow/flow-tests/test-pwa/target/classes
[INFO] Context path = /
[INFO] Tmp directory = /projectdirflow/flow-tests/test-pwa/target/tmp
...
[ERROR] Failed to execute goal org.eclipse.jetty.ee10:jetty-ee10-maven-plugin:12.0.0-SNAPSHOT:run (default-cli) on project flow-test-pwa: Webapp config failure: Cannot invoke "java.net.URI.toURL()" because the return value of "org.eclipse.jetty.util.resource.Resource.getURI()" is null -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.jetty.ee10:jetty-ee10-maven-plugin:12.0.0-SNAPSHOT:run (default-cli) on project flow-test-pwa: Webapp config failure
...
Caused by: java.lang.NullPointerException: Cannot invoke "java.net.URI.toURL()" because the return value of "org.eclipse.jetty.util.resource.Resource.getURI()" is null
    at org.eclipse.jetty.ee10.maven.plugin.AbstractUnassembledWebAppMojo.configureUnassembledWebApp (AbstractUnassembledWebAppMojo.java:154)
    at org.eclipse.jetty.ee10.maven.plugin.AbstractUnassembledWebAppMojo.configureWebApp (AbstractUnassembledWebAppMojo.java:113)
    at org.eclipse.jetty.ee10.maven.plugin.AbstractWebAppMojo.startJetty (AbstractWebAppMojo.java:431)
    at org.eclipse.jetty.ee10.maven.plugin.AbstractWebAppMojo.execute (AbstractWebAppMojo.java:420)
    at org.eclipse.jetty.ee10.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:85)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)

On code level this is because

webApp.getBaseResource(): [file:///projectdir/flow/flow-tests/test-pwa/public/, file:///projectdir/flow/flow-tests/test-pwa/src/main/webapp/]

originalBaseResource is of type org.eclipse.jetty.util.resource.CombinedResource and originalBaseResource.getURI() is null

How to reproduce?
Run mvn jetty:run in https://github.com/vaadin/flow/tree/b7bffcc7d400cbaf98b11d362346ab4efdd17ea0/flow-tests/test-pwa

@Artur- Artur- added the Bug For general bugs on Jetty side label Mar 4, 2023
@janbartel janbartel self-assigned this Mar 4, 2023
janbartel added a commit that referenced this issue Mar 9, 2023
* Issue #9463 NPE in ee10 maven plugin startup
@janbartel
Copy link
Contributor

Closed via PR #9475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

No branches or pull requests

2 participants