JSwat remote visual jsp debugging of tomcat3.2.3 running in java1.3.1_02

"Simon Massey" <[email protected]>
Newsgroups gmane.comp.java.jswat.user
Message-ID <[email protected]>
I am pleased to report that I have been able to use JSwat 2.8  running in
Java1.4.0_01 to remote debug jsps within Tomcat3.2.3 running in
Java1.3.1_02.

Many thanks to Kay Streubel for his excellent Tomcat4/Java1.4 jsp debugging
How-To http://www.bluemarsh.com/java/jswat/docs/howto-tomcat-jsp.html.

I set the following:





TOMCAT_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_sh
mem,address=jdbconn,server=y,suspend=n

and launched the tomcat3.2.3 with JAVA_HOME pointing at my Java1.3.1_02
install and then ran JSwat2.8 in Java1.4 and connected to the tomcat
instance using shared memory to connect to "jdbconn" as per Kay's
instructions.

The only minor tweaks for debugging JSPs in Tomcat3 where that:

    1) with Tomcat3 the compiled jsps are not in any package so there is no
need to move them around for JSwat to find them
    2) the "classdebuginfo" setting which is to causes JSPs to be compiled
with debug data was not implimented in Tomcat3

If the JSPs are not compiled with debug data then you can see the current
line numbers and set break points in either in JSwat or jdb but you cannot
see locals or evaluate expressions. To get around I explicitly recompiled
the JSPs java files with debug data within the tomcat\work directory. To do
this I put all my project jars and the tomcat\lib jars on the classpath and
recompiled the jsp servlet java files in the tomcat\work\<webapp> directory
using "javac -g *.java". I then had to rename the the class files to match
the names that Tomcat would have given them (
_0002fedit_0002ejspedit_jsp_0.class -> _0002fedit_0002ejspedit.class ).  An
automated approach would be to use the <jspc> ant task to generate the jsp
java files and then <javac debug=on> to compile them and <move> to rename
them:

http://jakarta.apache.org/ant/manual/OptionalTasks/jspc.html

or if the jspc task is playing hard to get here is posting that shows a
build file that explicitly runs the jasper jsp->java compiler using the
<java> ant task and then compiles them with <javac debug=on>.

http://www.mail-archive.com/[email protected]/msg14936.html

note that if you don't rename your explicitly compiled class files to match
the names that tomcat would have given them tomcat will overwrite them with
class files compiled without debug data when you first hit the page.

Many thanks once again to Nathan and Kay for their outstanding contributions
to the wider community of java developers.

keywords: jspc jasper tomcat3 tomcat4 debug jsp visual remote attach jvm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.