我尝试为我创建一个默认的spring启动应用程序。它应该启用了primefaces。
因此,如果我直接从Eclipse启动这个spring-boot mainapp,或者使用mvn clean install spring-boot:run
启动这个spring-boot mainapp工作正常。我可以连接到嵌入式Tomcat。
.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
但是,如果我执行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 Backup für javax.faces.application.ApplicationFactory gefunden
只是之前例外的结果。
我的pom.xml看起来像
<?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 jars而且没有myfaces。
可能是我通过测试和测试而失明......我认为我需要帮助或暗示正确的方向。
我在其他地方部署这个可执行文件.war文件并在没有mvn的情况下运行它的目标距离很远......
非常感谢,
汤姆
答案 0 :(得分:0)
发现并解决了问题。由于我的第一个解决方案是将spring-boot版本增加到&lt; = 1.5.2以获得一个明显有效的“exectuable”.war,另一个的详细视图提到了直到1.5.2 spring boot与tomcat 8.5一起工作0.11。
较新的版本会使用较新的Tomcats。
最简单的解决方案是将<tomcat.version>8.5.11</tomcat.version>
放到pom.xml中。然后你仍然可以使用SB 1.5.6.RELEASE
似乎这种行为是Tomcat问题。