Thursday, December 16, 2010

Apples vs Oranges. Java Container Startup Times

Just recently with @toomasr we've studied how fast are the Java application servers at the boot time. The boot time for an application server is an integral part of what we call the developers' productivity.

The most surprising this thing about the results was that the JBoss 7 average startup times where extremely fast compared to the previous JBoss versions.

At the beginning we couldn't believe this improvement is for real and assumed that JBoss 7 is an OSGi container. But just a bit later some JBossAS developers commented on the blog entry, that actually JBoss 7 has been completely redesigned for classloading performance.

Andy Miller said:
The startup times really don't have anything do with the OSGi stuff that is in there. It's based on a new services architecture underneath, which can start services and load classes in parallel (there are some JVM limits in class loading that make it serial, but we hope that will disappear), and take advantage of the fact that there are multiple cores on virtually every machine someone would use today.

To learn about the new features in JBoss 7, the highly recommended listening can be found at the JBoss Asylum podcasts page.

Thumbs up for the JBoss engineers, really! At least some AS vendors do care about the developers productivity! :)

Tuesday, December 14, 2010

LiveRebel Product Demo

JetBrains Youtrack

Recently, I've spent some time playing with Youtrack, the bug tracker by JetBrains. The last time I was looking at it was about 2 years ago, when it was announced under the name Charisma.

Long story short - I've a very pleasant experience while trying Youtrack now. But let's take a closer look!

I kick ass withAJAX-based issue management system
What are the features that I've noticed and liked:

The command-line with auto-complete. Sometimes I get really lazy and just unwilling to use the bugtracker as I have to use the mouse and click over several screens in the bugtracker's UI to get the job done. With Youtrack, I can make queries in the command-line that has autocompletion, which is awesome!
Project settings and administration. It took me just a couple of minutes to configure a project and the users. And also I figured out very quickly how to the user roles work. Considering I'm just an ordinary user for this type of software - this is a good sign!
Shortcuts are configured just like in IntelliJ IDEA, which I'm being a big fan of. I think this is an awesome feature for any IntelliJ user trying to use Youtrack.
The UI did not cause any animosity during use for me. Also, you can make screenshots just from the form where you report an issue - a very handy feature I have to say.

Thursday, November 18, 2010

JRebel at Devoxx 2010, Conference Day #2

Day 3 at Devoxx for me is over. Lots of JRebel demos today again at Devoxx expo area.

We've got plenty of feedback for the product and features/improvements we would consider to implement  in the next releases. That includes Grails GORM support, support for adding new EJBs (3.0) on-the-fly, support for Servlets 3, better support for Wicket, better NetBeans plugin, plugin.xml support for Eclipse RCP, and many more! So that's something we should definitely to consider for the upcoming releases of JRebel.

Also, I met some people who haven't used JRebel yet, or haven't heard of it at all. After the demo they wanted to start using it! I hope we'll get to hear from those who started using JRebel - the feedback for is really appreciated!

I managed to escape from the booth to attend JavaPosse live session at the conference - I haven't had a chance to attend their sessions before. That was fun! :)

With that, the expo is over and JRebel team is going back to continue doing the awesome job!

Wednesday, November 17, 2010

JRebel at Devoxx 2010, Conference Day #1

Day 2 at Devoxx for me is over! Lots of demos, chatting, explaining things, etc

For a start we had a quick chat with Geertjan Wielenga about Javeleon. Even after a short conversation I think I have more understanding what it is about.

Also, I had luck to "unvirtualize" with Claus Ibsen and Charles Moulliard (from FuseSource), the guys behind Apache Camel - it is always a pleasure to meet people in person.

Also, somehow, my twitter reference have gotten to the Devoxx daily web page. Just because we have released a new JRebel version before Devoxx we were actually get quite a lot of buzz for the product which is positive as it gives the opportunity to get the feedback faster from the users. For Devoxx attendees we still have the giveaway "LiquidMetal" licenses - so go grab one!

I attended one session, the Reflection Madness by Heinz Kabutz. This was an awesome talk, but pretty much a compilation of the articles from newsletter.

I can say I really like the spirit of Devoxx (compared to JavaOne this year) - it is even more technical: people come and ask good questions about JRebel. Some already use it but want to know more - that's also great! What I'm realizing now, is that the awareness is quite low for the issues that we're trying to solve. Probably, it would be a good idea to submit a talk at JAZOON'11, just to show what problems exist that are related to deployment under application servers of all sorts...

Tuesday, November 16, 2010

JRebel at Devoxx 2010

