6

As far as I know, JSF 2 requires servlet 2.5, so it doesn't run on JBOSS 4.05 (Tomcat 5.5). Unfortunately I have to deploy an application who uses JSF 2.0 and Primefaces on that environment.

Is there any hack to use that?

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
Renan Viegas
  • 73
  • 1
  • 4

1 Answers1

12

JSF 2.0 depends heavily on EL 2.1 which is part of Servlet 2.5 and is a major change as opposed to EL 2.0 which is part of Servlet 2.4, but it does not depend on any particular Servlet 2.5 specific API. Servlet 2.4 should work as good. So in theory, you could get JSF 2.0 to work on Servlet 2.4 if you provide your own EL 2.1 API and implementation in /WEB-INF/lib. I did a quick test here on Tomcat 5.5.33 with the following libraries in /WEB-INF/lib:

  • el-api.jar file copied from lib folder of Tomcat 6.0.x
  • jboss-el.jar file (implements EL 2.1 and supports EL 2.2 like method invocation with arguments)
  • jsf-api.jar and jsf-impl.jar from Mojarra 2.0.x

And a Servlet 2.4 web.xml where the JBoss EL is been declared:

<context-param>     
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
</context-param>

A simple JSF 2.0 Facelet (not JSP!) with a simple <h:form> with a button with <f:ajax> and a simple @ViewScoped @ManagedBean works for me on Tomcat 5.5.33. Give it a try on your JBoss 4.0.5 and test it thoroughly.

Note that you need a minimum of JDK 1.5, not JDK 1.4. Also note that your application is this way unportable to any Servlet 3.0 container due to presence of the Servlet 2.5 specific el-api.jar file.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • 1
    Good man, thanks! But I still have a problem - Primefaces didn't worked with that approach. The error: Caused by: org.xml.sax.SAXException: Error Handling [jar:file:/HIDDEN/jboss-4.0.5.GA/server/default/./tmp/deploy/tmp1314317090148712617primefaces-test-exp.war/WEB-INF/lib/primefaces-3.0.M2-SNAPSHOT.jar!/META-INF/primefaces-p.taglib.xml@5,17] – Renan Viegas May 15 '11 at 03:53
  • 1
    Try PrimeFaces 2.x. The 3.0 has Servlet 3.0 specific dependencies. – BalusC May 15 '11 at 11:27