You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Stig Sørensen <st...@ruc.dk> on 2004/03/31 13:38:52 UTC

FYI: Tomcat 5.0.19 cannot compile JSP's on Novell NetWare 6 FIX!!

Hi all
As a user of Tomcat on NetWare, I've been trying to make Tomcat 5.0.19 
work on NetWare6. With a proper startup script, Tomcat 5.0.19 works "out 
of the box" on NetWare, except for one (major) JSP issue. Tomcat fails 
to rename newly recompiled JSP's from *.classtmp to *.class. I've 
tracked the problem to SmapUtil.java, on line 230, a call to renameTo() 
fails with an IO exception. I expect that this is a NetWare specific 
issue, relating to the NetWare JVM. If anyone else has experienced this 
issue on another platform than NetWare, please give some feedback.

I have both a quick hack to fix this issue, and a more proper solution.

The hack:

Edit conf/web.xml, search for "<servlet-name>jsp</servlet-name>".

put in the path to the "work" dir (eg. /tomcat/5019/work or 
sys:/tomcat/5019/work )

<init-param>
  <param-name>scratchdir</param-name>
  <param-value>/tomcat/5019/work</param-value>
</init-param>

This makes the first problem go avay, but creates a new one, as miltiple 
JSP's might end up being compiled to the same class filename and path.

-And the proper solution:

In SmapUtil.jave, swap the "static void install(File classFile, byte[] 
smap)" method with this:

static void install(File classFile, byte[] smap) throws IOException {
           File tmpFile = new File(classFile.getPath() + "tmp");
           new SDEInstaller(classFile, smap, tmpFile);

           if (!classFile.delete()) {
               throw new IOException("classFile.delete() failed");
           }

           FileInputStream fis  = new FileInputStream(tmpFile);
           FileOutputStream fos = new FileOutputStream(classFile);
           byte[] buf = new byte[1024];
           int i = 0;
           while((i=fis.read(buf))!=-1) {
               fos.write(buf, 0, i);
           }
           fis.close();
           fos.close();

           if (!tmpFile.delete()) {
               throw new IOException("classFile.delete() failed");
           }
       }

Whit this fix, Tomcat 5 runs like a charm on NetWare 6. It would be nice 
to see this fix (or somthing like it) being includet in the official 
tomcat code, but I can see that the will to do so might not be there, if 
this is a NetWare only issue. Anyways just wanted to share my 
experiences with Tomcat 5 on NetWare.



cheers!
/Stig

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: FYI: Tomcat 5.0.19 cannot compile JSP's on Novell NetWare 6 FIX!!

Posted by Remy Maucherat <re...@apache.org>.
Stig Sørensen wrote:
> Hi all
> As a user of Tomcat on NetWare, I've been trying to make Tomcat 5.0.19 
> work on NetWare6. With a proper startup script, Tomcat 5.0.19 works "out 
> of the box" on NetWare, except for one (major) JSP issue. Tomcat fails 
> to rename newly recompiled JSP's from *.classtmp to *.class. I've 
> tracked the problem to SmapUtil.java, on line 230, a call to renameTo() 
> fails with an IO exception. I expect that this is a NetWare specific 
> issue, relating to the NetWare JVM. If anyone else has experienced this 
> issue on another platform than NetWare, please give some feedback.
> 
> I have both a quick hack to fix this issue, and a more proper solution.
> 
> The hack:
> 
> Edit conf/web.xml, search for "<servlet-name>jsp</servlet-name>".
> 
> put in the path to the "work" dir (eg. /tomcat/5019/work or 
> sys:/tomcat/5019/work )
> 
> <init-param>
>  <param-name>scratchdir</param-name>
>  <param-value>/tomcat/5019/work</param-value>
> </init-param>
> 
> This makes the first problem go avay, but creates a new one, as miltiple 
> JSP's might end up being compiled to the same class filename and path.

You can put the JSP servlet declaration in the web.xml of your webapp, 
so it's a per webapp setting.

> -And the proper solution:
> 
> In SmapUtil.jave, swap the "static void install(File classFile, byte[] 
> smap)" method with this:
> 
> static void install(File classFile, byte[] smap) throws IOException {
>           File tmpFile = new File(classFile.getPath() + "tmp");
>           new SDEInstaller(classFile, smap, tmpFile);
> 
>           if (!classFile.delete()) {
>               throw new IOException("classFile.delete() failed");
>           }
> 
>           FileInputStream fis  = new FileInputStream(tmpFile);
>           FileOutputStream fos = new FileOutputStream(classFile);
>           byte[] buf = new byte[1024];
>           int i = 0;
>           while((i=fis.read(buf))!=-1) {
>               fos.write(buf, 0, i);
>           }
>           fis.close();
>           fos.close();
> 
>           if (!tmpFile.delete()) {
>               throw new IOException("classFile.delete() failed");
>           }
>       }
> 
> Whit this fix, Tomcat 5 runs like a charm on NetWare 6. It would be nice 
> to see this fix (or somthing like it) being includet in the official 
> tomcat code, but I can see that the will to do so might not be there, if 
> this is a NetWare only issue. Anyways just wanted to share my 
> experiences with Tomcat 5 on NetWare.

Obviously, it runs fine on other platforms (and I can't see anything 
wrong with the current code).
IMO, you should precompile your applications.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org