title: Unable to see java source file in Java stack traces
body: <p>I am working on a web application deployed on a Tomcat server. On my local test system I use Eclipse and the WST to deploy my code to the server. If stack traces are thrown, I can see the source file and line number for each line - as expected.</p>
  
  <p>However, if an exception is thrown on the production system, the source file is unknown, as well as the line number. This is the case only for my own code, for all stack elements in the trace of external libraries the source file and line number is known.</p>
  
  <p>I am compiling my project as follows (using Ant):</p>
  
  <pre><code>&lt;javac srcdir="${src}" destdir="${build}" fork="true" debug="true" debuglevel="lines, vars, source"&gt;
      &lt;classpath refid="classpath" /&gt;
  &lt;/javac&gt;
  </code></pre>
  
  <p>I can absoutely not figure out where the problem is, although it must be super simple to solve.</p>
  
  <p>Thanks for your help!</p>
  
  <p><strong>>> Edit:</strong> Some more information about my deployment: I am definately using these Ant targets to create the war file:</p>
  
  <pre><code>&lt;target name="compile" depends="update-dependencies"&gt;  
      &lt;mkdir dir="${build}" /&gt;
      &lt;javac srcdir="${src}" destdir="${build}" fork="true" debug="true" debuglevel="lines, vars, source"&gt;
          &lt;classpath refid="classpath" /&gt;
      &lt;/javac&gt;
      &lt;javac srcdir="${tests}" destdir="${build}" fork="true" debug="true" debuglevel="lines, vars, source"&gt;
          &lt;classpath refid="classpath" /&gt;
      &lt;/javac&gt;
  
      &lt;!-- Copy non-java files --&gt;
      &lt;copydir dest="${build}" src="${src}"&gt;
          &lt;exclude name="**/*.java"/&gt;
      &lt;/copydir&gt;
  
      &lt;copydir dest="${build}" src="${tests}"&gt;
          &lt;exclude name="**/*.java"/&gt;
      &lt;/copydir&gt;
  &lt;/target&gt;
  
  
  &lt;target name="war" depends="compile"&gt;       
      &lt;war destfile="${war.file}" webxml="WebContent/WEB-INF/web.xml"&gt;
          &lt;fileset dir="WebContent" /&gt;
          &lt;lib dir="${lib}" /&gt;
          &lt;classes dir="${build}" /&gt;
      &lt;/war&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>On the local system I use eclipse to do the deployment for me, so I don't use any of my ant targets. Do I need the .java files in in the deployment maybe?</p>
  
  <p><strong>>> Edit2:</strong> Example stack trace (The exception itself is no problem!):</p>
  
  <pre><code>javax.naming.NamingException: Name is not valid
          at org.apache.naming.NamingContext.unbind(NamingContext.java:248)
          at org.apache.naming.NamingContext.unbind(NamingContext.java:282)
          at org.apache.naming.SelectorContext.unbind(SelectorContext.java:256)
          at javax.naming.InitialContext.unbind(InitialContext.java:416)
          at org.hibernate.impl.SessionFactoryObjectFactory.removeInstance(SessionFactoryObjectFactory.java:139)
          at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:894)
          at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:251)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.destroy(LocalSessionFactoryBean.java:899)
          at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:184)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:463)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:431)
          at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)
          at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
          at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)
          HERE: at my.pkg.ContextLoaderListener.closeWebApplicationContext(Unknown Source)
          HERE: at my.pkg.ContextLoaderListener.contextDestroyed(Unknown Source)
          at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)
          at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)
          at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
          at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1319)
          at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1290)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:323)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
          at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
          at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:450)
          at org.apache.catalina.core.StandardService.stop(StandardService.java:587)
          at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
          at org.apache.catalina.startup.Catalina.stop(Catalina.java:648)
          at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:692)
  </code></pre>