You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Angus M <an...@telocity.com> on 2001/02/04 15:21:19 UTC

Can't see line numbers in exceptions

When I dump a stack trace the the brower or to the tomcat log I can seem
to see the line numbers in the trace.  How do I turn this on?


build.xml snippet:
  <target name="compile" depends="prepare">
    <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
           classpath="${deploy.home}/WEB-INF/classes"
           debug="on" optimize="off" deprecation="off"/>
    <copy   todir="${deploy.home}/WEB-INF/classes">
      <fileset dir="src" includes="**/*.properties"/>
    </copy>
  </target>


Stack Trace:
java.lang.NullPointerException
	at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
	at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
Compiled Code)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java,
Compiled Code)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java, Compiled Code)

Thanks,
--Angus

SERVELET ClasspathWOES

Posted by R N Mukherjee <rn...@rdcis.bih.nic.in>.
SUB: How should the CLASSPATH be set for compiling a servlet file
containing BOTH USERDEFINED packages & BUILT-IN java packages. (presently
gives compile error with javax.http.servlet not found)

My servelet code is

/*user defined html package saved in c:mypackage*/
import mypackage.html.*;
import javax.servlet.*;
import.javax.servlet.http.*;

COMPILE ERROR
the user defined html package is found, but not the javax.servet package.

Classpath is set as follows
set classpath=.;c:\mypackage;c:\jsdk2.0\lib\jsdk.jar;

Please suggest How should the classpath be set for RECOGNISING BOTH user
defined packages and javax.servlet packages at the same time.









Re: Can't see line numbers in exceptions

Posted by William Brogden <wb...@bga.com>.

Angus M wrote:
> 
> William Brogden wrote:
> >
> > Angus M wrote:
> > >
> > > When I dump a stack trace the the brower or to the tomcat log I can seem
> > > to see the line numbers in the trace.  How do I turn this on?
> > >
> > > build.xml snippet:
> > >   <target name="compile" depends="prepare">
> > >     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
> > >            classpath="${deploy.home}/WEB-INF/classes"
> > >            debug="on" optimize="off" deprecation="off"/>
> > >     <copy   todir="${deploy.home}/WEB-INF/classes">
> > >       <fileset dir="src" includes="**/*.properties"/>
> > >     </copy>
> > >   </target>
> > >
> > > Stack Trace:
> > > java.lang.NullPointerException
> > >         at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
> > >         at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)
> >
> > I can think of two possible reasons you are seeing Compiled Code
> > instead of line numbers.
> >
> > 1) you need to compile with the option that leaves line number
> >    information in the .class file. See the compiler options in the
> >    tooldocs.
> 
> Um, did you read the build.xml snippet?  debug="on"  Or is there some
> other switch?

That should ensure complete debug information in the .class
file.

> 
> >
> > 2) you need to run without the JIT compiler because it discards
> >    line number  information. Try setting the environment variable
> >
> > set JAVA_COMPILER=NONE
> >
> 
> Which file should I put this in so that I don't have to worry about it
> being sent for and auto-startup by the server on reboot?

This environment variable needs to be in effect before Tomcat starts.
Since it is going to slow down the response considerably, you better
put it somewhere that you won't forget about it when time comes to
deploy
your application.

Re: Can't see line numbers in exceptions

Posted by Angus M <an...@telocity.com>.

William Brogden wrote:
> 
> Angus M wrote:
> >
> > When I dump a stack trace the the brower or to the tomcat log I can seem
> > to see the line numbers in the trace.  How do I turn this on?
> >
> > build.xml snippet:
> >   <target name="compile" depends="prepare">
> >     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
> >            classpath="${deploy.home}/WEB-INF/classes"
> >            debug="on" optimize="off" deprecation="off"/>
> >     <copy   todir="${deploy.home}/WEB-INF/classes">
> >       <fileset dir="src" includes="**/*.properties"/>
> >     </copy>
> >   </target>
> >
> > Stack Trace:
> > java.lang.NullPointerException
> >         at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
> >         at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)
> 
> I can think of two possible reasons you are seeing Compiled Code
> instead of line numbers.
> 
> 1) you need to compile with the option that leaves line number
>    information in the .class file. See the compiler options in the
>    tooldocs.

