Saturday, July 9. 2011
Testing the IcedTea-Web Java Plugin
Some days ago I realized that debian packages related to java plugin in OpenJDK/IcedTea had been upgraded in testing to the new IcedTea-Web infrastructure. The IcedTea-Web is a redesign of the old gcjwebplugin and Netx JavaWS implementations. This entry talks a bit about the complex story of java web-plugin in OpenJDK and then a little testing of the new plugin is presented.
If you have been interested in the process of open-sourcing the Sun Java Virtual Machine (called OpenJDK) you already know that the Java web-plugin and Java Web Start (JavaWS) were never incorporated. The first component is the browser plugin that let HTML pages to integrate Java Applets inside them. If you remember I have talked about applets two times in this blog, first in the signature applet series and second in the scatter plot trilogy. JavaWS is a similar technology to Applets but not as tightly coupled with the browser, here Java applications run outside it but interaction is also possible. JavaWS is also known as Java Network Launching Protocol (JNLP) because of the definition files and the protocol used to launch the applications.
When Sun announced the possibility of open-sourcing the JDK in the JavaOne conference of 2006 there were some parts of the code which were covered by third party licenses (some GUI classes, the java audio system, some cryptography components and many more). For that reason the first versions of OpenJDK, released under GPLv2 license, were not complete and they had encumbrances. These parts had to be downloaded apart, as a binary blob, in order to get a full Java Virtual Machine. The plan was to gradually replace these proprietary components with alternative implementations. Nowadays OpenJDK has no more encumbered code or components and the sources for versions 6 and 7 can be downloaded from its web page (initially only JDK7 was to be open-sourced but finally JDK6 was included in a complex merge process). Nevertheless the web plugin and the JavaWS were not included in the free code neither in the encumbered parts (both technologies, although related to J2SE, are not part of it).
Update 10 of the non-free Sun JDK6 (not OpenJDK) replaced the Java plugin with a new and bright implementation. In the mids of 2009 Joe Darcy, at that moment the release manager of OpenJDK6, announced this new implementation was to be included in the OpenJDK tree. But some updates after and with no signs of the new plugin Joe himself confirmed that circumstances had changed. For one reason or another both technologies (Applets and JavaWS) were never moved from non-free implementation to OpenJDK.
Separately (but very close to OpenJDK) the IcedTea project is the effort of RedHat of making the OpenJDK usable without any encumbered bits as soon as possible. This project quickly added to OpenJDK the gcjwebplugin, a plugin implementation started as a Savannah project but later moved to the GNU classpath, and Netx, an alternative implementation of the JNLP protocol. The problem with these two projects was that both were old implementations and quite buggy. If you remember one of my reasons to start the HTML5 scatter graph study was the gcjwebplugin, default plugin for all linux distros.
I do not know the real reasons (maybe Sun announcement of plugin integration, maybe both technologies are not commonly used,...) but the real thing is that the plugin progress has been slow. IcedTea was born in 2007 using old implementations, in 2009 Deepak Hole announced the new IcedTea plugin in an enormous step forward, in 2010 it was integrated in IcedTea for the first time and, finally, in 2011 IcedTea-Web was released as a separated sub-project of the general IcedTea project.
Current version of IcedTea-Web is 1.1 and it is the version which has recently arrived to testing. Some days ago these packages were upgraded in my desktop box (I have installed OpenJDK there to see the progress of this implementation and not the non-free packages I usually use in my working laptop) and I decided to test how good the status of this new plugin is. I have to mention my previous experiences were very disappointing (when plugins were a little complex they never work). In order to do that I have checked the two most complex applets I have access to.
- The scatter plot Applet I commented in the canvas entries. This applet is used in Puertos del Estado web page (a governmental organization that studies sea and harbor issues in Spain). This application uses Google Web Toolkit (GWT) and the applet is presented always a magnitude is plotted (several applets in the same page, lots of sample points,...). When I was working there one of my mates used an ubuntu box with OpenJDK and the applet crashes sometimes (usually when you were displaying several graphs, adding or removing them).
- The Signature Applet I presented in the security series. Of course I am going to test the crytocard version using my Spanish eID (the most complex version, signed jar, JNI to the opensc-pkcs11 library and so on).
The conclusions are not very promising. It seems the new IcedTea-Web is evolving but it is not ready yet. With the scatter plot Applet I added and removed several graphs and two issues were found. When the plots are added to the page (a new div element is added) they are not properly re-painted, it is like the plot was not there (maybe this issue happens because the plots are added dynamically -javascript- to the page). Then I discovered the Sea Level plot hung the plugin. This magnitude plot (as I commented in its own entry) displays a lot of samples (more than 10,000) and it seemed IcedTea-Web could not manage this high number of samples. Using jconsole and looking at the code I found a loop that leaves much to be desired. Keeping my habits I developed a patch and reported a bug. I did not do anything with the first issue, it is quite related to the way applets are displayed and I do not have the source code of the applet.
In the Signature application more problems came out. First the PKCS11 provider did not load the certificates from the card. The KeyStore.getInstance(keyStoreType) method call does not work in OpenJDK/IcedTea-Web. I changed the call to KeyStore.getInstance(keyStoreType, provider) and it magically started to work. The second problem, when the signature was computed mail/activation libraries gave the following error javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/pkcs7-mime. It only worked when I copied Bouncy Castle libraries to the ext/lib OpenJDK directory. I do not really know what this issues are about but they seem related to security concerns, although this applet is self-signed (none of them happened in a simple java execution using OpenJDK -out of the applet- or in the non-free JDK plugin). Obviously the second Applet does not work (cos you cannot trust in a user copying files to lib/etx directory) but, as I commented in the signature entry, this Applet is just a PoC (Proof of Concept) and it does some strange things. I consider a real signature Applet (a one that just signs and/or encrypts) maybe would work.
It is important to comment that these two applets, although complex, work smoothly in the closed-source plugin. Finally I want to add that now the IcedTea-Web has a itweb-settings configuration command which emulates typical ControlPanel of non-free JDK (here there is also room for improvement but, you know, it is more than nothing).
I present a video where, using IcedTea-Web plugin inside iceweasel, I connect to the internet Plotter Applet and add three different graphs. As you see, applets are not re-painted (they need a click to force the rendering). But at least with my patch Sea Level plots are working. Then the Signature Applet is accessed (local application), once the libraries are in the lib/ext folder the mail is signed and sent without a problem.
It seems the IcedTea-Web is finally improving but nowadays it is still not the Java plugin that OpenJDK deserves. I did not test any JavaWS example (I have no one and it would be great if any of you could test some custom application) but I ran two applets which I know were problematic in OpenJDK before. Now both of them work better but some issues were still discovered. I know two tests are not many but they are meaningful to me. The best point is the plugin is now an independent project in IcedTea which I think guarantees better maintenance and improvement. Despite all this I am sure that if I have to develop a new applet or JavaWS application I will take this plugin implementation into account.
Keep on pushing IcedTea guys!
http://old.nabble.com/RFC%3A-Patch-for-Bug-749-%28sun.applet.PluginStreamHandler-handleMessage%28String%29-really-slow%29-tt31993146.html
http://dbhole.wordpress.com/2011/08/31/icedtea-web-1-1-2-released-maintenance-release/
Comments