title: Getting gwt hibernate example code to work with eclipse
body: <p>I am starting out with GWT and hibernate. I'm going through the tutorial at <a href="https://developers.google.com/web-toolkit/articles/using_gwt_with_hibernate" rel="nofollow">https://developers.google.com/web-toolkit/articles/using_gwt_with_hibernate</a>.</p>
  
  <p>I downloaded the sample code provided with the tutorial (http://google-web-toolkit.googlecode.com/files/gwt_hibernate_base.zip). This is a simple music store where you can add an account and records. I am able to run this and successfully add accounts and records to the database by doing the following commands:</p>
  
  <pre><code>(in the data directory) java -cp ../lib/hsqldb.jar org.hsqldb.Server
  
  ant build hosted
  </code></pre>
  
  <p>Here is the build.xml file used to build this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;project name="Guestbook" default="build" basedir="."&gt;
  
    &lt;!-- Define gwt.home, gwt.dev.jar, appengine.sdk.home --&gt;
    &lt;property file="build.properties"/&gt;
  
    &lt;path id="project.class.path"&gt;
      &lt;pathelement location="war/WEB-INF/classes"/&gt;
      &lt;pathelement location="${gwt.home}/gwt-user.jar"/&gt;
      &lt;!-- Add any additional non-server libs (such as JUnit) --&gt;
      &lt;fileset dir="war/WEB-INF/lib"&gt;
        &lt;include name="**/*.jar"/&gt;
      &lt;/fileset&gt;
    &lt;/path&gt;
  
    &lt;target name="libs" description="Copy libs to WEB-INF/lib"&gt;
      &lt;mkdir dir="war/WEB-INF/lib" /&gt;
      &lt;copy todir="war/WEB-INF/lib" file="${gwt.home}/gwt-servlet.jar" /&gt;
      &lt;!-- Add any additional server libs that need to be copied --&gt;
      &lt;copy todir="war/WEB-INF/lib" flatten="true"&gt;
        &lt;fileset dir="lib/"&gt;
          &lt;include name="**/*.jar"/&gt;
        &lt;/fileset&gt;
      &lt;/copy&gt;
    &lt;/target&gt;
  
    &lt;target name="javac" depends="libs" description="Compile java source"&gt;
      &lt;mkdir dir="war/WEB-INF/classes"/&gt;
      &lt;javac srcdir="src" includes="**" encoding="utf-8"
          destdir="war/WEB-INF/classes"
          source="1.5" target="1.5" nowarn="true"
          debug="true" debuglevel="lines,vars,source"&gt;
        &lt;classpath refid="project.class.path"/&gt;
      &lt;/javac&gt;
    &lt;/target&gt;
  
    &lt;!-- can add additional arguments like -logLevel INFO or -style PRETTY --&gt;
    &lt;target name="gwtc" depends="javac" description="GWT compile to JavaScript"&gt;
      &lt;java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"&gt;
        &lt;classpath&gt;
          &lt;pathelement location="src"/&gt;
          &lt;path refid="project.class.path"/&gt;
          &lt;pathelement location="${gwt.home}/${gwt.dev.jar}"/&gt;
        &lt;/classpath&gt;
        &lt;!-- add jvmarg -Xss16M or similar if you see a StackOverflowError --&gt;
        &lt;jvmarg value="-Xmx256M"/&gt;
        &lt;arg value="com.google.musicstore.MusicStore"/&gt;
      &lt;/java&gt;
    &lt;/target&gt;
  
    &lt;target name="hosted" depends="javac" description="Run hosted mode"&gt;
      &lt;java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode"&gt;
        &lt;classpath&gt;
          &lt;pathelement location="src"/&gt;
          &lt;path refid="project.class.path"/&gt;
          &lt;pathelement location="${gwt.home}/${gwt.dev.jar}"/&gt;
        &lt;/classpath&gt;
        &lt;jvmarg value="-Xmx256M"/&gt;
        &lt;arg value="-startupUrl"/&gt;
        &lt;arg value="MusicStore.html"/&gt;
        &lt;arg value="com.google.musicstore.MusicStore"/&gt;
        &lt;!-- Additional arguments like -style PRETTY or -logLevel DEBUG --&gt;
      &lt;/java&gt;
    &lt;/target&gt;
  
    &lt;target name="build" depends="gwtc" description="Build this project" /&gt;
  
    &lt;target name="clean" description="Cleans this project"&gt;
      &lt;delete dir="war/WEB-INF/classes" failonerror="false" /&gt;
      &lt;delete dir="war/musicstore" failonerror="false" /&gt;
    &lt;/target&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now I would like to get this simple example working in eclipse. I created a project called MusicStore using the gwt eclipse plugin. I then copied over the tutorial files without changing them. I can't post an image but here is a link to my eclipse project structure:</p>
  
  <p><a href="http://oi50.tinypic.com/t6rn2w.jpg" rel="nofollow">http://oi50.tinypic.com/t6rn2w.jpg</a></p>
  
  <p>Again, I start by running</p>
  
  <pre><code>(in the data directory) java -cp ../lib/hsqldb.jar org.hsqldb.Server
  </code></pre>
  
  <p>Then I try to run my project in eclipse but hibernate doesn't work. When I try to add an account in the UI it alerts "Failed to save account" and I get the error java.lang.NoClassDefFoundError: org/hibernate/Session.</p>
  
  <p>Please let me know how I should go about getting the sample code working with eclipse. I think that many users new to hibernate will also want to do this.</p>
  
  <p>Thanks!</p>