Running Apache MyFaces on Tomcat 5.5.x and below
…largely unsuccessfully. I just could not get the darned example app to start, with exceptions along the lines of:
20-Apr-2009 22:27:04 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
appearing in the tomcat localhost log files.
Solving the problem is easy when you know how, but it still took me a while to figure it out. There’s two versions of JSF and MyFaces, and by default when you set up your Maven project, you get the latest, greatest version, 1.2.x – which is incompatible with Tomcat versions below version 6.0. That’s what causes the exceptions above.
If you want to use Tomcat 5.5x or below, you’ll need MyFaces 1.1.x to get things working. If you’re using Maven, update the versions of myfaces-api and myfaces-impl in your pom.xml to refer to the 1.1.6 versions as follows:
<dependencies> <dependency> <groupid>org.apache.myfaces.core</groupid> <artifactid>myfaces-api</artifactid> <version>1.1.6</version> <scope>compile</scope> </dependency></dependencies> <dependency> <groupid>org.apache.myfaces.core</groupid> <artifactid>myfaces-impl</artifactid> <version>1.1.6</version> <scope>compile</scope> </dependency> ...more stuff
When I made these updates, the older versions were downloaded, and everything started working just fine.
The views expressed here are the personal views of the author.
In: Java · Tagged with: apache, javaserver faces, jsf, maven, myfaces, tomcat 5.5.x