You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2005/08/28 20:51:40 UTC

[Myfaces Wiki] Update of "Tomcat 5.5.9 configuration" by WernerPunz

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by WernerPunz:
http://wiki.apache.org/myfaces/Tomcat_5%2e5%2e9_configuration

The comment on the change is:
Added docs for Tomcat 5.5.9

New page:
= Introduction =

Tomcat 5.5.9 is somewhat special compared to the older Tomcat servlet containers. It is a major overhaul on the compiler side of things.
The main problem is, that Tomcat 5.5.9 requires a JDK 5.0 out of the box, otherwise it will refuse to work, or a compatbility pack for older JDKs.

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. This has been a source of many headaches for many people in the past.

The reason for this problem is, that the integraterd jasper-javac compiler, which did its work until 5.5.8 has been replaced with a jikes compiler from the Eclipse project. Although this move will result in higher efficiency of jasper thanks to higher execution speed and incremental compilation, the jikes version used in Tomcat 5.5.9 is unable to compiler 5.0 constructs. This limitation will probably be removed in Tomcat 5.5.10, but for now we have to live with it.

Therefore the documentation will be split into two parts, one part of getting MyFaces up and running in a Tomcat 5.5.9 environment using JDK 1.4.x and the other one for JDK 5.0.

= MyFaces, Tomcat JDK 1.4.x =
The installation of MyFaces on this configuration is rather straightforward. All which has to be done is to download
Tomcat, the compatibility pack, install tomcat, expand the compatibility pack and the basic configuration should work, if a proper jdk is assigned to the Tomcat servlet runner.

Now only one of the MyFaces wars has to be dumped into the servlet container, and the jsp-2.0.jar file has to be deleted (mandatory because Tomcat now has the proper jar integrated itself)
and everything should run.

= MyFaces, Tomcat JDK 1.5.x =
This one is somewhat trickier, althoug less problematic downloadwise. 

== First step basic install ==
in the first step, tomcat has to be downloaded and installed, thats it...

== Second step, getting jasper to run with 5.0 language constructs ==
The preffered way if 5.0 is used, would be that also 5.0 language constructs can be used, unfortunatly the integrated jikes/jasper compiler does not allow to do this, therefore some things have to be altered to switch back to a jdk javac for compilation. 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 [http://marc.theaimsgroup.com/?l=tomcat-user&m=111660999324714&w=2 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.


Once this is done a simple deploy of one of the example wars and a deletion of the jsp-2.0.jar in
the webapp/WEB-INF/lib should be enough to get things up and running.


= 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:

[http://lists.apple.com/archives/Java-dev/2005/May/msg00760.html 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.