The first day for us was actually the University Day #2 at Devoxx. Not as many participants yes as it is expected on the real conference days. I did a few demos today demonstrating the PetClinic Spring MVC app. Frankly, I've got sick from doing the same demo again and again. Gotta prepare a new demo for tomorrow so it wouldn't be as boring :)

The fun stuff is that I managed to convince some hard-core devs that JRebel isn't about continuous integration, and it doesn't prevent devs from doing TDD and any other 'enterprise practices' one may apply during the development cycle.

Sunday, September 26, 2010

JRebel at JavaOne

And so as JavaOne 2010 is over and I'm back home, I probably should make a summary of the event as I seen it.

We arrived at the venue on Sunday to set up the boot for the upcoming expo. It was the very disappointing: the expo area was really small compared to the previous years. I do understand that OOW and JavaOne are held together as one event for the unity to show the benefit of using Oracle products. But JavaOne is a conference considered to be a #1 conference for Java developers for a long time and now this - sessions moved to Hilton and Park 55, and broken apart, and the expo is tiny small :(

Anyways, we had busy time showing JRebel demos one ofter another. And the most exciting part of that was that some of the people coming already used JRebel for their development and just came to say thanks for that JRebel exists! :)

Our marketing guys hired two pretty models to attract people to the booth. This was a blast! People stopped by even if they weren't interested at first! :) I could feel the jealousy coming from the booth next to us :) I admit, it was a dirty trick, but it worked well.

Unfortunately, we couldn't take part in the sessions as it was almost impossible to get in if you weren't preregistered. That said, I'm in a hunt for the slides of the Core Java sessions for now :)

Personally I've met quite a lot of interesting people (Hello, everyone!), hopefully I we'll be able to develop the connections further on. Also, I had luck to take part in the JRuby meetup at EngineYerd's office and JetBrains Be Wiser Party. Enjoyed that!

Saturday, September 4, 2010

IntelliJ IDEA column mode editing

Ctrl+Alt+Insert shortcut brings you into "column mode", which might be very helpful!

Thursday, August 26, 2010

Screencast: RESTEasy application instant updates with JRebel

JRebel manages the updates while adding new changes to a simple RESTEasy application: adding new resource using the JAX-RS annotations and adding new Java code to the application. No re-deploy phase required.

Tuesday, August 24, 2010

RESTEasy. rest, easy.

I've spent some days figuring out how does RESTEasy initializes itself. The goal, which came actually from a support case, was to hook into the framework and make it possible to add new resources with @Path annotation without re-deploying the application itself.

It turned out that as RESTEasy has 3 main options for bootstrapping: servlet (which actually has a plenty of configuration switches), listener, and filter. This is quite important as RESTEasy initializes itself a little bit differently depending on what kind of configuration is provided.

I've managed to patch the internals of RESTEasy in a way, so that in case of "servlet" bootstrapping, when adding a new resource to the application, the new context path appeared instantly, without re-deploying the application.

For a demo, I used the 'jaxb-json' example that is bundled with RESTEasy distribution. By default, the example uses listener bootstrapping configuration, thus web.xml has to be modified a little bit to use 'servlet' configuration instead:

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

  <display-name>Archetype Created Web Application</display-name>





Next, run the application, and see that localhost:8080/resteasy/library/books/badger responds as intended for the given example.  Now, if we use JRebel to make the class re-loading possible, and patch some classes of RESTEasy framework, one will be able to add new methods to the resource class without having to re-deploy the application. Say, I've added a new method to the class, and marked it with the @Path annotation:

public class Library {
   public String getTest() throws Exception {
      return "my test";

So now I could go to localhost:8080/resteasy/library/books/test and see the changes instantly! Hopefully we can add this feature to support all kinds of RESTEasy configurations. The feature will be available quite soon in one of the upcoming JRebel nightly builds.

Wednesday, August 11, 2010

Having fun with Grails and JRebel

Gails is a fun framework to work with. Recently, I had to figure out how "dynamic" the framework is.

BTW, IntelliJ IDEA Grails support just rocks!

One thing that is definitely useful - to tell Grails not to re-deploy the application after a new change has been introduced. You can do that by adding to VM parameters of your application start script.

By default, controllers and service classes are initialized dynamically by Grails, but with the option above enabled it lets you to skip the re-deploy phase. Re-deploy of the application is required once you change Java classes, which may be included in your Grails application - this will be solved using JRebel as you will see below. Let's see a small example for that.

1) Create a new controller, called ActionController (grails create-controller action), which will delegate its calls to a service, HelloService (grails create-service hello), which will just return a string:


class ActionController {
   def helloService

