Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The exception is
Oct 03, 2023 8:58:01 A.M. org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
INFO: Reading config /WEB-INF/faces-config.xml
Oct 03, 2023 8:58:01 A.M. org.apache.myfaces.webapp.FacesInitializerImpl initFaces
SEVERE: An error occured while initializing MyFaces: java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.attributeExtensions" is null
jakarta.faces.FacesException: java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.attributeExtensions" is null
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.getFacesConfig(FacesConfigUnmarshallerImpl.java:180)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.getFacesConfig(FacesConfigUnmarshallerImpl.java:77)
at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getWebAppFacesConfig(DefaultFacesConfigurationProvider.java:399)
at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:76)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:468)
at org.apache.myfaces.webapp.FacesInitializerImpl.buildConfiguration(FacesInitializerImpl.java:382)
at org.apache.myfaces.webapp.FacesInitializerImpl.initContainerIntegration(FacesInitializerImpl.java:709)
at org.apache.myfaces.webapp.FacesInitializerImpl.initFaces(FacesInitializerImpl.java:179)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:54)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1046)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:624)
at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:983)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:740)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:392)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1305)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:902)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:533)
at org.eclipse.jetty.maven.plugin.MavenWebAppContext.doStart(MavenWebAppContext.java:294)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171)
at org.eclipse.jetty.server.Server.start(Server.java:470)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89)
at org.eclipse.jetty.server.Server.doStart(Server.java:415)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyEmbedder.doStart(JettyEmbedder.java:223)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.startJettyEmbedded(JettyRunMojo.java:97)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.startJetty(AbstractWebAppMojo.java:441)
at org.eclipse.jetty.maven.plugin.AbstractWebAppMojo.execute(AbstractWebAppMojo.java:419)
at org.eclipse.jetty.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:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:348)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.attributeExtensions" is null
at org.apache.myfaces.config.impl.element.AttributeImpl.addAttributeExtension(AttributeImpl.java:149)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.lambda$processComponent$88(FacesConfigUnmarshallerImpl.java:419)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.onChild(FacesConfigUnmarshallerImpl.java:722)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.lambda$processComponent$89(FacesConfigUnmarshallerImpl.java:419)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.onChild(FacesConfigUnmarshallerImpl.java:722)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.processComponent(FacesConfigUnmarshallerImpl.java:410)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.lambda$getFacesConfig$7(FacesConfigUnmarshallerImpl.java:148)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.onChild(FacesConfigUnmarshallerImpl.java:722)
at org.apache.myfaces.config.impl.FacesConfigUnmarshallerImpl.getFacesConfig(FacesConfigUnmarshallerImpl.java:147)
... 64 more{{{}
{}}}
The attached tar file demonstrates the problem. It can be observed as follows:
$ tar -xzf faces-config_xml-exception.tar.gz
$ cd faces-config_xml-exception
$ mvn jetty:run
Note that the triggering example is absurdly minimalist and contains no Java code since the exception is triggered so early in the webapp execution cycle.