Table of Contents

David George

An occasional blog

The JSP compiler cannae take it Cap'n

We ran into the old Java method limit problem compiling a JSP the other day. In the webapp log file we saw

org.apache.jasper.JasperException: Unable to compile class for JSP
 
Generated servlet error:
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit

and a little further down

...
at org.apache.jsp.display.main.content_jsp._jspService(content_jsp.java:2965)
...

The JSPs had tested okay on our staging environment but had failed when deployed to production. I assumed that content.jsp was causing the error and that, as it was a large JSP with lots of static includes, it was white space that was pushing it over the limit.

It turned out to be a runtime include that took a dynamic URL string. So the problem only occurred on certain versions of the page.

<jsp:include page="<%=cpUrl%>" flush="true"/>

I wanted to compile the JSP myself to see the error. On Tomcat if you look under the tomcat/work/Catalina directory you can find the “servlets” that get generated by Tomcat. If you see any .java without a corresponding .class it is a sign that the compilation failed. You can compile the generated .java file. If the file has been generated by Tomcat You will need to include the following jars in your classpath as well as any application jars or classes on which your JSP depends.

  • common/lib/jasper-runtime.jar
  • common/lib/servlet-api.jar
  • common/lib/jsp-api.jar

Of course relying on the trimSpaces parameter to sneak your JSPs under the 64K limit is poor design

<servlet>
...
  <init-param>
    <param-name>trimSpaces</param-name>
    <param-value>true</param-value>
    </init-param>
  </servlet>

The real lesson is to structure your JSP correctly so that the service method is not too big. However I've written this up in the hope it might be useful for solving other errors.

JSON request caching

I had a strange bug in a Google Web Toolkit front end I'm developing. The app consists of a tree explorer and a details page. This is all built using nice MVC structure with the observable pattern as outlined in Robert Hanson's GWT in Action. I can change the name of an object in the detail page and this should cause the name to be updated in the tree view. This worked ok under Firefox but not on IE. I determined that IE is caching the request.

This is actually quite sensible behavior. As far as IE is concerned nothing has changed, we are requesting the same resource a second time. IE doesn't know that we've actually been talking to the server behind its back. The secret here is never to make the same request twice. In GWT this is quite simple, simply add the current time in milliseconds from the system to a query parameter.

RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, 
    URL.encode(baseURL + "listPages.do?uuid="+ uuid + "&time="+System.currentTimeMillis()));
try {
    rb.sendRequest(null, new listFolderHandler(node));
} catch (RequestException e) {
    GWT.log("Could not send search request", e);
}
· 2008/10/24 15:30 · David George

Acer Expired

I didn't get much further with my Acer Aspire One installation as the screen went dead. Plugging into an external monitor showed that the machine was working. Closer examination revealed that the back light had failed. A problem with Acers it would seem. So two dead Acers in the space of a couple of days doesn't speak wonderfully for the reliability of the Aspire One. However I've not heard of many other problems apart from BIOS upgrades bricking the machine.

Stop Press

The Expire is back, or at least another replacement is. The last in the shop. It is currently going through the Live Update procedure… which will probably brick it 8-o. More later.

Acer no.3 has been working fine for the last month. I've installed Eclipse, Maven, Java and configured for dual screen use. This web page has some really useful customizations Acer Aspire One Tips and Tricks

· 2008/10/24 15:18 · David George

Acer Aspire One Review

I've just picked up an Acer Aspire One from my local Interdiscount in downtown Geneva for 449 CHF (which is around 280EUR). It is moderately more expensive in Europe than in the UK or US. Tant Pis! The missus wanted the French accents on the keyboard. It is not quite as tiny as the Asus EEEPC 900 which we use as a support computer to monitor our server farm but it looks a lot cooler in a shiny metallic blue case.

Well I was disappointed to get the beaute home only to have a HAL not initialized message on startup and NO WIFI, NO Ethernet and NO External drives. It was completely useless. If you tried to run the nm-applet from the command line you got a whole lot of hardware errors. It was as dead as a Dodo. I saw a program on the TV where they went to the plant to interview the guys who build these things. They are expected to produce 1700 per day! 500 more than a normal portable computer. So a trip back to the store for an exchange. The new one works fine.

First thing. ALT-F2 brings up a terminal window. You can enable some more advanced features of the xfce window manager by running

$ xfce-setting-show

Clicking on Desktop → Desktop Preferences and selecting the Behavior tab. Check the “Show desktop menu on right click” option and exit. Now if you click on the desktop background you get a “Start” menu.

Skype

I use skype a lot for work. The easiest way to install Skype is to surf over to www.skype.com and pick up the Fedora 7 version. Click on the rpm to install the package (you will need the root password you set up when you installed your Aspire). You may also want Skype to appear on the desktop. From a terminal edit

sudo vi /home/user/.config/xfce4/desktop/group-app.xml

and uncomment the line with skype. The sequence is its position on the desktop and must be unique.

· 2008/09/10 11:22 · David George

Aspect Oriented Development

I never realized that I was one of the pioneers of Aspect Oriented Development (AOP). However I was randomly browsing the web the other day when I came across this paper from the [http://www.aosd.net/2006/archive/AOSD06-IndustryTrackProceedings.pdf|5th International Conference on Aspect Oriented Programming] in which the paper on using AOP for Performance Management cites my x.Link profiler.

I started x.Link back in late 2002. It uses hooks into the Java JVM classloader to modify bytecode on the fly to provide hooks into the entry and exit of methods. The methods to modify are specified by regular expressions. A bit like AspectJ and Spring AOP.

· 2008/08/20 11:31 · David George

Older entries >>