title: ClassNotFoundException when attempting to deploy a WAR file to Glassfish
body: <p>As I continue to investigate using Ant Build Scripts, Spring and Glassfish I have run into another issue when deploying a WAR to Glassfish.</p>
  
  <p>My build script seems to compile and produce a war file correctly, but when I come to deploy it using</p>
  
  <pre><code>&lt;glassfish-deploy force="true" file="${dist.dir}/${name}.war" /&gt;
  </code></pre>
  
  <p>I get the following error message</p>
  
  <pre><code>[glassfish-deploy] remote failure: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: uk.co.crowderconsult.spider.controllers.HelloController. Please see server.log for more details.
  </code></pre>
  
  <p>Of which I belive the underlying issue is</p>
  
  <pre><code>java.lang.ClassNotFoundException: uk.co.crowderconsult.spider.controllers.HelloController
  </code></pre>
  
  <p>However, the class that it can't find is one of the ones I have written and contained within the WAR file. I checked by opening the WAR with winzip and the classfile is within there. </p>
  
  <p>Normally I would figure that I hadn't included something in the classpath, but 
  1) the class is in the file I'm trying to deploy so would expect it to be on the classpath anyway and
  2) I don't know how to set the classpath for glassfish's deploy command.</p>
  
  <p>I've also tried to deploy it using the command line asadmin task, and the admin console of glassfish, with the same results.</p>
  
  <p>Can anyone point me in the right direction as I feel like I'm just going round in circles?! If any other information is required please let me know</p>
  
  <p>Many thanks.</p>