当运行underflow和spring-boot 1.4时,我得到NullPointerException。
如果您使用运行joinfaces示例,您可以看到此错误
java-jar target/joinfaces-example-2.1.3-SNAPSHOT.jar
我意识到,如果我在IDE(NetBeans)中调试项目,就不会发生错误。
此外,当我将spring-boot升级到1.4时,这个错误就开始了。如果我将jsf-spring-boot父版本更改为2.0.0,使用spring-boot1.3版本,则不会发生错误。
StartupServlet上下文侦听器未激活时可能会发生此错误。它由UndertowMyfacesSpringBootAutoConfiguration创建。调试表示已激活:
UndertowMyfacesSpringBootAutoConfiguration匹配-找到@ConditionalOnClass类:io.bundertow.undertow,org.apache.myfaces.webapp.StartupServlet上下文侦听器(OnClassCondition)
上面的堆栈跟踪:
java.lang.NullPointerException:在org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21facesInitialiser.java:62)~[myfaces-bundle-2.2.10.jar!/:2.2.10]处为null网址:org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesIinitializer.java:172)~[myfaces-bundle-2.2.10.jar!/:2.2.10]网址:org.apache.myfaces.webapp.StartupServlet上下文监听器.contextInitialized(StartupServlet上下文侦听器.java:121)[myfaces-bundle-2.2.10.jar!/:2.2.10]位于io.bundertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)[undertow-servlet-1.3.23.Final.jar!/:1.3.23.Final]位于io.bundertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)[undertow-servlet-1.3.23.Final.jar!/:1.3.23.Final]位于org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServlet容器工厂.createDeploymentManager(UndertowEmbedded Servlet容器工厂.java:390)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServlet ContainerFactory.getEmbeddedServletContainer(UndertowEmbedded Servlet ContainerFactory.java:224)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.context.EmbeddedWebApplicationContext.createEmbeddedServlet容器(EmbeddedWebApplicationContext.java:164)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.context.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]网址:org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535)[spring-context-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]网址:org.springframework.boot.context.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]网址:org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.SpringApplication.run(SpringApplication.java:313)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)[spring-boot-1.4.0.REASE.jar!/:1.4.0.RELEASE]位于org.joinfaces.example.JoinFacesExampleApplication.main(JoinFacesExampleApplication.java:10)[classes!/:2.1.4-SNAPSHOT]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)~[na:1.8.0_101]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)~[na:1.8.0_101]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[na:1.8.0_101]位于java.lang.reflect.Method.ioke(Method.java:498)~[na:1.8.0_101]网址:org.springframework.bootloader.MainMethodRunner.run(MainMethodRunner:java:48)[joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]网址:org.springframework.bootloader.Launcher.launch(Launcher.java:87)[joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]网址:org.springframework.bootloader.Launcher.launch(Launcher.java:50)[joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]网址:org.springframework.bootloader.JarLauncher.main(JarLauncher.java:58)[joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]
JoinFaces Undertow启动器出现错误,因为它使用了两个版本的JspFactory类。
DuplicateFinder Maven插件现在用于避免重复的类和资源。