The Holy Java

Building the right thing, building it right, fast

Archive for June, 2010

Implementing build-time bytecode instrumentation with Javassist

Posted by Jakub Holý on June 25, 2010

If you need to modify the code in class files at the (post-)build time without adding any third-party dependencies, for example to inject cross-cutting concerns such as logging, and you don’t wan’t to deal with the low-level byte code details, Javassist is the right tool for you. I’ve already blogged about “Injecting better logging into a binary .class using Javassist” and today I shall elaborate on the instrumentation capabilities of Javassist and its integration into the build process using a custom Ant task.

Read the rest of this entry »


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

Booting from a USB stick in VMware Player

Posted by Jakub Holý on June 10, 2010

It isn’t possible to boot from a USB stick under VMware player 3.0.0, because its BIOS is ignorant of USB, but fortunately there is an easy workaround:

  1. Download the PLoP boot manager (e.g., which supports usb booting
  2. Decide whether you want to install PLoP to the virtual hard disk (useful if you will boot from the USB stick more often) or not
    1. Using PLoP without installing it to the virtual disk:
      1. Extract the ISO image plpbt-5.0.10/plpbt.iso from the archive
      2. Attach the extraced ISO image to you VMware virtual machine as a CD/DVD
      3. Boot the vmware machine from this virtual CD. (VMware should automatically try it as a boot device, if not, press Esc at the virtual machine start to enter the boot device selection menu).
      4. PLoP will be started, ses below.
    2. Installing PLoP to the virtual disk (you may want to check the PLoP installation guide):
      1. Extract the ISO image plpbt-5.0.10/install/plpbtin.iso from the archive
      2. Attach the extraced ISO image to you VMware virtual machine as a CD/DVD
      3. Boot the vmware machine from this virtual CD. (VMware should automatically try it as a boot device, if not, press Esc at the virtual machine start to enter the boot device selection menu).
      4. PLoP installation menu will show up, press 1 to select the option “Full boot manager install” and answer “y” to the question whether you want to proceed
      5. When the installation finishes, power off the virtual machine
      6. Remove the CD/DVD device from the virtual machine, we won’t need it anymore
      7. Start the virtual machine, which will boot PLoP from the virtual hard disk.
  3. Once PLoP is started, it will give you a selection of devices to boot from including your USB stick. (Make sure that the USB stick is connected to the virtual machine, if not, connect it and restart the machine via the menu VM – Power – Reset).

PS: You can do the same for VirtualBox, which also doesn’t support booting from USB.

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

Webservice testing with JMeter: Passing data from a response to another request

Posted by Jakub Holý on June 4, 2010

JMeter is great for functional and performance testing of many things, including web services (and to my surprise also LDAP). It also provides means for extracting data from a response and passing them to a subsequent request, which is exactly what I needed. There is already a good tutorial on testing a WS with JMeter, so I won’t repeat the basic setup here. The steps are:

  1. Create a webservice (WS) test plan, as described in the tutorial (in my case it contains two WS calls)
  2. Add the User Defined Variables config element to the test plan and define there a variable for transferring the response data
  3. Add an XPath Extractor Post Processor to the first WS call to extract the value of interest into the user defined variable (beware namespaces!)
  4. Add a BeanShell Pre Processor to the second call, which will replace a placeholder in the WS call’s XML data with the value of that variable

Read the rest of this entry »

Posted in Languages, Testing | Tagged: , , , | 10 Comments »

Most interesting links of May

Posted by Jakub Holý on June 2, 2010

The most interesting stuff I’ve read in May, in no particular order. You can easily guess I’ve been working on performance troubleshooting this month 🙂

  • NoSQL is About… – all the things NoSql databases are said to be about (and perhaps are not) and a good overview of the different goals and thus also features of the various implementations
  • Bulletproof of Mind Mapping: Overview, Benefits, Tips and Tools – the article not only introduces mind maps (a structured way of recording ideas, much less limited than lists) but also describes over 30 desktop and web-based MM tools, both free and commercial (some of the descriptions come from the SW’s web, some from the author – the distinction isn’t clear)
  • Java vs. C Performance….Again. (9/2009) – When C(++) is better than Java, when Java is more appropriate, and common flaws in comparions methodologies/false arguments.
  • Why Learning Git is really, really hard part 1 and part 2 with actual reasons – because it doesn’t care enough for usability (unusual commands, cryptic error messages, impossibly to go to a “simpler use mode”). I’m intrigued by distributed SCM systems and tired of not-so-easy branching & merging in SVN and its lovely problems with corrupted metadata (when you delete a folder…) and thus I was considering switching to Git that everybody is so excited about. I still plan that but these articles warned me that it may be not so painless and easy. A good read.
  • Java VisualVM Blogging Contest results – the best posts –
    • VisualVM – tool for profiling Java applications – nice, short intro with many pictures
    • Analyzing Memory Leak in Java Applications using VisualVM
    • (and others … )
  • How to compute running mean/standard deviation –  this page explains and in C implements an algorithm for computing a running estimate of mean and standard deviation, which minimizes accumulation of precision errors. A running estimation has the advantage that you do not need to store all the numbers and is thus suitable e.g. for continuous performance monitoring with a low memory overhead (buth the performance overhead of a division and multiplication it introduces is perhaps also something to consider – though for most application it’s negligible)
  • (Java) Web performance in seven steps – a great article about the “management of performance” of a Web/JEE application from the definition of performance requirements up to continual performance monitoring with interesting war stories and links to various useful tools. I can sign the author’s maxim “measure, don’t guess!”. The Java monitoring API Java Simon mentioned in the article is worth a look.

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