Unstable Terrain

Software development in the real world

Archive for the ‘Tools’ Category

Document base /path/to/exploded/war/ does not exist or is not a readable directory

leave a comment »

I discovered the easy technique where one can point Tomcat at a directory instead of copying stuff into the /webapps dir.

So, I created $CATALINA_HOME/conf/Catalina/localhost/ma.xml like so:

<Context path="/ma" docBase="/workspace/ma/target/ma" reloadable="true" />

After a few false starts (turns out that Tomcat on Windows doesn’t accept cygwin-style paths even when started from sygwin), I thought I had it sorted.

<Context path="/ma" docBase="d:\workspace\ma\target\ma" reloadable="true" />

but Tomcat was having none of it.

16/06/2011 5:04:23 PM org.apache.catalina.core.StandardContext resourcesStart
 SEVERE: Error starting static Resources
 java.lang.IllegalArgumentException: Document base D:\workspace\ma\target\ma does not exist or is not a readable directory

Turns out I was being stupid and forgot the trailing slash in the docBase.


Written by Trent

June 16, 2011 at 6:04 pm

Posted in Software Development, Tools

Tagged with

Back online

leave a comment »

My PC died on the weekend (CPU fried after heat sink detached) so I used the opportunity to buy a Macbook Pro.

It’s exceptionally nice with a great keyboard, but the trackpad scrolls in entirely the wrong direction compared to smart phones.

Turns out Apple will fix this in OSX Lion but until then, you can download a handy app that will unwrongify your scrolling.

Written by Trent

June 7, 2011 at 9:24 pm

Posted in Tools

Tagged with ,

Testing JUnit 4 Exception Messages

leave a comment »

In previous years, I have tested exceptions in JUnit tests using variations on the

try {
} catch (Exception expected) {
  assertEquals("Invalid Number of Foos", expected.getMessage());

pattern. Various upgrades such as codifying it into an AssertThrows class and checking the correct exception type have helped but it was a pretty ordinary solution.

Changing to JUnit 4 allowed for the annotation below:


… but testing the exception message remained ugly.

JUnit 4.7 has a neat upgrade: testing that thrown exceptions have particular messages.

For example:

public class BuilderTest {
  public ExpectedException thrown = ExpectedException.none();

  public void invalidMessagesShouldThrowAutoPopulateException() {
    thrown.expectMessage("too many autopopulate errors");


It also accepts a Hamcrest-style matcher if you want to do something more complicated.

Written by Trent

February 18, 2011 at 4:19 pm

Posted in Software Development, Tools

Tagged with , ,

Eclipse Helios Autocomplete Slowness

leave a comment »

Recently, autocomplete in Eclipse has been irritatingly slow. Turns out that the annotation-based proposals are the culprit.

Solution? Disable them in Window -> Preferences.

Written by Trent

October 28, 2010 at 3:41 pm

Posted in Software Development, Tools

Tagged with ,

Ant Junit task Addendum: forkmode

leave a comment »

I mentioned previously about using the ant junit task with fork=false.

However, some tools such as EMMA insert shutdown hooks, so require forking. In addition, classloader issues may require you to fork to save your own sanity.

Turns out there’s a more robust solution.

<junit  haltonfailure="yes"
    <classpath refid="test.class.path.with.test.classes" />
    <formatter type="xml" />
    <batchtest toDir="${test.reports}">
        <fileset dir="${test.classes.dir}">
            <include name="**/*Test*.class" />

A new JVM will be forked, but all tests will be run inside that single forked JVM, increasing the speed of your tests substantially. If you have some tests that have side-effects, you can put them into a separate batch and change the forkmode to ‘perBatch‘, effectively isolating them while retaining the speed of the rest of your tests.

So, try it and see how much faster your build goes.

Written by Trent

July 26, 2010 at 6:44 pm

Eclipse Helios Released

leave a comment »

Eclipse 3.6 (Helios) has been released!

Without, it appears, a coherent set of release notes. If you like, you can read the list I cobbled together myself.

Update: I found a nice list of the top ten best features of Eclipse Helios.

Written by Trent

June 24, 2010 at 12:14 pm

Posted in Software Development, Tools

Tagged with , , ,

Eclipse Helios Milestone Release Notes

with one comment

Eclipse is my Java IDE of vaguely-choice, but keeping track of the milestones of its latest release is a pain; missing or broken links, invisibility on Google — the whole shebang.

So, here’s the result of my searching. I present to you, working Eclipse Helios milestone release notes.

… after which there are release candidates before the General Availability release, available here.

Written by Trent

June 16, 2010 at 11:51 am

Posted in Software Development, Tools

Tagged with , , ,