Raise your hand if you hate Jakarta projects

I’m doing some work on a side project within Yahoo!. Among other things, the code needs to be able to make HTTP requests. Using java.net.URL isn’t very tantalizing, mostly because it’s a total pain in the ass (try getting the returned content when an HTTP 400 error code is sent back to you, try building up a query string).

One of the only other Java-based HTTP libraries is available as part of Jakarta: HttpClient. So you download the JAR, dump it into your project, compile and run. BOOM! It blows up in your face:

    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

Okay, you need to have the commons logging package in order to be able to use HttpClient. I really hate the whole idea behind the commons logging package, but I need HttpClient. So I (grudgingly) pull it down and add it to my project libraries. Run my project again. BOOM! It blows up in your face:

    java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException

What the?!? What the hell is commons codec? You have to be kidding me. I have to pull down ANOTHER dependency? I was hoping to keep dependencies to a minimum with this project. Now I have 3 brand new dependencies just because I wanted to make some stupid HTTP requests.

I guess the moral of the story is, if you want to keep dependencies to a minimum you might as well handroll the functionality you want.

As a side note, those 3 new dependencies are 350KB in size. So much for making something lean that could possibly be used on an embedded device.

16 Responses to “Raise your hand if you hate Jakarta projects”

  1. Lars says:

    The commons codec ….. Thats a new one on me

  2. HappyGuy says:

    Well… I found this blog googling for the commons-codec exception… It happens that this dependency is not specified on the jakarta page (the commons-logging is) and only exists for the commons-http-3.0_rc1. It didn’t for the 2.0.2. I hit it when I tried a library upgrade.
    As for the dependency size, the beauty of OSS comes now! You can always get just the classes that you use from commons-http, the classes it depends on from the dependencies and roll your own commons-http-ME (Mobile Edition). You can even cut off unneeded methods! Think about it and don’t let the dependencies limit your work. After all, jakarta has done a lot for Java and we shouldn’t hate it… ;) Be Happy!

  3. Frank Mash says:

    I still keep getting the error even after putting the commons.jar in my file path and explicitly importing it in my code.

    Add me to the list of Jakarta haters.

  4. Rob says:

    Same as you, I don’t like the idea behind commons-logging. I’d rather just use Log4J, but I need HttpClient.

  5. Raphael Neve says:

    Duh, yeah, if you don’t want dependencies, of course you have to hand roll everything. Ever thought of your JVM and OS as being dependencies. Having well structured dependencies is the beginning of building reuseable code. And what’s so hard about pulling down a JAR??

  6. Ryan says:

    Supporting libraries should not dictate other libraries, it’s just rude.

  7. Evil Monkey says:

    I’ve just stumbled upon this too while trying to get other Jakarta project (Slide - WebDAV stuff) to work. Well, I don’t mind dependencies, I agree with Raphael on this. It’s just like Linux packaging system - small packages, doing exactly what they should do, nothing more. Sure, dependency tree is a big monster, but it’s a friendly monster I guess… Anyway, what bugs me is that Jakarta Slide is sooo abandoned… I mean, last update is from 2004 and it depends on httpclient 2.0 (!), so I had to get the latest version from SVN, get a patch from AFS Bugzilla, patch it and build it manually… that’s just crazy. Ehhh, that’s just wrong… Jakarta is OK, but things always can be better :-)

  8. Evil Monkey says:

    Of course whole SVN-patch-build process is for getting it to work with our project’s current code which of course uses httpclient 3.0…

  9. This is too picky - spoiled programmer says:

    The exceptions and jakarta jars worked nicely together, so you got your problem done easily. What are you expecting? Get someone put your pants on for you? Put that jar in the tomcat common lib; it is not a big deal unless you’re doing cell phones.

  10. Ryan says:

    Actually, I *WAS* doing cell phones.

  11. Kris says:

    ffs, just stumbled on the same codec error trying to use httpclient.

    *raising his hand

  12. Juan Liska says:

    Jakarta is starting to remind me of PEAR, which is used way less than it could be thanks to dumb dependencies.

  13. Anonymous says:

    I hate jakarta projects for dependencies that are tied into one large knot.

  14. Ryan says:

    Juan…I’ve been using PHP a lot lately and I’m totally with you on the PEAR/Jakarta similarities. At least PEAR has a package manager that will pull the dependencies for you, though.

  15. wcrighton says:

    Ran across this one trying to get my decoder error resolved - was showing up after clean installing a new application in my orion server. Total PITA finding out it was some commons lib crap that had been hanging around in my lib directory from a previous project. Whoops, yes, but a PITA. I agree it’s rude.

    My hand is up.

  16. chris says:

    wow… I just went through the exact same process and had the exact same thoughts…

Leave a Reply