The Holy Java

Building the right thing, building it right, fast

Archive for May, 2010

Migrating from JRoller to WordPress

Posted by Jakub Holý on May 22, 2010

This post describes how to migrate a blog from to The steps are:

  1. Backup JRoller via the util by La tortue cynique
  2. Export from WP
  3. Convert JRoller to a fragment of the WP format
  4. Add proper header and footer to the generated WP import file
  5. [optional] download images, perhaps upload them somewhere and modify URLs accordingly
  6. Import it into WP
  7. Check formatting, add tags…

Read the rest of this entry »

Posted in General | Tagged: , , , , , , | 3 Comments »

How Visual Paradigm (nearly) ruined my day and Dropbox (nearly) saved it

Posted by Jakub Holý on May 16, 2010

For months I’m working on designing an architecture for a fictious system, which is required for the second part of the Sun Certified Enterprise Architect (SCEA) exam. Today I came to my computer to make few final but important finishing touches to my UML diagrams. The notebook run out of battery and thus lost its in-memory suspended state – nothing special, it happens. But what an horror! When I started Visual Paradigm (which was running when I suspended the computer), my UML tool, it asked me whether to restore the auto-saved project – which could have been expected, and I agreed – and opened the project – with all texts lost!

Read the rest of this entry »

Posted in Tools | 1 Comment »

Eclipse Profile configuration: The launch requires at least one data collector

Posted by Jakub Holý on May 13, 2010

I just installed TPTP into my Eclipse 3.5 under Ubuntu 9.04 and tried to profile a class. The Profile Configuration opened with a red warning reading “the launch requires at least one data collector to be selected“. Clicking the configuration’s Monitor tab reveals a more detailed error (and nothing to select):

IWATO435E An error occured when connecting to the host.

A quick check of the error log (Window – Show View – Other… – General – Error Log) reveals the cause:

RAServer generated the following output:  [Error Stream]:ACServer: error while loading shared libraries: /home/jholy/development/tools/eclipse-ide/pulse2-2.4.2/Common/plugins/ file too short

Checking the content of the lib/ folder revealed an interesting thing:

-rw-r–r– 1 jholy jholy   17 2010-02-16 23:16
-rw-r–r– 1 jholy jholy   21 2010-02-16 23:16
-rwxr-xr-x 1 jholy jholy 100K 2010-02-16 23:16

As also the content of the two small files suggests (they contain a name of the corresponding file with a longer name), the *.so and *.so.4 files should have been links but the installer failed to create them.


List all files in the lib/ folder, you will see that there are many real files like and and many should-be-links files. The solution is, of course, to replace all those files that shoud be links with actual links.

For me the solution was:

$ cd .../plugins/
# Move out the files that are OK
lib$ mkdir tmp
lib$ mv libswt-* tmp/
# Fix the links
lib$ for FILE in `ls *.so`; do ln -sf "${FILE}.4.5.0" $FILE; ln -sf "${FILE}.4.5.0" "${FILE}.4"; done
# Move the correct files back
lib$ mv tmp/* .
lib$ rmdir tmp
# Fix links for files with *.26 instead of *.4.5.0
lib$ ln -sf
lib$ ln -sf
lib$ ln -sf
lib$ ln -sf
lib$ rm
# Done!

Try to open the profile configuration now, the IWATO435E should have disappeared and you should be able to select a data collector.

If not, restart Eclipse, try again, check the error log.

My environment

  • Ubuntu 9.04
  • Eclipse 3.5
  • TPTP – see above


There is a similar post of the same problem but with different cause: Get Eclipse TPTP to run on Ubuntu Karmic Koala – the cause was: “the Agent Controller was built against old C++ libraries which were no longer available on my system (Ubuntu 9.10 Karmic Koala, amd64)”.

Posted in eclipse | Tagged: , , , , | Comments Off on Eclipse Profile configuration: The launch requires at least one data collector

Book: Real World Java EE Patterns – Rethinking Best Practices (review & digest)

Posted by Jakub Holý on May 8, 2010

I’d like to make you aware of the excellent book Real World Java EE Patterns – Rethinking Best Practices by Adam Bien (blog), a Java Champion and renowned consultant, software architect and Java EE standardization comitee member. I’d absolutely recommend it to any architect or developer serious with Java EE 5 or 6 development, even to those not planning to use EJB 3.x (at least prior to reading the book :)). It’s a must-read complement to the now a little outdated Core J2EE patterns as it updates the patterns for the new bright world of EJB 3/3.1 while discarding some of them and introducing some new, extremely useful patterns and techniques.

The book starts with an overview of the evolution of Java Enterprise Edition and the hard issues it solves for us, continues with the new and updated patterns and strategies and concludes with an introduction of two opposite architectures you can build with Java EE 5/6, namely lean SOA and domain-driven (which itself makes it worth reading).

What I really appreciate in addition to that valuable content is that for each pattern there is a section on testing and documentation and a really good evaluation of consequences in terms of maintainability, performance and other such qualities. You will find there also many code samples and beautiful applications of the Builder and Fluent API patterns.

The main message is that EJB 3.x is so lean and powerful that we must justify why NOT using it – and when using it, you should be very pragmatic and only introduce patterns, layers and principles if they bring real value.

Read the rest of this entry »

Posted in Languages | Tagged: , , , , , | 1 Comment »

Mocking out LDAP/JNDI in unit tests

Posted by Jakub Holý on May 5, 2010

When unit testing a class that queries an LDAP server using Java’s JNDI API I needed to replace the actual remote LDAP server with a mock LDAP access layer so that the unit test (remember, this is not an integration test) doesn’t depend on any external SW/HW. Few hours of googling haven’t yielded any suitable mock implementation and so I had to create my own one. It turned out to be an easy task after all. I hope it could be useful for you too.

To create a test implementation of LDAP/JNDI you need to:

  1. Hook you mock JNDI implementation into the JVM and make sure that you use it
  2. Actually implement the JNDI layer by implementing/mocking few (3) JNDI classes, mostly from the package
  3. Configure your mock implementation to return the data expected

Read the rest of this entry »

Posted in Testing | Tagged: , , , , , , | Comments Off on Mocking out LDAP/JNDI in unit tests

Most interesting links of April

Posted by Jakub Holý on May 4, 2010

The most interesting technical links I’ve encountered in April:

  • Getting Started with Tdd in Java using Eclipse [Screencast] – you will see not only TDD in practices but also a number of best practices applied and some inspirational novelty (at least for me) ideas  such as creating one test class per test configuration (and thus multiple test classes for a single “business” class); I really recommend this even if you are not interested in TDD
  • NoSQL links (as everybody these days, I’m also at least observing the NoSQL movement):
  • Testing
    • Easy data-driven testing with Spock – the Spock framework based on the popular JVM scripting language Groovy (99% Java + 1000% added) introduces a custom domain-specific language (DSL), which makes testing of a method using different data incredily easy and readable, with all the power of Groovy at hand; see the post and you will see immediately what I mean

That’s all for this month, stay tuned.

Bookmark and Share

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Posted in General, Languages, Top links of month | Tagged: , , , , , | Comments Off on Most interesting links of April

My older posts at JRoller

Posted by Jakub Holý on May 1, 2010

My older posts are available on my JRoller blog, I hope I’ll manage to migrate them finish their migration here soon.

Posted in General | Comments Off on My older posts at JRoller