Tag Archives: Java

Migrating to JRockit

I’ve been bothered with the now famous PermGen Space error while developing a web application on a local jetty instance quite often, and I was hoping that the problem wouldn’t prove to be that serious once deployed on a tomcat server, but quite the opposite is the case.

The problem happens when the JVM runs out of permanent generation heap space, which most of the time is due to classloaders not being correctly garbage collected. Permanent generation heap space is an optimization that the Sun JVM contains to speed up object creation, but the default size is too small if classes are loaded and unloaded often during runtime, which is exactly the mechanism most application servers load applications.

So the first, quick and dirty, solution would be to enlarge the permanent generation heap space: -XX:MaxPermSize=256m Sadly, this still doesn’t get rid of the problem. Another solution is to use a completely different JVM altogether: JRockit.

JRockit, a proprietary Java Virtual Machine (JVM) from BEA Systems, became part of Oracle Fusion Middleware in 2008.

Many JRE class files distributed with BEA JRockit exactly replicate those distributed by Sun. JRockit overrides class files which relate closely to the JVM, therefore retaining API compatibility while enhancing the performance of the JVM.

[from Wikipedia]

I wasn’t thrilled having to change JVM because it isn’t available in the openSuse repositories at all, and I wasn’t quite sure how hard it would be to make the switch. As I found out, it’s incredibly easy.

Getting the package

Getting your hands on the JRockit installation package isn’t all that easy, because BEA became part of Oracle and everything is still in transition. The download location is http://edelivery.oracle.com/, where you’ll be greated by a wizard to select the products to download.

JRockit can be found under BEA Products and then BEA WebLogic Media Pack, scrolling down you’ll find the zip package you need depending on your operating system.

Installation

Installation is straight forward, just unzip the archive and then execute the contained installer:

$ unzip B46961-01.zip
Archive:  B46961-01.zip
  inflating: jrockit-R27.5.0-jdk1.6.0_03-linux-x64.bin
$chmod +x jrockit-R27.5.0-jdk1.6.0_03-linux-x64.bin
$sudo ./jrockit-R27.5.0-jdk1.6.0_03-linux-x64.bin

Now all you have to do is follow the instructions of the installer. When asked for a location to install JRockit into, I used /opt/jrockit but every location will do just fine.

The next step is optional, but if you use update-alternatives I strongly suggest you to do it. We’ll add jrockit java and the the jrockit compiler (javac) as alternatives:

update-alternatives --install /usr/bin/java java /opt/jrockit/bin/java 300
update-alternatives --install /usr/bin/javac javac /opt/jrockit/bin/javac 300
So when doing an update-alternives we see the jrocki VM:
$ update-alternatives --config java

There are 2 programs which provide `java'.

  Selection    Command
-----------------------------------------------
 +    1        /usr/lib64/jvm/jre-1.6.0.u7-sun/bin/java
*     2        /opt/jrockit/bin/java

Enter to keep the default[*], or type selection number:
so now we can easily switch between the Sun VM and the JRockit VM. That’s it. Now just check to see if we really have the JRockit VM and we’re ready to code:
$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
BEA JRockit(R) (build R27.5.0-110_o-99226-1.6.0_03-20080528-1505-linux-ia32, compiled mode)

  • Share/Bookmark

Debugging remote Tomcat from Eclipse

I recently set up a new Project using Maven 2. Sadly, while facilitating the Project setup, this means that I couldn’t get all the free configuration I could have had by simply clicking through the Eclipse Wizard for Dynamic Web Projects, namely the ability to run the Tomcat container right inside Eclipse, with automagic reloading, etc… Luckily I found this post by Narendra Naidu which explains the details on how to start Tomcat in the JPDA debugging mode, and how to attach Eclipse to it:
  1. Start Tomcat in JPDA debug mode. For this, set up two variables in the environment as follows:
  2. The first variable is: set JPDA_TRANSPORT=dt_socket (This tells the VM that the debugger would talk to the VM on Tcp sockets)
  3. The second variable is: set JPDA_ADDRESS=8000 (This tells the VM the port on which it should listen for debugger connections)
  4. Go to the command prompt and run the ‘Catalina.bat’ batch file present in {TomcatHome}\bin. On the command prompt pass the following argument: catalina jdpa start
  5. Go to Eclipse and open the Debug window. Create a new configuration under ‘Remote Java Application’ . Make sure ‘Connection Type’ is Socket and port is 8000
  6. Navigate the webapplication thru web browser and see your Eclipse stop at breakpoints.
Very helpful :-)
  • Share/Bookmark

Taking KDE 4 for a tour

Right now I’m writing this from the newest Kubuntu version which sports the newest KDE 4 version, and I just got one comment: “awesome” :) It’s nice, it’s fast and it’s intuitive, not sure how much is due to Kubuntu and how much it’s KDE4’s own improvement, but surely I will test it as soon as I get a better view at it on openSuse.

I suggest you get a look yourself and test it out, it’s beautiful ^^

1Y0-614 provides a perfect Citrix 1Y0-614 training and skills to IT professionals. 1z0-031, Oracle9i Database: Fundamentals which are very vital exams of oracle developers. 1z0-147 certification exams are very imperative to enhance knowledge for database managers and networking administrators. 310-015, Sun Certified System Administrator for the Solaris 9 Operating System exam is significant exams to become system analyst or networking engineers. 310-014, Sun Certified System Administrator for the Solaris 9 Operating System exam is perfect exam to improve the professional capabilities of system administrators. 310-081, Sun Certified Web Component Developer for the Java 2 Platform, Enterprise Edition 1.4 is very advantageous for web developers to enhance more knowledge about web development. 312-49 is also known as Computer Hacking Forensic Investigator which provides such technical strategies to secure the computing and networking system from hackers
  • Share/Bookmark

Java, a retrospective

I’ve been a java programmer since it came out in 1995. My father discovered that I was writing small scripts for some computer games and asked me whether I was interested in learning a real programming language.

Java was easy enough that i could write programs for my day to day usage, my masterpiece being an HTTP-Proxy to be able to surf the web (remember the 56kbs modems? :D ).

Java had a troubled story, loosing both the browser and the desktop as a platform it was soon banned to mobile phones and to the serverside, but it also brought us some great changes for which we should be grateful. For once they introduced a good set of standard libraries which i so sorely miss in other languages, and with java it suddenly was easy to put together great applications. ReadWriteWeb has a really good look at the history of java which i think everyone should have read, i certainly felt touched while reading it.

Java was and still is a revolutionary technology, so revolutionary that Sun Microsystems recently changed its Stock Symbol from SUNW to JAVA.

  • Share/Bookmark

Sxip contributes Java and Perl libraries to OpenID 2.0

Some great news from the Sxip team, who recently released their a beta of their service Sxipper, have released two libraries for OpenID:
Licensed under an open source Apache 2.0 license, Sxip has released the OpenID4Java and OpenID4Perl libraries. The libraries are easy-to-use and well-documented, allowing you to add full support for OpenID 1.x, 2.0 and Attribute Exchange into your Java and Perl based applications. We invite you to try them out and would appreciate your feedback! We also welcome and encourage community participation around the ongoing development of these libraries. OpenID is an emerging Identity 2.0 authentication mechanism that enables users to maintain one login and password account for access to many sites. Package downloads for the latest version of the Java and Perl libraries for OpenID can be found on the distribution project page at code.sxip.com. In the coming weeks, we’ll update the library based on the progress of the OpenID Authentication 2.0 specification and we’re looking forward to working with others on the project!
I’m a huge fan of OpenID, and everything that helps implement the protocol easier is a step in the right direction.
  • Share/Bookmark