Maven Spring boot JSF 2.0应用程序作为Jar运行

Maven Spring boot JSF 2.0应用程序作为Jar运行,maven,spring-boot,tomcat,jsf-2,Maven,Spring Boot,Tomcat,Jsf 2,我有一个spring boot+JSF应用程序,当我们以以下方式运行它时,它会非常有魅力: mvn spring启动:运行 但是,当我使用mvn clean compile package安装创建jar时 然后运行java-jarmyapp.jar 我得到: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization

我有一个spring boot+JSF应用程序,当我们以以下方式运行它时,它会非常有魅力:

mvn spring启动:运行

但是,当我使用
mvn clean compile package安装创建jar时

然后运行
java-jarmyapp.jar

我得到:

java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
java.lang.IllegalStateException:没有为此应用程序配置工厂。如果faces初始化根本不起作用,则会发生这种情况-确保正确包含基本faces应用程序所需的所有配置设置,并且包含所有必要的LIB。还要检查web应用程序和容器的日志输出是否存在任何异常!
如果您这样做了,但什么也没找到,那么错误可能是因为您使用了一些特殊的web容器,这些容器不支持通过TLD文件注册上下文侦听器,并且您的web.xml中没有设置上下文侦听器。
一个典型的配置如下所示;
org.apache.myfaces.webapp.StartupServletContextListener
在web xml中,我尝试了以下三个选项:

<listener>
      <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>

org.apache.myfaces.webapp.StartupServletContextListener


org.springframework.web.context.ContextLoaderListener


org.springframework.web.context.request.RequestContextListener
然而,错误仍然是一样的,没有想法,感谢任何帮助


最好的

您可以共享您的应用程序配置吗?示例项目将非常棒,因为在Spring Boot中没有对JSF的官方支持。也许这可以帮助JSF更好地期待战争包装。一旦打包,将战争作为一个罐子运行是没有问题的。看看我的眼睛。顺便说一句,您不应该使用spring boot配置任何web.xml文件,您可以使用java做任何事情。这里的示例项目只使用mvn spring boot命令,既不在独立容器中,也不作为jar使用。正如项目中所述,只需编译它并作为
java-jar目标/jsf-spring-boot-1.0.0.war
运行即可。它应该功能齐全。
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener> 
<listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>