1
votes

I try to create a default spring boot application for me. It should have primefaces enabled.

So if I start this spring-boot mainapp directly from Eclipse or on CLI with mvn clean install spring-boot:run everthing works fine. I can connect to the embedded Tomcat.

Directory Content of .war

    META-INF/maven/
    WEB-INF/classes/
    WEB-INF/lib/
    WEB-INF/lib-provided/
    WEB-INF/faces-config.xml
    WEB-INF/springsecurity.taglib.xml
    org/springframework/boot/loader/jar/
    org/springframework/boot/loader/data/
    org/springframework/boot/loader/archive/
    org/springframework/boot/loader/util
    index.xhtml
  • some further project xhtml & classes

But if I do a mvn clean install spring-boot:repackage and try to execute this repackaged .war file (elsewhere) I got the following exception(s) :

    java -jar dmgmnt-central/target/dmgmnt-central-0.0.1-SNAPSHOT.war
     ___________  __  __ 
    2017-09-06 17:37:41.693  INFO 20769 --- [           main] de.dmgmnt.zdm.DmgmntCentralApplication   : Starting DmgmntCentralApplication v0.0.1-SNAPSHOT on ton3rmini.to3.kept.loc with PID 20769 (/Development/workspace/dmgmnt-central/target/dmgmnt-central-0.0.1-SNAPSHOT.war started by toner in /Development/workspace)
    2017-09-06 17:37:41.707  INFO 20769 --- [           main] de.dmgmnt.zdm.DmgmntCentralApplication   : No active profile set, falling back to default profiles: default
    2017-09-06 17:37:41.881  INFO 20769 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6d21714c: startup date [Wed Sep 06 17:37:41 CEST 2017]; root of context hierarchy
    2017-09-06 17:37:46.481  INFO 20769 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
    2017-09-06 17:37:46.504  INFO 20769 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2017-09-06 17:37:46.507  INFO 20769 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.16
    2017-09-06 17:37:51.450  INFO 20769 --- [ost-startStop-1] org.apache.jasper.servlet.TldScanner     : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    2017-09-06 17:37:51.652  INFO 20769 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2017-09-06 17:37:52.196  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
    2017-09-06 17:37:52.197  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
    2017-09-06 17:37:52.198  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
    2017-09-06 17:37:52.198  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
    2017-09-06 17:37:52.201  INFO 20769 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
    2017-09-06 17:37:52.202  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'facesServlet' to [*.jsf, /faces/*, *.xhtml]
    2017-09-06 17:37:52.205  INFO 20769 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
    2017-09-06 17:37:52.408  INFO 20769 --- [ost-startStop-1] j.e.resource.webcontainer.jsf.config     : Mojarra 2.2.13 ( 20160203-1910 unable to get svn info) für Kontext '' wird initialisiert.
    2017-09-06 17:37:57.021 ERROR 20769 --- [ost-startStop-1] j.e.resource.webcontainer.jsf.config     : Critical error during deployment: 

    com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:764) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:353) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
    Caused by: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_60]
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_60]
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:751) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 11 common frames omitted
    Caused by: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:137) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1362) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1331) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:742) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 11 common frames omitted
    Caused by: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142) ~[na:1.8.0_60]
        at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89) ~[na:1.8.0_60]
        at com.sun.faces.facelets.util.Classpath.search(Classpath.java:146) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.facelets.util.Classpath.search(Classpath.java:110) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:166) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:110) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 15 common frames omitted

    2017-09-06 17:37:57.023 ERROR 20769 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception sending context initialized event to listener instance of class [com.sun.faces.config.ConfigureListener]

    java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4743) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
    Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:764) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:353) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 9 common frames omitted
    Caused by: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_60]
        at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_60]
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:751) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 11 common frames omitted
    Caused by: javax.faces.FacesException: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:137) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1362) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1331) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:742) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 11 common frames omitted
    Caused by: java.io.FileNotFoundException: JAR entry META-INF/ not found in /var/folders/gj/hwn3v7s561xds07bnkwflpyw0000gn/T/jar_cache1135464309359915777.tmp
        at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142) ~[na:1.8.0_60]
        at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89) ~[na:1.8.0_60]
        at com.sun.faces.facelets.util.Classpath.search(Classpath.java:146) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.facelets.util.Classpath.search(Classpath.java:110) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:166) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:110) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        ... 15 common frames omitted

    2017-09-06 17:37:57.025 ERROR 20769 --- [ost-startStop-1] o.apache.catalina.core.StandardContext   : One or more listeners failed to start. Full details will be found in the appropriate container log file
    2017-09-06 17:37:57.026 ERROR 20769 --- [ost-startStop-1] o.apache.catalina.core.StandardContext   : Context [] startup failed due to previous errors
    2017-09-06 17:37:57.048 ERROR 20769 --- [ost-startStop-1] javax.faces                              : Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
    2017-09-06 17:37:58.512 ERROR 20769 --- [ost-startStop-1] javax.faces                              : Die Anwendung wurde bei Systemstart nicht einwandfrei initialisiert, Factory konnte nicht gefunden werden: javax.faces.application.ApplicationFactory.
    2017-09-06 17:37:58.513 ERROR 20769 --- [ost-startStop-1] j.e.resource.webcontainer.jsf.config     : Unexpected exception when attempting to tear down the Mojarra runtime

    java.lang.IllegalStateException: Keine Factory als Backup für javax.faces.application.ApplicationFactory gefunden.
        at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:555) ~[jsf-api-2.2.13.jar!/:2.2]
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:283) ~[jsf-api-2.2.13.jar!/:2.2]
        at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:140) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:343) ~[jsf-impl-2.2.13.jar!/:2.2.13]
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4790) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5429) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.16.jar!/:8.5.16]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

    2017-09-06 17:37:58.525 ERROR 20769 --- [ost-startStop-1] javax.faces                              : Unable to call @PreDestroy annotated methods because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI?
    2017-09-06 17:37:58.613  WARN 20769 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    2017-09-06 17:37:58.633  INFO 20769 --- [           main] utoConfigurationReportLoggingInitializer : 

    Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
    2017-09-06 17:37:58.648 ERROR 20769 --- [           main] o.s.boot.SpringApplication               : Application startup failed

    org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.10.RELEASE.jar!/:4.3.10.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at de.dmgmnt.zdm.DmgmntCentralApplication.main(DmgmntCentralApplication.java:25) [classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [dmgmnt-central-0.0.1-SNAPSHOT.war:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [dmgmnt-central-0.0.1-SNAPSHOT.war:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [dmgmnt-central-0.0.1-SNAPSHOT.war:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) [dmgmnt-central-0.0.1-SNAPSHOT.war:0.0.1-SNAPSHOT]
    Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:123) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:84) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:554) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:179) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]
        ... 16 common frames omitted

I think the java.lang.IllegalStateException: Keine Factory als Backup für javax.faces.application.ApplicationFactory gefunden is just a result of the exceptions before.

My pom.xml looks like

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>de.dmgmnt.zdm</groupId>
        <artifactId>dmgmnt-central</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>war</packaging>
        <name>dmgmnt-central</name>
        <description>Central</description>

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>

            <dmgmnt.api.version>0.0.1-SNAPSHOT</dmgmnt.api.version>
            <jsf.version>2.2.13</jsf.version>
            <prime.version>6.0</prime.version>

        </properties>

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.6.RELEASE</version>
            <relativePath></relativePath> <!-- lookup parent from repository -->
        </parent>

        <dependencies>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-mail</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-mobile</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-security</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-test</artifactId>
            </dependency>


            <!-- needed for spring secure tags -->
            <dependency>
                <groupId>org.springframework.webflow</groupId>
                <artifactId>spring-faces</artifactId>
                <version>2.4.2.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-taglibs</artifactId>
            </dependency>


            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-validation</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-websocket</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-jasper</artifactId>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.primefaces</groupId>
                <artifactId>primefaces</artifactId>
                <version>${prime.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>${jsf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.faces</groupId>
                <artifactId>jsf-impl</artifactId>
                <version>${jsf.version}</version>
            </dependency>

        </dependencies>


        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>

And finally, my SB Application :

    package de.dmgmnt.zdm;

    import javax.faces.webapp.FacesServlet;
    import javax.servlet.ServletContext;

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    import org.springframework.boot.web.servlet.ServletRegistrationBean;
    import org.springframework.boot.web.support.SpringBootServletInitializer;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.web.context.ServletContextAware;

    @SpringBootApplication
    @Configuration
    @ComponentScan(basePackages = { "de.dmgmnt.zdm" })
    @EnableAutoConfiguration
    public class DmgmntCentralApplication extends SpringBootServletInitializer implements ServletContextAware {

        public static void main(String[] args) {
            SpringApplication.run(DmgmntCentralApplication.class, args);
        }

        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(DmgmntCentralApplication.class);
        }

        @Bean
        public ServletRegistrationBean servletRegistrationBean() {
            FacesServlet servlet = new FacesServlet();
            return new ServletRegistrationBean(servlet, "*.jsf", "/faces/*", "*.xhtml");
        }

        public void setServletContext(final ServletContext servletContext) {                
            servletContext.setInitParameter("primefaces.CLIENT_SIDE_VALIDATION", Boolean.TRUE.toString());
            servletContext.setInitParameter("javax.faces.PROJECT_STAGE", "Development");
            servletContext.setInitParameter("javax.faces.DEFAULT_SUFFIX", ".xhtml");
            servletContext.setInitParameter("primefaces.FONT_AWESOME", Boolean.TRUE.toString());
            servletContext.setInitParameter("javax.faces.STATE_SAVING_METHOD", "client");
            servletContext.setInitParameter("javax.faces.CONFIG_FILES", "/WEB-INF/faces-config.xml");
            servletContext.setInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/springsecurity.taglib.xml");
            servletContext.setInitParameter("javax.faces.FACELETS_SKIP_COMMENTS", Boolean.TRUE.toString());
        }

    }

As far as I see I have just the jsf api/impl jars and no myfaces.

May be I am blind by testing and testing and... I think I need help or a hint to the right direction.

My target to deploy this executable .war file elsewhere and run it without mvn is far far away..

Thanks a lot,

Tom

1
I know now that the init is force by servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString()); When I disable this, no Mojarra 2.2.13 is initialized during startup. But when the first call comes, it throws : Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI? javax.faces : Die Anwendung wurde bei Systemstart nicht einwandfrei initialisiert, Factory konnte nicht gefunden werden: javax.faces.context.FacesContextFactory. - Tom K.
... a war file is not executable. You're supposed to manually deploy it in a servlet engine. If you just want to run it you should just let spring boot build a jar. - Gimby
Hm, I think that's not right. Of course, traditional .war file is not an executable. But Springs buildtool will help there. docs.spring.io/spring-boot/docs/current/reference/html/… ..."marking the embedded servlet container dependency as provided will produce an executable war file"... - Tom K.
Well well, I learned something new. Still if you don't need to deploy the war to a container you're still better off to create an executable jar as a regular spring boot application. In any case I would still try to manually deploy the war file to a Tomcat instance to see if that makes a difference. If that doesn't work either there is a problem with the packaging setup. If that does work, well then at least the problem has been narrowed down a bit specifically to the magic spring boot executable war logic. - Gimby
yes.. magic. That's true. Deploy to a native tomcat works also. My goal is to provide this executable .war within a docker image. so I've not too much to manage. At this time it's easier to prepare and develop the project with its .xhtml files. It's currently not clear for me where to provide them when I build it as an exec.jar. Also I find it fancy to be able to start the war of its own are in an AppServer - Tom K.

1 Answers

0
votes

Problem found and solved. Since my first solution was to increment the spring-boot Version to <= 1.5.2 to get an obviously working "exectuable" .war, a detailed view of another one brings to front that till 1.5.2 spring boot works with tomcat 8.5.11.

Newer Versions take newer Tomcats.

Easiest solution is to put <tomcat.version>8.5.11</tomcat.version> to the pom.xml. Then you can still use SB 1.5.6.RELEASE

Seems that this behavior is a Tomcat Problem.

https://github.com/spring-projects/spring-boot/issues/10232