下载和弹簧启动1.4出错

时间:2016-08-02 19:27:38

标签: spring-boot undertow

我在运行underow和spring-boot 1.4时遇到 NullPointerException

如果您使用

运行joinfaces-example,则会看到此错误

java -jar target / joinfaces-example-2.1.3-SNAPSHOT.jar

我意识到如果我在IDE(NetBeans)中调试项目,则不会发生错误。

此外,当我将spring boot升级到1.4时,会出现此错误。如果我将jsf-spring-boot-parent版本更改为使用spring boot 1.3版本的2.0.0,则不会发生错误。

未激活StartupServletContextListener时可能会发生此错误。它由UndertowMyfacesSpringBootAutoConfiguration创建。 Debug说它被激活了:

   UndertowMyfacesSpringBootAutoConfiguration matched
      - @ConditionalOnClass classes found: io.undertow.Undertow,org.apache.myfaces.webapp.StartupServletContextListener (OnClassCondition)

上面的堆栈跟踪:

java.lang.NullPointerException: null at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:62) ~[myfaces-bundle-2.2.10.jar!/:2.2.10]
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:172) ~[myfaces-bundle-2.2.10.jar!/:2.2.10]
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:121) [myfaces-bundle-2.2.10.jar!/:2.2.10]
    at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) [undertow-servlet-1.3.23.Final.jar!/:1.3.23.Final]
    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198) [undertow-servlet-1.3.23.Final.jar!/:1.3.23.Final]
    at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.createDeploymentManager(UndertowEmbeddedServletContainerFactory.java:390) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory.getEmbeddedServletContainer(UndertowEmbeddedServletContainerFactory.java:224) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) [spring-context-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar!/:1.4.0.RELEASE]
    at org.joinfaces.example.JoinFacesExampleApplication.main(JoinFacesExampleApplication.java:10) [classes!/:2.1.4-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [joinfaces-example-2.1.4-SNAPSHOT.jar:2.1.4-SNAPSHOT]

1 个答案:

答案 0 :(得分:1)

错误在于JoinFaces Undertow启动器,因为它使用的是two versions of JspFactory class

Duplicate Finder Maven Plugin现在用于避免重复的类和资源。