Static state and Maven build.

Recently I had to deal with a weird and occasional Maven build fails from different plugins failing with this same exception:

Caused by: java.lang.NullPointerException at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy( at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute( at org.apache.http.impl.client.InternalHttpClient.determineRoute(

Since it was only failing on my local box and subsequent build would run fine I kept on ignoring it until it started […]

Extensible Java Enum.

As you know you can’t extend Enum in Java in order to add a new enumeration value since they are final. But what about the case that you want to use that enum in your code but at the same time allow additional values to be represented by that enum type. For example lets take […]

Fix those pesky eclipse build errors.

Have you had Eclipse keep on showing mysterious build errors on projects (or even on files) that just wont go away no matter how many time you build and refresh the project(s)? If you have situation like that and are sure that there should not be any errors. Try the following to force-clear the errors:


Hadoop, trying it.

Full Project:

There has been a lot of talk about Hadoop lately but with very little explanation of what it actually is. Unfortunately some of tutorial have not been simple enough to give me a big picture of what this technology is all about. After some reading comprehensive tutorial on Yahoo and trying […]

EasyMock gets more power with PowerMock.

There are a lot of mocking libraries for Java, out of which EasyMock is my favorite. It has been serving well for me until I had to unit test legacy code which did not completely adhere to IOC (inversion of control) principles and had a lot of static method calls and direct creation of service/helper […]

JSP myths.

Since JPS’s came out as part of J2EE there have been lots of talks of how they were so ASP like and were badly designed. But since there was not any alternative that time the Java community had to embrace it and used it. In the end JSP made into most J2EE based web applications. […]

Maven2 eclipse plugin and custom or pom packages.

Update: This approach will also work with “ear” projects and only requires adding plugin definition without changes to eclipse maven plugin.

Recently I had to create maven project which was producing war file and then packaging it into tar before deploying to maven repository without deploying the war itself. This forced me to declare my […]

Issues with depepency injection in latest frameworks.

Here I am going to show some of important limitations to Java and Guice approached to dependency injections, particularly where wiring logic should go.

Java Dependency Injection

public interface LogService { public void log(String result); }

@Named(“FileLogService”) public class FileLogService implements LogService{ public void log(String result){} }

@Named(“ConsoleLogService”) public class ConsoleLogService implements LogService{ public […]

Spring WS client.

In my previous post I described how to create sample Spring Web Service. In this article I am going to show how to write generic Web Services client for it (or for any other Web Services).

The idea here is to define java interface that will mirror WS request/response messages and have a Spring proxy […]

Spring WS+JAXB

Download projects

Here is sample Spring WS application that shows how to expose your bean method as WS service and handle XML marshaling using JAXB.

There are 4 major parts involved here.