It's one of those dangerous subscription services that automatically deducts money from your credit card every month. Nevertheless I keep my subscription to O'Reilly's Safari. It allows me to search and browse technical books over the web.
Case in point: I was trying to set up a JSP application I got and got an error message like this:
org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: nn in the jsp file: /index.jsp Generated servlet error: [javac] Compiling 1 source file /yada/yada/index_jsp.java:12: cannot resolve symbol symbol : class Foo location: class org.apache.jsp.index_jsp
There followed some scratching of my head. The class file was there in the classses directory where it was supposed to be. The classes directory is in the default classpath for any servlet. Why couldn't Jasper see the damn class?
In Safari, I searched for cannot resolve symbol
and found something that looked promsing in Java Server Pages (3rd Ed). And so it was. In chapter 16, under Dealing with Scripting Syntax Errors
, the book explains: Tomcat always compiles JSP pages into a package (org.apache.jsp) and therefore any unqualified class they refer to would be assumed to be in the same package. Ergo you cannot import classes from the default package. Solution: move the Foo class into a real package and import it explicitly into the JSP.
It all makes sense once you've seen the explanation but this did save me some time today. This kind of thing happens often enough that I never feel motivated enough to cancel my subscription.