  def helloAction = {


class HelloService {
  def String serviceMethod(String name) {
    return "hello ${name}!"

HelloService is injected to the ActionController by convention. Run the Grails app with grails run-app or from IDE as shown above. ActionController.helloAction is the entry point for our application: 

It tells now "hello Anton!"

Let's add another service to the application. Say, it will be GoodbyeService (grails create-service goodbye):


class GoodbyeService {
  def String serviceMethod(String name) {
    return "bye ${name}!"

... and change the ActionController accordingly:


class ActionController {
  def helloService
  def goodbyeService

  def helloAction = {

  def goodbyeAction = {

So without any restart/redeploy phase, http://localhost:8080/jr-grails/action/goodbyeAction?name=Anton tells me "bye Anton!"

Perfect! I'm productive! :)

Now try another example, including some Java sources from within the application. For instance, we have a DummyController which delegates the calls to Util class instead of a Grails service.


class DummyController {
  def index = {

public class Util {
  public static String value(){
    return "hello";

http://localhost:8080/jr-grails/dummy now gives "hello" in response.

The problem is that if you make some changes in the Util class and recompile it, the change will not be visible in the application. To see the changes, you would need to redeploy the application which may require some time once you have a more sophisticated application.

JRebel to the rescue!

JRebel will help you with the issue above. Once you download and install the software, it is possible to start the application from your favorite IDE (via dedicated plug-in) or by adding special parameters to the application start script: -javaagent:"jrebel.jar"

Now if you run the example (see above), and after it is started, try making some changes to the Util class (for instance, change "hello" to "goodbye"). Hit F5 and the corresponding change will be visible now. The console will also display a message - JRebel: Reloading class 'jr.util.Util' - meaning that JRebel has noticed that the class has been altered and you want to use it in your application.

Unfortunately this trick doesn't work for all cases in Grails. For instance, for CRUD functionality in Grails application, if a change is made on a domain class, JRebel will reload the classes, but the change is not propagated further to the view because of some magic that Grails does behind the scenes.  The good news is that JRebel support for Grails is still in progress. Stay tuned! :)

Friday, June 4, 2010

JAZOON 2010, Day 3

The 3rd day at JAZOON 2010 had plenty of good talks in the schedule. The day started with a keynote "The Gaia satellite and Data Processing" by William O'Mullane from ESAC.

The main topic of the keynote was about the issues related to the establishment of a satellite carrying a giant telescope, Gaia. He also mentioned that ESAC uses Java for data processing almost exclusively since 2000. Only some scientific numerical calculations are still implemented in Fortran.

From the standpoint of performance, they find the fact that Java is faster than C for an equivalent code, thanks to JIT on an Intel processor. (see the slide photo below) This claim was even noted at DZone.

The limitations of Java that William noted were:

* "Java is not the tracer bullet"
* too little math libraries maintained (the best being ApacheCommon Math)
* poor IEEE standards compliance

The next talk I attended was about Abacus Formula Compiler by Peter Arrenbrecht. The Abacus Formula Compiler is a Java library that enables you to build a spreadsheet functionality into you Java application. It works best if the spreadsheet contains the values and formulas only. Unfortunately it cannot deal with VBA macros. But still, it provides quite a natural way to embed integrate Java with the spreadsheets.

After that I've listened a presentation about portal evolution in Credit Suisse. A brand new version of the bank's intranet portal was introduced, which they call Intranet 2.0. The idea was that Credit Suisse has many different applications internally and they wanted to put the into one place, so that the customer relationship managers should not log into several applications to serve one client, and also have the personalized views for different type of employees. They used WSRP portlets to integrate the external applications and implemented ~25 portlets for the additional functionality.

To serve the clients they have deployed the portal onto a 16-node-large cluster co-located in 2 data centers. Whatta waste! Banks just don't get it - portal is a wrong way to go! But ok, they have plenty of money for that, so who cares. And architecture compliance is aways so important to such types of companies.

The funniest thing was that the presenter was using a bank's laptop to present the content and it was permanently trying to re-establish the VPN connection :) These bank's security things are just killing me - there should be something better than this.

The next talk was a pretty fair comparison of JSF and Tapestry by Igor Drobiazko. He presented plenty of examples for both, JSF and Tapestry 5, noting the new things in both and stating the pros and cons while explaining why something is done the way it is done. Good presentation especially as I know Igor had his first presentation in front of such a large audience.

One nice example he showed was about reloading the changes by Tapestry on the fly without rebooting or redeploying the entire application, just like JRebel does. Tapestry can to the reloading for almost everything that is included as a source and implemented "the Tapestry way". Unfortunately this mechanism cannot be used as a standalone library for other applications.

if you want to be productive, purchace JRebel or switch to Tapestry

DSL construction with xText was quite interesting, and the slides are already uploaded to Slideshare. xText is used to construct external DSLs as opposed to the approach that Neal Ford presented on the very first day. Previously I was really skeptical about the model-driven approach that xText is promoting, the presentation showed that it is still quite reasonable, especially as xText is heavily relying to ANTLR for grammar construction.

Spring Roo presentation by Eberhard Wolf was a live coding show. Very pleasant! He showed how to get started with Spring Roo, what the tool generates and how it can be altered. Roo (and also many other frameworks) has taken the approach advocated by rails actually - it provides the means for generating the code quickly with assisting the developer while creating the application. The difference is that Spring Roo doesn't enforce any additional runtime dependencies to the resulting application, and also it relies heavily on AspectJ aspects to alter the behavior of Java classes.

The last presentation I attended was about JSF portlet bridge, the brand new standard to integrate JSR168 and JSR286 with JSF1.2. I'm still not convinced that these standards are the right way to go. The portlet/portals approach looks like a very much vendor-driven and doesn't advocate lightweight development model. I know I'm becoming an anti-evangelist of portals but I jsut cannot see any benefit from this technology... unless until someone convinces me that there's no viable alternative.

So now JAZOON 2010 is over. Very good content, well-prepared presenters, lots of networking, very delicious food, awesome location (yes I like Zurich very much). I should have tried to submit a talk to the conference, probably will do that sooner or later.

Thursday, June 3, 2010

JAZOON 2010, Day 2

JAZOON 2010 started with the keynote "Total Cost of Ownership and Return on Investment" by Ken Schwaber, co-developer of the scrum process.

The overview of the keynote speech is available at JAZOON website.

For me the day started with Václav Pech's presentation about concurrency - Unleash Your Processor(s). Tremendous! It was so interesting!

Multithreaded programs today work mostly by accident!

Václav talked about jsr166y, asynchronous background tasks, parallel collections, fork/join strategy, friendly deadlocks and many more. He also mentioned a number of libraries that can help implement actors in Java (Jetlang, for instance). He also explained how do the persistent data structures work and why they are trees in nature. Also, Václav is a big contributor to gpars project for groovy, but he didn't talk about it much as there was a dedicated talk to this topic.

The next presentation I attended was about HTML5 WebSockets, which was also very interesting. I think websockets is the thing we were really missing for many cases and therefor had to build some nasty workarounds to make the things work. Peter Lubbers from Kaazing showed some interesting examples how the new technology compares to Comet, and he also used wireshark to make the evidence. Nice presentation overall.

GPars was next on the list of me. Dierk König from Canoo was giving a talk about parallel programming concepts for the JVM in Groovy. Actually it wasn't a presentation but rather one big demo. Unfortunately, Dierk has to give the demo in groovyconsole as the best IDE in the world crashed (probably because of some 3rd-party plug-in?).

After the references from Václav and Dierk groovy was actually blasted by Nikita Ivanov who was giving a talk cloud computing with Scala and GridGain. I absolutely agree with Nikita about the poor performance of current Groovy, but I'd definitely disagree with the claim that Scala is more concise compared to Groovy. Groovy is extendable the same was as Scala and you can hook into AST of Groovy to alter the syntax if you absolutely need it. Nikita was talking so much and so fast I started to worry about the demo he promised, but he managed to build the example live without any copy-pasteing. Unfortunately there were no time left for more advanced things.

Nikita also introduced Scalar which is an internal DSL for Scala to be used for GridGain. What is nice about it is that with one line of code once could describe the expected behavior of GridGain cluster, instead of writing 10 times more Scala code.

...... to be continued ........

Tuesday, June 1, 2010

JAZOON 2010, Day 1

So here I am at JAZOON2010 conference. The venue is perfect and the content of the conference is quite good to say the least.

The first day has started with a keynote by Danny Cowards, called "Java SE and JavaFX: The Road Ahead". The first question Danny was asked was about the new life in Oracle after Sun's acquisition. I was really disappointed by the politically correct answer...

He also showed an interesting video with James Gosling about the star7 experimental device - this is where Java roots are.

Frankly, I was still so tired because of the flight, so after the 3rd slide I got asleep and I woke up just in time when the talk was finished. Too bad as I suppose that the talk should have been quite interesting, at least the first slides were.

The other talks I have attended were "Pattern Driven Security Design for Web Tier" and "Web Frameworks and how they kill traditional security scanning" (quite a security-oriented day). I wouldn't say that I learned really something new from there, but I definitely have more structured knowledge in my head now, especially what concerns the terminology and pattern names. Also, quite an interesting approach to security scanning was presented, which is advocated by Armorize.

Objects of Value by Kevlin Henney was quite inspiring but too philosophical too me. The only practical value I got from the talk is the 2 books titles:

Problem Frames: Analysing & Structuring Software Development Problems
Pattern-Oriented Software Architecture

The next talk was from Neal Ford about Construction Techniques for Domain Specific Languages. This is a talk that I have seen on various videos, but haven't seen it live yet. Compared to the older versions of the talk, it was almost the same, but just with some improvements - Neal added a couple of slides with referring to some OSS frameworks that do DSL stuff, like easyb. But the general idea is still the same, the examples are the same, and techniques for DSL construction are the same.

The talk about classloaders from Jevgeni Kabanov from ZeroTurnaround was very interesting. Jevgeni presented several examples from the errors that may appear within container, either ClassNotFoundException, NoSuchMethodFoundError or ClassCastException.

The examples started with the very basics and finished with more weird errors which cause memory leaks, especially on application redeployment. Also you may find some interesting articles at ZeroTurnaround's blog about classloaders:

The closing keynote of the day was by Kelvin Henney - 97 Things Every Programmer Should Know. The problem with that, is that I read the book beforehand :) So I decided to spend some time for networking instead.


+ perfect venue
+ very comfortable chairs at the audiences
+ very good organization
+ yummy food
+ good content so far
+ laptop plugs available

- weak wi-fi
- not that many companies are presented this year (compared to 2008), and Google is missing

looking forward for Day 2!

Thursday, April 22, 2010

Running OpenPortal on Jetty

While running OpenPortal's portlet container on Jetty I've encountered the following error on a portlet deployment attempt:

java.lang.IllegalArgumentException: contextHandlerCollection should have been initialized in Jetty config
at com.sun.portal.portletcontainer.admin.deployment.JettyWebAppDeployer.deploy(
at com.sun.portal.portletcontainer.admin.mbeans.PortletAdmin.deploy(
at com.sun.portal.portletcontainer.driver.admin.PortletAdminDataImpl.deploy(
at com.sun.portal.portletcontainer.driver.admin.UploadServlet.deployPortlet(
at com.sun.portal.portletcontainer.driver.admin.UploadServlet.uploadFile(
at com.sun.portal.portletcontainer.driver.admin.UploadServlet.doPost(

To fix this, I've added the following lines to my jetty.xml:
    <!-- assuming that Handlers are configured by default -->
    <Arg><Ref id="Handlers"/></Arg>

Friday, April 16, 2010

uCertify promotional codes

I have done reviews for uCertify PrepKits previously:

1) uCertify's PrepKit for SCJP6.0
2) uCertify's PrepKit for SCBCD5.0

Now, uCertify is giving out 20% discount on all its PrepKits. Use promotional code SPRING during the checkout to avail this offer. This offer is valid until 20 April, 2010 and it will work on all uCertify PrepKits. Full details of the sale can be found here.

Overall, it is a good investment if you're preparing for a professional certification. Good luck!

Saturday, February 20, 2010

Agile Saturday #1 in Tallinn

Agile Estonia has held its 1st event, called Agile Saturday. Here's the speech by Vasco Duarte (Agile Finland), the agile coach at Nokia:

Agile Saturday #1 Keynote by Vasco Duarte from Anton Arhipov on Vimeo.

See the other videos from the event at

Sunday, January 17, 2010

Continuing the BigDecimal's Game: Scala vs Clojure

After studying the issues with decimal types in Groovy and JRuby, with lafy, we discovered some funny things in Scala and Clojure as well.

Consider, if you need to accumulate 0.1 until the result is one. Groovy does it as expected

0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 = 1.0

Just because 0.1 is BigDecimal in Groovy.

In Clojure, the example is not that nice:

(+ 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1) results in 0.9999999999999999.

Basically, the problem is solved when you add the M qualifier to each of the numbers in the expression, like 

(+ 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M) = 1.0

Or use rational numbers:

(+ 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10) = 1.0

The hypothetical problem is that, if a number (say, some money amount) is stored in the database, and the calculation is configured by the user in business rules via some DSL, then a user could create a calculation that   could lead to a loss of precision. For instance:

(* 100M 1.1) = 110.00000000000001
(class (* 100M 1.1)) = java.lang.Double

Double there is!!!

The same kind calculation gives BigDecimal as a result in Scala:

scala.BigDecimal(1.5) * 1.5
BigDecimal = 2.25

The question is what is the rationale behind such behavior and which result is correct? To me, when writing an application which operates with monetary amounts, it is the Scala which is correct.

Disqus for Code Impossible