June 29, 2012

JUDCon and JBoss 2012 Boston: OSGi is coming back

I don't know how many of you are using OSGi, but my feeling was it was a hot topic a couple a year ago and then everything cooled down. But now it looks that the Java EE container vendor are picking it up again. The following table below show the support of OSGi in the biggest EE containers:
App Server Deploy Bundle WAB Support* EJB/JPA
Glassfish Yes Yes Prototype
Webspere Yes Yes Prototype
WebLogic No No No
JBoss AS Yes Yes No
*)WAB, Web Archieve Bundle

This is all interesting you might think, but what impact will that have on the Java EE architecture? I would say a rather a lot. Lets start with the deployment. All Java EE deployable are monolithic, think of web and ear. They all package everything in on single file. How does that go with the OSGi moduling thinking? Not at all. The OSGi concept is programming modules and make them interchangeable, deployable as separate module and with own versions lifecycle. So this has to change if one want to bring the OSGi thinking to the Java EE arena.

If you want to play with OSGi I would recommend Eclipse and install the bnd tool (http://bndtools.org/).

And if you want to read more about OSGI OSGi in Action by Manning is a great book.
http://www.amazon.com/OSGi-Action-Creating-Modular-Applications/dp/1933988916/ref=sr_1_1?s=books&ie=UTF8&qid=1340977056&sr=1-1&keywords=osgi+in+action

And at more architecture level I would recommend Java Application Architecture
http://www.amazon.com/Java-Application-Architecture-Modularity-Patterns/dp/0321247132/ref=sr_1_1?s=books&ie=UTF8&qid=1340977092&sr=1-1&keywords=Java+Application+Architecture

JUDCon and JBoss 2012 Boston: Red Hat released the JBoss EAP 6 at june 21 2012


Red Hat keeps the pattern of changing the JBoss server drastically with every major release version and that is the case with JBoss EAP 6 as well.

One of the biggest differences are:
  • Is starting to aim at a more OSGi oriented architecture, the full OSGi support is not there yet, but will be fully supported in JBoss EAP 6.1
  • The configuration has changed dramatically, basically they have moved all configuration to one file instead of having them sprayed out the entire JBoss file directories. And then start using more default which leads to a great reduction of the configuration file.
  • The startup and running lifecyle has changed and comes down to two ways domain and standalone, which is quite similar to Oracle BEA, if you are familiar with that.
I will hopefully blog more about the JBoss EAP 6 in future.

But there were also more releases announced at the same day and maybe from a developer point of view, the most interesting was the the improved JBoss best practice documentation sites:

The JBoss Way
http://www.jboss.org/developer

JBoss Developer Framework
http://www.jboss.org/jdf/

Another big and important announcement is that the project Wolf has finally delivered. The project Wolf is about providing a centralized maven repository for the JBoss EAP development. And this repository is also shipped with JBoss EAP.

And all the presentation will be made available at http://www.youtube.com/redhat.

June 28, 2012

Improve your performance on Ubuntu 12.04 with Jupiter

I had some performance problems with Ubuntu 12.04 when my battery started to run out. To help this I installed Jupiter and change to Maximum Performance.
$ sudo add-apt-repository ppa:webupd8team/jupiter
$ sudo apt-get update
$ sudo apt-get install jupiter
For details see http://www.webupd8.org/2010/07/jupiter-ubuntu-ppa-hardware-and-power.html.

And if you like to change the default Icon simply replace the /usr/share/pixmaps/bolt1-4.png files. For details see http://askubuntu.com/questions/127449/how-can-i-change-the-icon-for-jupiter.

June 1, 2012

How to install install and configure SSL on Tomcat 7

In my previous blog I described how to install and configure SSL on Jboss 5.1 (http://magnus-k-karlsson.blogspot.se/2012/05/how-to-install-install-and-configure.html) and in this blog I will how to do the same but for Tomcat 7. And you will see it is very similar. And the reason for that is that JBoss is actually using Tomcat as web container. So to configure SSL on Tomcat follow the same step as in my previous blog to create server certificate and then open server.xml add the following configuration for the https Connector.

$CATALINA_HOME/conf/server.xml:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
        maxThreads="150" scheme="https" secure="true"
        clientAuth="false" sslProtocol="TLS" 
        keystoreFile="${catalina.base}/conf/server.keystore"
        keystorePass="changeit" />
Then reuse the previous test application and open your browser. Here you will get a warning about a self-signed certificate. Accept it and you will see your application.

Performance Tuning Web Pages

Yesterday I had a problem with a web based system that was not very responsive. After some effort I later found out it was certain javascript that was slow and these javascript were hosted by another company on another server. After some researching I found out that if I moved the script from the header html tag to the end of the file before the closing body html tag, the page was rendering directly in the client browser, and the slow javascript was afterwards loaded in the background. In this way the slow javascript was not stopping the user from interacting with the web system, but of course will not the javascript be run until it is downloaded.

Before:
<html>
    <head>
        <script src="some_url" type="text/javascript"></script>
        <script type="text/javascript">
            // maybe call some script
        </script>
    </head>
    <body>
    </body>
</html>
After:
<html>
    <head>
    </head>
    <body>
        <script src="some_url" type="text/javascript"></script>
        <script type="text/javascript">
            // maybe call some script
        </script>    
    </body>
</html>