Um, did you read the build.xml snippet?  debug="on"  Or is there some
other switch?

> 
> 2) you need to run without the JIT compiler because it discards
>    line number  information. Try setting the environment variable
> 
> set JAVA_COMPILER=NONE
> 

Which file should I put this in so that I don't have to worry about it
being sent for and auto-startup by the server on reboot?

--Angus

Re: Can't see line numbers in exceptions

Posted by William Brogden <wb...@bga.com>.

Angus M wrote:
> 
> When I dump a stack trace the the brower or to the tomcat log I can seem
> to see the line numbers in the trace.  How do I turn this on?
> 
> build.xml snippet:
>   <target name="compile" depends="prepare">
>     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
>            classpath="${deploy.home}/WEB-INF/classes"
>            debug="on" optimize="off" deprecation="off"/>
>     <copy   todir="${deploy.home}/WEB-INF/classes">
>       <fileset dir="src" includes="**/*.properties"/>
>     </copy>
>   </target>
> 
> Stack Trace:
> java.lang.NullPointerException
>         at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
>         at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)

I can think of two possible reasons you are seeing Compiled Code 
instead of line numbers.

1) you need to compile with the option that leaves line number 
   information in the .class file. See the compiler options in the
   tooldocs.

2) you need to run without the JIT compiler because it discards 
   line number  information. Try setting the environment variable

set JAVA_COMPILER=NONE

-- 
WBB - wbrogden@lanw.com
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP 
ISBN 0-7821-2809-2

Re: Can't see line numbers in exceptions

Posted by Chris Janicki <Ja...@ia-inc.com>.
Go to java.sun.com for documentation.  (Good luck wading through it 
though.)

The "sunwjit" means the environment variable was not set right.  It 
should look like this (I'm using c-shell, /bin/csh): Notice the "nojit".

> setenv JAVA_COMPILER NONE
> ./java -version
java version "1.2.2"
Solaris VM (build Solaris_JDK_1.2.2_05, native threads, nojit)
> 

Remember that an environment variable is only set for the current shell.  
If you set the variable, then open a new terminal window, that setting is 
*not* in the new terminal.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/4/01, 12:19:34 PM, Angus M <an...@telocity.com> wrote regarding 
Re: Can't see line numbers in exceptions:


> Where do I set this flag?  I did setenv and set for this variable.
> Didn't help.  Is there a reference that describes these features where I
> could look this up?

> java -version
> java version "1.2.2"
> Classic VM (build Linux_JDK_1.2.2_FCS, native threads, sunwjit)
> ^^^^^  Could this be part of the problem? ^^^^^

> As you can see in the build.xml snippet below, I did turn debug="on"
> --Angus

> Chris Janicki wrote:
> >
> > The phrase "Compiled Code" in your stack trace indicates that your java
> > bytecode has been compiled by the JIT or Hotspot, so it has no reference
> > to line numbers anymore.  You can prevent your code from being natively
> > compiled by setting an environment variable: JAVA_COMPILER=NONE  Then,
> > java will just execute your bytecode and have full knowledge of where
> > it's at.  Of course it will run a bit slower too, so just use this for
> > testing.
> >
> > I think you might also have to make sure that your code was compiled by
> > javac/fastjavac with the "-g" option, but I'm not sure about that.
> >
> > Chris
> >
> > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> >
> > On 2/4/01, 9:21:19 AM, Angus M <an...@telocity.com> wrote regarding
> > Can't see line numbers in exceptions:
> >
> > > When I dump a stack trace the the brower or to the tomcat log I can seem
> > > to see the line numbers in the trace.  How do I turn this on?
> >
> > > build.xml snippet:
> > >   <target name="compile" depends="prepare">
> > >     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
> > >            classpath="${deploy.home}/WEB-INF/classes"
> > >            debug="on" optimize="off" deprecation="off"/>
> > >     <copy   todir="${deploy.home}/WEB-INF/classes">
> > >       <fileset dir="src" includes="**/*.properties"/>
> > >     </copy>
> > >   </target>
> >
> > > Stack Trace:
> > > java.lang.NullPointerException
> > >       at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
> > >       at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org

Re: Can't see line numbers in exceptions

Posted by Angus M <an...@telocity.com>.
Where do I set this flag?  I did setenv and set for this variable. 
Didn't help.  Is there a reference that describes these features where I
could look this up?

java -version
java version "1.2.2"
Classic VM (build Linux_JDK_1.2.2_FCS, native threads, sunwjit)
^^^^^  Could this be part of the problem? ^^^^^

As you can see in the build.xml snippet below, I did turn debug="on"
--Angus

Chris Janicki wrote:
> 
> The phrase "Compiled Code" in your stack trace indicates that your java
> bytecode has been compiled by the JIT or Hotspot, so it has no reference
> to line numbers anymore.  You can prevent your code from being natively
> compiled by setting an environment variable: JAVA_COMPILER=NONE  Then,
> java will just execute your bytecode and have full knowledge of where
> it's at.  Of course it will run a bit slower too, so just use this for
> testing.
> 
> I think you might also have to make sure that your code was compiled by
> javac/fastjavac with the "-g" option, but I'm not sure about that.
> 
> Chris
> 
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> 
> On 2/4/01, 9:21:19 AM, Angus M <an...@telocity.com> wrote regarding
> Can't see line numbers in exceptions:
> 
> > When I dump a stack trace the the brower or to the tomcat log I can seem
> > to see the line numbers in the trace.  How do I turn this on?
> 
> > build.xml snippet:
> >   <target name="compile" depends="prepare">
> >     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
> >            classpath="${deploy.home}/WEB-INF/classes"
> >            debug="on" optimize="off" deprecation="off"/>
> >     <copy   todir="${deploy.home}/WEB-INF/classes">
> >       <fileset dir="src" includes="**/*.properties"/>
> >     </copy>
> >   </target>
> 
> > Stack Trace:
> > java.lang.NullPointerException
> >       at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
> >       at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)

