Nice Error Messages in Spring

Working through Chapter 2 of Spring: A Developer’s Notebook tonight, and I’m pleasantly surprised by Spring’s error messages. This is the first one I got after deploying one of the examples:

1
2
3
4
5
6
7
org.springframework.beans
.factory.BeanDefinitionStoreException:
Error registering bean with name 'viewResolver' defined in ServletContext resource
[/WEB-INF/rentABikeApp-servlet.xml]: Bean class [org.springframework.web.servlet
.view.InternalResourceViewResolvers] not found;
nested exception is java.lang.ClassNotFoundException: org.springframework.web
.servlet.view.InternalResourceViewResolvers

This points me to the file and the exact reference that is causing the problem just by reading the error message. I suppose a line number would be the only thing missing. Turns out I had an extra ‘s’ at the end of InternalResourceViewResolver. A quick fix and the next error message:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
org.springframework.beans.
factory.BeanCreationException:
Error creating bean with name
'editBikeForm' defined in ServletContext resource
[/WEB-INF/rentABikeApp-servlet.xml]:
Error setting property values;
nested exception is org.springframework.beans
.PropertyAccessExceptionsException:
PropertyAccessExceptionsException (1 errors);
 nested propertyAccessExceptions are: [org.springframework.beans
.TypeMismatchException:
Failed to convert property value
 of type [java.lang.String] to
required type [java.lang.Class] for property
 'commandClass';
nested exception is
java.lang.IllegalArgumentException:
Invalid class name: com.springBook.Bike]

This one is pretty obvious as well, whoops com.springbook not com.springBook. It’s nice that it points you to the errors right away. I’ve seen so many java open source packages that don’t point you at the real error relying too often on a simple stack trace.

J2EE Architects and Pet Peeves

‘J2EE Architect’ is a loaded word, and I should know I’m a Sun Certified Enterprise Architect (SCEA). I meet up with a lot of architects through the hiring process and reviewing consultant RFPs and quite a few of them scare me. When asked about implementation details I get responses like:

I’ve only worked at companies with really high end J2EE developers who could implement my design, so they didn’t really need mentoring.

SOA is really a paradigm shift for developers and takes some getting used to.

I develop really complete object models with UML class and sequence diagrams that map out exactly what is to be done and I use common J2EE patterns.

Look at my enterprise diagram here it really explains how to lay out your SOA architecture with our reference ESB implementation.

For the view layer I find XML and XSLT are very effective because you can separate the content from the presentation.

I like Michael Feathers rule that any code without tests is legacy code. My rule for architects is any architect who can’t/won’t code their solution is a legacy developer.

Searching for Java Development Podcasts

If anything I’ve gotten fairly addicted to RSS and more importantly podcasts in the last 6 months since a group of friends got me a 4th generation iPod while I was spending December in the Stem Cell Transplant unit of a local hospital. I now probably listen to 2 hours or so a day of audio, 1 hour on my morning walk and 1 hour of during the roundtrip commute.

One thing I’ve been searching for are decent development podcasts. I’ve found a fair amount at a site called IT Conversations, but only really run across one site by Tim Shadel that actually has java development podcasts. It would appear he’s run out of time or energy to continue them, but the 10 or so that are there are pretty good. My guess would be by this time next year there will be too many to listen to but for now the selection is really limited.

The Tipping Point for Adopting Open Source Java Frameworks

Last I remember there were some 80,000+ open source projects. There’s a whole host of different solutions out there that solve the same problems. The MVC framework space is overflowing with Struts, Webworks, Velocity, JSF, and a host of others. The ORM frameworks include iBatis, Hibernate, JDO, and a bunch of others.

There’s a few rules of thumb I tend to use for whether it’s worth adopting something:

  • It keeps turning up on popular java sites like The ServerSide (TSS).
  • Multiple books have been written on it. One book is never enough, because there’s plenty of one off books on ideas that never really took off. SQLJ comes to mind off the top of my head.
  • It solves a specific limited problem domain and relies on things like simple POJOs for its implementation.

At this point the framework is probably worth a look. Right now I’m looking into the Spring framework as a good way to make our applications more testable. After I get through O’Reilly’s Spring: A Developer’s Notebook I’ll have a better idea whether it’s worth adopting.

JBoss 4 and Autodeploy

So far after using JBoss 4.0 for 6 months or so we’ve seen pretty good hot deploy response. Under 3 it was flakey and so you usually just restarted the server. Today we ran into a weird problem with a war file where a fix that had been added wasn’t getting picked up. After a couple of tries at redeploying it became time to resort to the usual tricks.

  • Drop into the server/default/tmp and server/default/work directories and delete everything related to that war.
  • Reboot the server itself
  • Redeploy the war with a new name

So far none of these have worked so Monday we’ll have to get really creative. I just love finishing a week with an unsolved configuration issue. Really starts off the weekend on the right foot.