| Author |
Unable to compile class for JSPerror
|
Shuai Liu
Ranch Hand
Joined: Jan 25, 2002
Posts: 49
|
|
Hi all, I am writing a JSP (struts) application on tomcat. Strangely, I receive an "unable to compile class" error every time I try to access the JSP page after restarting TOMCAT. The error msg is something like: org.apache.jasper.JasperException: Unable to compile class for JSPerror: Can't write: C:\apachetomcat\webapps\ROOT\WEB-INF\classes\CurrentMonth.class (In this case, CurrentMonth is a java bean class) That error occurs only at the first time access. The normal page will show up after I click the "refresh" button on the browser, and the error normally won't show up since then. Can someone please tell me what's wrong and how to solve it? Thank you!!
|
 |
Sreenivasa Majji
Ranch Hand
Joined: Jul 12, 2001
Posts: 224
|
|
|
Clear the browser cache. You will be fine.
|
Sreenivasa Majji
|
 |
Shuai Liu
Ranch Hand
Joined: Jan 25, 2002
Posts: 49
|
|
Thank you for the reply. Can you tell me what the reason that causes this problem? Also, how can I ask the users to clear their cache every time they access my app? Is there another way to prevent it from happening? Thx
|
 |
Sreenivasa Majji
Ranch Hand
Joined: Jul 12, 2001
Posts: 224
|
|
|
It's browser thing, I don't think you application should do any thing different. More over they will see only HTML output, not your exceptions. The users will see only the HTML (all jsp/servlet code will be executed on your web server, not on user's machines).
|
 |
Shuai Liu
Ranch Hand
Joined: Jan 25, 2002
Posts: 49
|
|
If the problem is at client side, how come it happens every time I re-start my server? Also, I believe the servlet engine/app server will display exceptions in html format. Is that right? Thanks.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
|
|
I know this sounds weird, but put CurrentMonth in a package. Classes that are not in packages just plain cause trouble in servlet engines. Bill
|
Java Resources at www.wbrogden.com
|
 |
Shuai Liu
Ranch Hand
Joined: Jan 25, 2002
Posts: 49
|
|
William, I did put every class in a package and I packaged them in a Jar file. Any thoughts? Thanks a lot!
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
|
|
Do you continue to get this error: Why do you suppose it doesn't look for CurrentMonth in a package???
|
 |
Shuai Liu
Ranch Hand
Joined: Jan 25, 2002
Posts: 49
|
|
Originally posted by William Brogden: Do you continue to get this error: Why do you suppose it doesn't look for CurrentMonth in a package???
Sorry, what do you mean? Yes, I still get this same error.
|
 |
 |
|
|
subject: Unable to compile class for JSPerror
|
|
|