Re: Can't see line numbers in exceptions

Posted by Chris Janicki <Ja...@ia-inc.com>.
The phrase "Compiled Code" in your stack trace indicates that your java 
bytecode has been compiled by the JIT or Hotspot, so it has no reference 
to line numbers anymore.  You can prevent your code from being natively 
compiled by setting an environment variable: JAVA_COMPILER=NONE  Then, 
java will just execute your bytecode and have full knowledge of where 
it's at.  Of course it will run a bit slower too, so just use this for 
testing.

I think you might also have to make sure that your code was compiled by 
javac/fastjavac with the "-g" option, but I'm not sure about that.

Chris


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/4/01, 9:21:19 AM, Angus M <an...@telocity.com> wrote regarding 
Can't see line numbers in exceptions:


> When I dump a stack trace the the brower or to the tomcat log I can seem
> to see the line numbers in the trace.  How do I turn this on?


> build.xml snippet:
>   <target name="compile" depends="prepare">
>     <javac srcdir="src" destdir="${deploy.home}/WEB-INF/classes"
>            classpath="${deploy.home}/WEB-INF/classes"
>            debug="on" optimize="off" deprecation="off"/>
>     <copy   todir="${deploy.home}/WEB-INF/classes">
>       <fileset dir="src" includes="**/*.properties"/>
>     </copy>
>   </target>


> Stack Trace:
> java.lang.NullPointerException
>       at org.phoenix.bugbase.Frame.doGet(Frame.java, Compiled Code)
>       at org.phoenix.bugbase.Frame.doPost(Frame.java, Compiled Code)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java, 
Compiled
> Code)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java, 
Compiled
> Code)
>       at 
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
> Compiled Code)
>       at org.apache.tomcat.core.Handler.service(Handler.java, Compiled 
Code)
>       at 
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
> Compiled Code)
>       at
> 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
> Compiled Code)
>       at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java,
> Compiled Code)
>       at
> 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Htt
pConnectionHandler.java,
> Compiled Code)
>       at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
> Compiled Code)
>       at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
> Compiled Code)
>       at java.lang.Thread.run(Thread.java, Compiled Code)

> Thanks,
> --Angus

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org