1

I've got a webapp installed in a Tomcat container that exists on a read-only file system. As a result, I'm seeing this message (actual names changed to protect the guilty) on startup:

SEVERE: The scratchDir you specified: /readonlyfs/tomcat/work/Catalina/localhost/myApp is unusable.

Despite this message, the app seems to run, and it's difficult to tell for certain, but it appears that JSP pages are not being compiled for every access. So, my question is, what happens to the compiled JSP pages? Are they cached in memory? Are they cached indefinitely? Are they cached at all?

I need to know definitively because the application will almost always be deployed to a read-only file system, and if this will cause performance problems then I'll have to change scratchdir to point to another filesystem. However, this brings additional complexity to the deployment process that I'd like to avoid. So, if performance doesn't suffer, i.e., pages are cached in memory, then I am happy to leave things alone. I realize that serialized session data will be lost on a read-only file system, but that does not concern me, and is actually a plus. It's only the handling of compiled pages that concerns me.

Scott
  • 486
  • 4
  • 14

1 Answers1

2

It looks like the JSPs have already been compiled (do the .class and .java files exist under $CATALINA_BASE/work ?). That is why it appears things are working.

If you start Tomcat with an empty, read-only work directory (which the JSP engines uses for its scratchDir) you will see the following if you try to access a JSP:

HTTP Status 500 - java.lang.IllegalStateException: No output folder

You have a couple of options: a) touch every JSP to make sure they have all been compiled in the work directory and then included the complete work directory in your distribution b) pre-compile the JSPs

I would say b) is the better option.

Mark Thomas
  • 16,339
  • 1
  • 39
  • 60
  • This is correct. The JSP's were not being compiled so no error occurred, but when a JSP needs compilation, the exception you described occurs. I'm chagrined for not having seen this myself. Thanks! – Scott May 15 '13 at 15:31