As described in bug 39089, a known JVM issue, bug 6294277, may cause a
java.lang.InternalError: name is too long to representexception when compiling very large JSPs. If this is observed then it may be worked around by using one of the following:
- reduce the size of the JSP
- disable SMAP generation and JSR-045 support by setting
Tuesday, February 22, 2011
Tomcat - JSP Precompilation
JSP is usually compiled during runtime by Java server. Some disadvantages are
1. If you JSP page is large, it will take time to compile at runtime. If that is the first hit, the user will have to wait before the page is served to the user. This is a performance bottlenect.
2. Although the current IDE, such as Eclipse, provide JSP syntax check, you may still run into the situation whereby runtime error occurs due to JSP runtime compilation issues.
To overcome these 2 issues, you can precompile your JSP page before putting them into the server. Tomcat come with JSP precompilation tools for your usage.
The following steps provide information on how to perform JSP precompilation
1. Make sure you have your Tomcat server installed. Or, you need the jar files from tomcat/bin and tomcat/lib, as well as tomcat/bin/catalina-tasks.xml. catalina-tasks.xml is a helper file for loading Catalina ant task for you, ie, jasper task.
2. Make sure you have Apache Ant installed
3. Add the following build script. This build script assume that your jsp source is at your web container.
4. run the script with ant -Dtomcat.home="your tomcat server install home" -Dwebapp.path="your jsp source path". As you can see, tomcat.home is used to locate catalina-tasks.xml and webapp.path is used to locate your libraries and jsp source code. By changing these variables accordingly, you can customize your build path.
5. By default, it will compile your jsp into class file and put them at your "webapp.path"/WEB_INF/classes
Now, how to use these JSP classes file. 2 ways
1. Locate "webapp.path"/WEB_INF/generated_web.xml. Copy these contents into your web.xml
2. Copy all files at "webapp.path"/WEB_INF/classes into your tomcat server work folder. The common path is "your_tomcat_home"/work/Catalina/localhost/_/
You may want to ask why are we not using Ant JSPC task. That task is deprecated due to known problem in Tomcat 1.5 and it won't be fix by Apache Ant as well.
To date, there are 2 known issues for JSP precompilation. below is the abstract from Tomcat
By default, Facebook displayed your liked page to public. It is the user responsibility to adjust the privacy setting. And in my opinion, F...
If you have a series of JPEG which are taken over a period of time, you can use the following command to create a timelapse video. ffmpeg...
This is a MP4 file format notes that reference from ISO IEC 14496-12 2005 edition about Information technology — Coding of audio-visual obje...
Normally, RTSP provide streaming over UDP. By nature, UDP is a better choice as it provides robust streaming capability for media. However, ...