I created a Maven Web Application using JSF 2.2 , Primefaces, Tomcat 7 dependencies.
My JSF's implemention is Mojarra 2.2.4, I added this dependecies on my POM:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>
But unfortunately, I have problem with tomcat7-maven-plugin
and its embedded tomcat. If I use tomcat7:run
command, my webapp starts without problem, but when it try to load managed bean I receive this error:
Target Unreachable, identifier 'testBean' resolved to null
This is a sign that the webapp is using JSF 1.x
instead of JSF 2.x
. The configurator of JSF 1.x
does not recognize @ManagedBean
annotations which will cause that they're not loaded/initialized automagically without the need for faces-config.xml.
I'm using tomcat embedded 7.0.50, configured using it: http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html
But despite I doesn't recognize @ManagedBean
annotaions, it works only using managedbean tag on faces-config.xml
.
Is there a way to include JSF 2.x
support to Tomcat Embedded for maven7-tomcat-plugin
?
PS: tomcat7:run-war
works, but I don't like because obviously it a static run, without any possibility to change xhtml code (e.g.) on fly.