hmmmm....
What happens if you execute this code from a standalone program (outside of
tomcat). That way you eliminate one possible complication. If the problem still exists outside Tomcat, then you know it's gotta be something else. Of course, if it works just fine and dandy when you execute it from the command line, then you know its gotta be something in your Tomcat environment.
Try eliminating sources of possible complication and see where it leads you.
- Jess