当前位置: 首页 > 知识库问答 >
问题:

spring-boot在可执行文件中使用JSF。war java.io.FileNotFoundException:JAR条目META-INF/未在

彭浩穰
2023-03-14

我尝试为我创建一个默认的spring boot应用程序。它应该启用primefaces。

因此,如果我直接从Eclipse启动这个spring-boot mainapp,或者在CLI上使用MVN clean install spring-boot:runeverthing工作正常。我可以连接到嵌入的Tomcat。

    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
  • 一些进一步的项目xhtml&classes

但是,如果执行MVN clean install spring-boot:repackage并尝试执行这个重新打包的.war文件(在其他地方),则会出现以下异常:

    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

我认为java.lang.IllegalStateException:Keine Factory als备份für javax.faces.application.applicationFactory gefunden只是以前异常的结果。

    <?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>

最后,我的SB申请:

    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());
        }

    }

就我所见,我只有jsf API/Impl jar,没有MyFaces。

也许我是被测试和测试弄瞎的...我想我需要帮助或对正确方向的暗示。

共有1个答案

萧成文
2023-03-14

发现并解决问题。由于我的第一个解决方案是将spring-boot版本增加到<=1.5.2,以获得一个明显可以工作的“exectuable”.war,因此,在1.5.2 spring-boot与tomcat 8.5.11一起工作之前,另一个解决方案的详细视图将使这个问题变得更加突出。

较新的版本采取较新的公猫。

最简单的解决方案是将 8.5.11 放到pom.xml中。那么你仍然可以使用SB 1.5.6。释放

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

 类似资料:
  • 我对Spring和Spring Boot相当陌生,并被要求从事一个遗留的Spring Boot项目。我应该在项目中包括Spring Boot提供的一些FailureAnalyzer。根据我遇到的教程(比如这里),所需要做的就是在meta-inf/spring.factors文件中注册几个FailureAnalyzer类。 但是当我构建项目时(使用Maven),在target/meta-inf目录中

  • 我的CharsetProvider的类是在文件中指定的,该文件位于中,所有GET都正常加载并按预期工作。 然而,现在我也在android上使用lib,但是charset没有加载到android-app中。 我如何整合我的字符集,使它可以像预期的那样在一个Android应用程序中使用? 目前我正在做这样的变通: 这是可行的,但在我看来是无效的,因为每次我尝试用自己的charset进行这样的解码时,都

  • 在更新了我的LibGDX项目中的所有库后,我得到了一个错误 “导致重复条目” 项目级构建。分级: Android级别的构建。Gradle:

  • 我有一个使用Flyway迁移的Spring Boot应用程序。一切正常,从: Intellij内部 从MacBook上的终端 使用“fine”,我的意思是找到迁移文件,这些文件被放置在src/main/resources中,并最终被放置在Spring Boot可执行JAR中。 但是,当我在CentOS6.8上从命令行运行jar时,Flyway无法找到迁移文件。 使用Java8。

  • 我正在使用 Maven 来构建一个 Java 项目,我有几个文件,和,我想将它们复制到 JAR 文件内的 目录中。 到目前为止,我的工作如下: 但这也会在编译时将这两个文件复制到 目录中。 所以我希望这些文件包含在JAR文件中,而不是其他地方。有办法做到这一点吗?

  • 我有一个正在开发的Spring Boot应用程序,我最近将它从Spring3升级到Spring4(spring-boot-starter-parent 1.3.5.release到1.4.6.release)。 我在目录中有一个html模板(名为'test-template.html'),我一直在使用Thymeleaf的TemplateEngine创建html电子邮件内容。(在升级到版本4之前,这