Sam Newman's site, a Consultant at ThoughtWorks

Finally, after much cursing, shouting, drinking and general annoyance, I have managed to deploy a sample “Hibernate”: application. I must point out here that the problems I had have nothing to do with Hibernate – the documentation is excellent, although their sample application could be packaged a little better (you know, to actually produce a WAR file). The problem I had was with “Tomcat”:

Up to this point I have been using “Jetty”:, because it just WORKS. It doesn’t have fancy web-based admin consoles or more config files than you cna shake a stick at, you just put your WAR file in its webapps directory, and restart. At which point it deploys your webapp. Tomcat however doesn’t do that – oh no. Sometimes it ignores your WAR file. Othertimes it unpacks it, but if it does it won’t update this unpacked directory structure if the WAR file changes even if you restart Tomcat. So now my build process has to delete directory structures under Tomcat (I’m sorry, but I am not going to start dealing with unpacked WAR structures – that way madness lies). Oh, and guess what? When Tomcat has an error with a web.xml, it doesn’t tell you which webapp it found the file in! Isn’t that cool! “Now if Jetty was so good, why are you using Tomcat?” you may ask Well, this may be lazyness on my part but the example application had the tomcat config settings and I didn’t feel like working out the equivelent Jetty settings (why can’t these things be standardised?).

Up to then things had gone well – I got “MySQL”: installed and running as a service quite quickly. After finally getting the Hibernate example working I had a quick look at getting Hibernate and JBoss working together, but hit the problem that I couldn’t find any documentation explaining how to get “JBoss”: working with MySQL – that excersie can wait for another day. Anyway, expect a brief writeup on Hibernate tomorrow – I must say that from what I’ve seen already it looks excellent.


3 Responses to “Hibernate”

  1. Gregg

    Hmm, interesting. I have never had any problems like what you are experiencing with Tomcat. And I don’t ever mess with any special configuration files. I drop my WAR into the webapps folder, it deploys, and I am done. Plain and Simple.

    In regards to Hibernate, I will be interested in reading your article you write tomorrow. I believe it is really nice also, and I have been struggling trying to get it to integrate with STRUTS.

  2. Sam Newman

    Well, now that I have at least a WAR running with Hibernate, getting struts integrated should be too much of an issue (famous last words!). As for problems with tomcat (I’m using 4.1.24 by the way) the documentation ( states that “Copy the web application archive file into directory $CATALINA_HOME/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way. This approach would typically be used to install an additional application, provided by a third party vendor or by your internal development staff, into an existing Tomcat installation. NOTE – If you use this approach, and wish to update your application later, you must both replace the web application archive file AND delete the expanded directory that Tomcat created, and then restart Tomcat, in order to reflect your changes.”

    The problems I had hinged around the fact that I assumed that Tomcat would handle updating of this structure for me – it certainly used to.

  3. munas

    Dear Sam Newman!..

    i am totally new to Hibernate. i was in a full search to get a sample Hibernate application. i think i can buidup myself in Hibernate using some samples. i get to know abt this article. its interesting..and useful which will satisf my need..but i couldnt point that war file u r talking about. So plese can u send me that .war file or atleast some sample. my email id is abd_lu_munas at hot mail .com..expecting ur samples….


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: