Introduction

The main problem is, although Tomcat 5.5.9 requires a JDK 5.0 it wont allow to compiler 5.0 constructs out of the box.

MyFaces, Tomcat 5.5.9, JDK 1.4.x

Install Tomcat, apply the compatibility pack mentioned on the Apache Tomcat website, then follow the normal MyFaces installation instructions for Tomcat 5.5.x.

MyFaces, Tomcat 5.5.9, JDK 1.5.x

Install Tomcat, then follow the normal MyFaces installation instructions for Tomcat 5.5.x.

If you need to use Java 5.0 language constructs, you'll need to revert the JSP compiler to the default JDK one. The integrated jikes-compiler is not working in this particular version of Tomcat. There is a howto on the Tomcat website to get those things up and running, but that howto is wrong. The correct way to get things up and running is following:

first of all remove all jikes related jars from the tomcat lib dir,
second add tools.jar from the jdk to the tomcat classpath
third add ant.jar from an ant installation to the classpath
fourth replace the servlet entry from the conf/web.xml 

 <servlet>
       
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>   
        </init-param>
    <init-param>
         <param-name>compiler</param-name>
         <param-value>javac1.5</param-value>
    </init-param>
    <init-param>
         <param-name>compilerSourceVM</param-name>
         <param-value>1.5</param-value>
    </init-param>
    <init-param>
            <param-name>compilerTargetVM</param-name>
            <param-value>1.5</param-value>   
        </init-param>

        <load-on-startup>3</load-on-startup>
    </servlet>

and now startup tomcat with a working jdk 1.5 and pages should compile

also see for this problem

Another way probably would be to replace the integrated jikes with the one from Eclipse 3.1, this way however has not been tested at the time of writing this.

The downside of this approach is, that a valid JDK is needed while the integrated jikes would allow to use only a JRE. But until the version problems are not solved using the javac compiler instead and a JDK probably is the better approach.

Special considerations on the Mac

Although the latest version of MacOS delivers a JDK 5.0 out of the box there are several problems to get Tomcat and MyFaces up and running. The problem is, that with newer JDK versions and in combination with Tomcat following bug occurs:

Description of the bug

so, if an error message similar to following:

>  org.apache.jasper.JasperException: Unable to compile class for JSP
>  
>  Generated servlet error:
>  error: error reading /System/Library/Java/Extensions/libJ3D.jnilib; java.util.zip.ZipException: error in opening zip file
>  1 error
>  
> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
> org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:246)  
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) 
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>  

is thrown, os refuses to compile the jsp, the reason for this is a strange bug caused by the combination of osx and jasper, where jasper assumes that everything under certain dirs referenced by javac is java and as soon as it hits a binary this error is thrown. This problem happens with a handful of binaries, installed by subversion, XCode and other tools. The only solution for now, neither Apple nor the ASF have fixed the problem yet, is to move the binaries out of the search path. Once this is done everything else regarding JDK 5.0 and Tomcat should be followed and MyFaces should run.

Tomcat_5_5_9_configuration (last edited 2009-09-20 23:00:51 by localhost)