]>
&project;
Tim FunkYoav ShapiraMiscellaneous Questions
This section contains various miscellaneous questions that are
asked frequently enough to be listed here.
org.apache.jasper.JasperException: Unable to compile
class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler
setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler
setting.
Others have had success by added JAVA_HOME/bin to their PATH.
1
...
2
and make sure you are using the full JDK and not the JRE.
In the case of the Environment issues, it is typical that on Windows, the
startup scripts work fine and the service does not. The service uses
registry values to look for java and other "stuff". To save yourself some
trouble, see if the
NT Service Config Utility
is helpful.
I can't get servlets to work under /servlet/*!
Using /servlet/ to map servlets is evil, absolutely evil.
Even more evil than
this
.
That being said, here are some threads that may answer this:
For another explanation of the invoker servlet, why it's evil,
and what to do about it, see
JavaRanch FAQ.
Why is the invoker evil?This is opinions of the writer (YMMV) Quickie about the invoker: The invoker is a dynamic servlet which
allows run-time
loading of other servlets based on class name. This servlet is the one
that allows
http://localhost/servlet/com.foo.MyClass?more=cowbell, where
com.foo.MyClass is some class which can be loaded as
a servlet but was never explicitly declared in a config file.
Evil because:
Security risk ... see links above
Configuration hiding - There is NO way to determine which servlets are
used vs which are not used. In web.xml, every servlet is declared
and mapped.
In that one file you instantly have a road map to how the webapp works.
Back doors. Servlets which are mapped can be alternately
called via the
invoker by class name. Since the URL is different, all security
constraints might be ignored since the URL pattern is VERY different.
Back doors. Bad programmers make it easier to do bad things.
Back doors. It may be common to use common 3rd party jars in a
shared area. If that shared jar has servlets in them and that servlet
has a hole in it, bad things happen.
Configuration hiding - it's important enough to say twice. Explicit
declaration while a PITA, will be more helpful in the maintenance
scheme of your webapp.
Starting with tomcat 5.0.28 - there is now a version.sh
(or version.bat) program in the bin directory.
It will print the version number of tomcat to Standard output.
In 1.4.1 JVMs there is a memory leak which could hampering the
garbage collector.
More information
Otherwise - get a memory profiler and/or tweak your memory settings.
How do I set system properties at startup?
Set JAVA_OPTS to be something BEFORE calling startup.bat
or before calling catalina.bat. (or you can edit those files, but it
isn't advised)
Example (windows): SET JAVA_OPTS='-DpropName=propValue'
Example (UNIX): export JAVA_OPTS='-DpropName=propValue'
Download Tomcat's base and admin webapp distributions (binaries), unzip to a directory
of your choice. We'll use c:\temp in this example.
Edit c:\temp\server\webapps\admin\WEB-INF\web.xml to remove the JSPC-generated servlet mappings.
These are marked in the web.xml file with comments indicating the beginning and end of the JSPC
section. You can simply comment out all these servlet-mappping elements. Be careful not to
comment out other servlet mappings such as the Struts dispatcher servlet.
Open c:\temp\server\webapps\admin\WEB-INF\lib\catalina-admin.jar with a zip file program like
WinZip. Remove the files named *_jsp.class, as these are the compiled JSPs. Do not remove
the other class files, the ones under the org/apache/ paths.
Download a Tomcat source distribution and unzip it to a directory of your choice, but not
the same directory that you used above. We'll use c:\src in this example.
Copy everything except the WEB-INF/lib directory from c:\src\container\webapps\admin
to c:\temp\server\webapps\admin. Now you will have the uncompiled admin webapp JSPs.
If you haven't already, define an admin user in %CATALINA_HOME%\conf\tomcat-users.xml.
Start Tomcat, navigate to http://localhost:8080 (or your actual server:port if you have modified
the default values), and access the admin web application. It will run slower because Tomcat is
now compiling the JSPs on-demand the first time you access them, but should otherwise appear normal.