You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andreas Ronge <an...@jayway.se> on 2001/09/04 17:03:38 UTC

Debugging JSP via JDWP

Hi

I have been trying for a few days now to debug JSP pages via the JDWP
protocol without any success.
Has someone tried this  ?

I start tomcat via the following ant file:

<target depends="init" name="start">
       <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
            <sysproperty key="java.compiler" value="NONE"/>
            <sysproperty key="catalina.home" path="${tomcat.root}"/>
            <jvmarg value="-classic"/>
            <jvmarg value="-Xdebug"/>
            <jvmarg value="-Xnoagent"/>
            <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,address=12999,suspend=n"/>
            <arg value="start"/>
           <classpath>
             <pathelement location="${tomcat.root}/bin/bootstrap.jar"/>
             <pathelement location="C:/dev/jdk1.3.1/lib/tools.jar"/>
             <pathelement
location="${tomcat.root}/server/lib/catalina.jar"/>
             <pathelement location="${tomcat.root}/server/lib/jaxp.jar"/>
             <pathelement location="${tomcat.root}/server/lib/warp.jar"/>
             <pathelement
location="${tomcat.root}/server/lib/jakarta-regexp-1.2.jar"/>
             <pathelement location="${tomcat.root}/server/lib/crimson.jar"/>
             <pathelement location="${tomcat.root}/lib/jasper-runtime.jar"/>
             <pathelement
location="${tomcat.root}/jasper/jasper-compiler.jar"/>
             <pathelement location="${tomcat.root}/common/lib/servlet.jar"/>
           </classpath>
       </java>
    </target>

I'm using NetBeans to debug tomcat via JDWP socket port 12999
I have precompiled the JSP page but tomcat does not use it.

keeps the servlet class cached in memory.
(1)   Connecting to andreasronge:12999
(2)  Breakpoint reached at line ? in class users_jsp by thread
HttpProcessor[8080][4].
(3)   Thread HttpProcessor[8080][4] stopped at users_jsp._jspService line
57 - unavailable source file.
At (3) the debugger somehow changed class file from the precompiled
users_jsp file to
users_jsp._jspService that does not exist (probably in memory)

It does not even work with servlet mapping:

            <servlet>
              <servlet-name>users_jsp</servlet-name>
              <servlet-class>users_jsp</servlet-class>
            </servlet>

            <servlet-mapping>
              <servlet-name>users_jsp</servlet-name>
              <url-pattern>/agust</url-pattern>
            </servlet-mapping>


I am using tomcat 4.0-b7 and Debug via NetBeans 3.2

Sincerly
Andreas






Re: Debugging JSP via JDWP

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 4 Sep 2001, Andreas Ronge wrote:

> Date: Tue, 4 Sep 2001 17:03:38 +0200
> From: Andreas Ronge <an...@jayway.se>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Debugging JSP via JDWP
>
> Hi
>
> I have been trying for a few days now to debug JSP pages via the JDWP
> protocol without any success.
> Has someone tried this  ?
>
> I start tomcat via the following ant file:
>
> <target depends="init" name="start">
>        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
>             <sysproperty key="java.compiler" value="NONE"/>
>             <sysproperty key="catalina.home" path="${tomcat.root}"/>
>             <jvmarg value="-classic"/>
>             <jvmarg value="-Xdebug"/>
>             <jvmarg value="-Xnoagent"/>
>             <jvmarg
> value="-Xrunjdwp:transport=dt_socket,server=y,address=12999,suspend=n"/>
>             <arg value="start"/>
>            <classpath>
>              <pathelement location="${tomcat.root}/bin/bootstrap.jar"/>
>              <pathelement location="C:/dev/jdk1.3.1/lib/tools.jar"/>
>              <pathelement
> location="${tomcat.root}/server/lib/catalina.jar"/>
>              <pathelement location="${tomcat.root}/server/lib/jaxp.jar"/>
>              <pathelement location="${tomcat.root}/server/lib/warp.jar"/>
>              <pathelement
> location="${tomcat.root}/server/lib/jakarta-regexp-1.2.jar"/>
>              <pathelement location="${tomcat.root}/server/lib/crimson.jar"/>
>              <pathelement location="${tomcat.root}/lib/jasper-runtime.jar"/>
>              <pathelement
> location="${tomcat.root}/jasper/jasper-compiler.jar"/>
>              <pathelement location="${tomcat.root}/common/lib/servlet.jar"/>
>            </classpath>
>        </java>
>     </target>
>
> I'm using NetBeans to debug tomcat via JDWP socket port 12999
> I have precompiled the JSP page but tomcat does not use it.
>

Tomcat doesn't keep the old class around, but the debugger might ... it
might not understand that the old class loader was replaced.  There is not
much Tomcat can do under those circumstances.

A way to verify this is to try running Tomcat normally (not under the
debugger), and try modifying the page -- you should see it recompile
automatically on the next request.

> keeps the servlet class cached in memory.
> (1)   Connecting to andreasronge:12999
> (2)  Breakpoint reached at line ? in class users_jsp by thread
> HttpProcessor[8080][4].
> (3)   Thread HttpProcessor[8080][4] stopped at users_jsp._jspService line
> 57 - unavailable source file.
> At (3) the debugger somehow changed class file from the precompiled
> users_jsp file to
> users_jsp._jspService that does not exist (probably in memory)
>
> It does not even work with servlet mapping:
>
>             <servlet>
>               <servlet-name>users_jsp</servlet-name>
>               <servlet-class>users_jsp</servlet-class>
>             </servlet>
>

This is of course not valid, because "users_jsp" is not a valid class
name.  You would want to try:

  <servlet>
    <servlet-name>users_jsp</servlet-name>
    <jsp-file>/path/to/users_jsp.jsp</jsp-file>
  </servlet>

Although I suspect class loading issues will still cause you grief.

>             <servlet-mapping>
>               <servlet-name>users_jsp</servlet-name>
>               <url-pattern>/agust</url-pattern>
>             </servlet-mapping>
>
>
> I am using tomcat 4.0-b7 and Debug via NetBeans 3.2
>
> Sincerly
> Andreas
>

Craig McClanahan