tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: Intermittent "ServletException - Unable to compile class for JSP" for a struts-1.3.10 web-app with Tomcat 7.0.26/7.0.27
Date Thu, 12 Apr 2012 14:03:55 GMT
2012/4/12 Ashima Sharma <>:
> Most of the jsps have this issue...but it happens randomly. For e.g., i wd
> be able to access the registration page 5 times w/o any issue, and the 6th
> time I'd get this error.
> Its bizarre that tomcat tries to recompile the already compiled jsp at some
> random point even though the page hasn't changed, and throws the cannot
> compile error. All the jsps with this issue have the .java and .class files
> under the work directory.
> The compilation issue is
> in org.apache.jasper.runtime.JspSourceDependent.getDependants method for
> every jsp
> in -
> line 49-  public java.util.Map<java.lang.String,java.lang.Long>
> getDependants() {
> line 50-    return _jspx_dependants;
> line 51-  }

> *An error occurred at line: 49 in the generated java file*
> *This method must return a result of type Map<String,Long>*

What is the type and value of  _jspx_dependants field?

It seems that it complaints that that field returned by the method is
not Map<String,Long>.

> Can you confirm that after you try to access the .jsp from the
> browser, the timestamp on the .java file changes?

Timestamp does not matter, because in latest Tomcat 7 it is set to
match the original file.

There is a comment at the top of generated java file that mentions
this fact and the actual time of generation.

You can look at "creation time" of the file as provided by NTFS. That
is because a new file is created and then its modification time is set
to the past.

1. Can you cite with what parameters "JspServlet" in your web.xml is
configured, exactly?

> This error happens when the original .class file can't be deleted
> before re-naming an SMAP-loaded copy of the .class file. Can you
> confirm that you have files called, for example,
>, userProfileBodyTile_jsp.class, and
> userProfileBodyTile_jsp.javatmp ?

2. It is possible to suppress SMAP generation by setting
"suppressSmap" parameter in JspServlet to "true".

3. Deletion of recently created files on Windows can be impeded by
antivirus scanners. (Subversion client users on Windows are sometimes
complaining about that. It depends on a/v product being used.).

Maybe Tomcat can rename the old file before deleting it.
IIRC Windows allows renaming files that are open for reading, but has
problems with deleting them.

> I read that you have performed a clean install of Tomcat, which is a
good step to take because this looks like a mismatched Jasper problem
or something.

On Windows the actual setting the Service starts with are stored in
the registry. I hope those are correct.  I also hope that you do not
have any strange JARs (e.g. a copy of Jasper) in your webapp.

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message