We spent too long hunting down a bug in a database method call that consistently returned “null” in our integration environment, but returned the correct value in a development unit test.
Do you see the problem here? Compare these two screenshots. Both screenshots show a look into two different jars on our classpath. The title of this article is a big hint.
Two points goes to the first person to explain the problem. (-2 points for any of my teammates that answer first!)
The moral of the story is that namespaces are one heck of a good idea and that we should always be very careful when relying on classpath-based resources. I’ll write more about the problem after giving others a chance to solve the puzzle.
I'm Mark Turansky, I'm the founder of
#1 by Matt Passell on February 16, 2008 - 11:57 pm
Quote
Let me guess… since each of the JARs has a hibernate.cfg.xml at the top level, it was picking up the first one in the classpath it found. Yup, namespaces can be handy for avoiding such conflicts.
#2 by Mark Turansky on February 17, 2008 - 1:09 am
Quote
Exactly right. Two projects by two different teams and there’s my team attempting an integration effort. It took a lot of digging to figure this out, but now we know. I’ll put a notch in the “experience” part of my brain.