0

I have a spring boot+JSF application which runs as a charm when we run it as:

mvn spring-boot:run

However when i create a jar using mvn clean compile package install

and then run java -jar myapp.jar

i get:

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>

in web xml as suggested here i tried below three options:

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

OR

<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener> 

OR

<listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>

However the error remains the same, running out of ideas, appreciate any help on the same.

Best

vaibhav
  • 3,929
  • 8
  • 45
  • 81
  • can you share your application configuration? Sample project would be great – bilak Sep 05 '18 at 12:10
  • There is no official support for JSF in Spring Boot. Maybe this could help https://github.com/joinfaces/joinfaces-maven-jar-example – Simon Martinelli Sep 05 '18 at 12:20
  • JSF tipically expects a war packaging. There's no problem in running that war as a jar, once packaged. Take a look to my [answer and the sample project](https://stackoverflow.com/a/46190826/1199132). By the way, you shouldn't be configuring any web.xml file with spring boot, you can do everything using java. – Aritz Sep 05 '18 at 21:31
  • The sample project here https://github.com/xtremebiker/jsf-spring-boot only works with mvn spring boot command neither in a standalone container nor as jar – vaibhav Sep 06 '18 at 07:53
  • Just compile it and run as `java -jar target/jsf-spring-boot-1.0.0.war`, as it is stated in the project. It should be fully functional. – Aritz Sep 17 '18 at 13:20

0 Answers0