Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Debug on servlet fails to start
Debug on servlet fails to start [message #28631] Wed, 07 May 2003 11:15 Go to next message
Eclipse UserFriend
Originally posted by: rhino1.NOSPAM.sympatico.ca

I am trying to run debug on a pure servlet (as opposed to a JSP) for the
first time but it fails with the message "Failed to connect to remote VM as
connection was refused."

I followed the instructions in the Debugging articles at
http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
Eclipse.

When I clicked on Run->Debug I got the "Remote Java Application" option, and
created my new profile with these values:
- Project: SDACServlet [which is the correct name of my project]
- Connection Type: Standard (Socket Attach) [this is the only option in the
drop-down]
- Host: localhost
- Port: 8000
- Allow termination of remote VM unchecked [I tried it checked too but got
the same error]
I didn't touch anything in the Source or Common tabs so they are all using
their defaults.

What do I need to do to get my debug session to start?

I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows XP
Pro with all critical service installed.

--

Rhino
---
rhino1 AT sympatico DOT ca
"If you want the best seat in the house, you'll have to move the cat."
Re: Debug on servlet fails to start [message #28640 is a reply to message #28631] Wed, 07 May 2003 11:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed_anderson.us.ibm.com

Rhino,

When you start your application server, you need to start it with debug
options:

-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=800 0
-Djava.compiler=NONE

Then you can connect to it with the Eclipse debugger.

jkca

Rhino wrote:
> I am trying to run debug on a pure servlet (as opposed to a JSP) for the
> first time but it fails with the message "Failed to connect to remote VM as
> connection was refused."
>
> I followed the instructions in the Debugging articles at
> http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
> Eclipse.
>
> When I clicked on Run->Debug I got the "Remote Java Application" option, and
> created my new profile with these values:
> - Project: SDACServlet [which is the correct name of my project]
> - Connection Type: Standard (Socket Attach) [this is the only option in the
> drop-down]
> - Host: localhost
> - Port: 8000
> - Allow termination of remote VM unchecked [I tried it checked too but got
> the same error]
> I didn't touch anything in the Source or Common tabs so they are all using
> their defaults.
>
> What do I need to do to get my debug session to start?
>
> I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows XP
> Pro with all critical service installed.
>
Re: Debug on servlet fails to start [message #28642 is a reply to message #28640] Wed, 07 May 2003 11:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rhino1.NOSPAM.sympatico.ca

I put the debug options in the catalina.bat file as described in the article
I cited in my original post. Isn't that the right place to do it? Or do I
need to do it a second time within Eclipse somewhere?

Rhino

"Jed Anderson" <jed_anderson@us.ibm.com> wrote in message
news:b9b9l6$9lj$3@rogue.oti.com...
> Rhino,
>
> When you start your application server, you need to start it with debug
> options:
>
> -Xdebug -Xnoagent
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=800 0
> -Djava.compiler=NONE
>
> Then you can connect to it with the Eclipse debugger.
>
> jkca
>
> Rhino wrote:
> > I am trying to run debug on a pure servlet (as opposed to a JSP) for the
> > first time but it fails with the message "Failed to connect to remote VM
as
> > connection was refused."
> >
> > I followed the instructions in the Debugging articles at
> > http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
> > Eclipse.
> >
> > When I clicked on Run->Debug I got the "Remote Java Application" option,
and
> > created my new profile with these values:
> > - Project: SDACServlet [which is the correct name of my project]
> > - Connection Type: Standard (Socket Attach) [this is the only option in
the
> > drop-down]
> > - Host: localhost
> > - Port: 8000
> > - Allow termination of remote VM unchecked [I tried it checked too but
got
> > the same error]
> > I didn't touch anything in the Source or Common tabs so they are all
using
> > their defaults.
> >
> > What do I need to do to get my debug session to start?
> >
> > I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows
XP
> > Pro with all critical service installed.
> >
>
Re: Debug on servlet fails to start [message #28650 is a reply to message #28642] Wed, 07 May 2003 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rhino1.NOSPAM.sympatico.ca

Debug is now starting for me but it doesn't work the way the article
described.

After stopping and starting Tomcat a few times after posting my previous
note, I tried to run my servlet normally, i.e. *not* in debug mode. When I
ran the servlet in my browser, I found that it was starting in debug mode in
Eclipse, presumably because I have a breakpoint set in the servlet source
code. I can now trace through my code, even though I didn't intentionally
launch it in debug mode.

According to the article, I need to explicitly choose Run->Debug from the
Eclipse menu bar to get this behaviour but I didn't do this. Is the article
obsolete due to changes in Eclipse and/or Tomcat? Again, the URL for the
article is: http://jakarta.apache.org/site/idedevelopers.html and I'm using
Tomcat 4.1.24, Windows XP, Eclipse 2.1 (RC), and Sysdeo V2.1.

Also, in my Tomcat preferences, I have the "Don't run Tomcat in debug mode"
box unchecked. Is that why it is debugging when I run the servlet while it
has breakpoints set, even though I didn't ask it to debug? Will I need to
check this box or remove my breakpoints in order to run the servlet in
normal (non-debug) mode?

In short, I'm not sure if I've set things up wrong or the article is wrong.
Could anyone clarify this for me?

Rhino

"Rhino" <rhino1@NOSPAM.sympatico.ca> wrote in message
news:b9ba0i$as5$1@rogue.oti.com...
> I put the debug options in the catalina.bat file as described in the
article
> I cited in my original post. Isn't that the right place to do it? Or do I
> need to do it a second time within Eclipse somewhere?
>
> Rhino
>
> "Jed Anderson" <jed_anderson@us.ibm.com> wrote in message
> news:b9b9l6$9lj$3@rogue.oti.com...
> > Rhino,
> >
> > When you start your application server, you need to start it with debug
> > options:
> >
> > -Xdebug -Xnoagent
> > -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=800 0
> > -Djava.compiler=NONE
> >
> > Then you can connect to it with the Eclipse debugger.
> >
> > jkca
> >
> > Rhino wrote:
> > > I am trying to run debug on a pure servlet (as opposed to a JSP) for
the
> > > first time but it fails with the message "Failed to connect to remote
VM
> as
> > > connection was refused."
> > >
> > > I followed the instructions in the Debugging articles at
> > > http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
> > > Eclipse.
> > >
> > > When I clicked on Run->Debug I got the "Remote Java Application"
option,
> and
> > > created my new profile with these values:
> > > - Project: SDACServlet [which is the correct name of my project]
> > > - Connection Type: Standard (Socket Attach) [this is the only option
in
> the
> > > drop-down]
> > > - Host: localhost
> > > - Port: 8000
> > > - Allow termination of remote VM unchecked [I tried it checked too but
> got
> > > the same error]
> > > I didn't touch anything in the Source or Common tabs so they are all
> using
> > > their defaults.
> > >
> > > What do I need to do to get my debug session to start?
> > >
> > > I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows
> XP
> > > Pro with all critical service installed.
> > >
> >
>
>
Re: Debug on servlet fails to start [message #28658 is a reply to message #28650] Wed, 07 May 2003 13:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jed_anderson.us.ibm.com

Rhino,

By adding the debug arguments to your catalina.bat file, you will
_always_ launch Tomcat in debug mode. The arguments are given directly
to the Java VM, the Tomcat preferences will not have any effect. So if
you want to simply run your servlet, you need to remove the arguments.

Most likely, when you attempted to use your servlet, the debugger was
still connected to the tomcat server. That is why you hit the breakpoint.

I think the article is reasonibly correct. :)

jkca

Rhino wrote:
> Debug is now starting for me but it doesn't work the way the article
> described.
>
> After stopping and starting Tomcat a few times after posting my previous
> note, I tried to run my servlet normally, i.e. *not* in debug mode. When I
> ran the servlet in my browser, I found that it was starting in debug mode in
> Eclipse, presumably because I have a breakpoint set in the servlet source
> code. I can now trace through my code, even though I didn't intentionally
> launch it in debug mode.
>
> According to the article, I need to explicitly choose Run->Debug from the
> Eclipse menu bar to get this behaviour but I didn't do this. Is the article
> obsolete due to changes in Eclipse and/or Tomcat? Again, the URL for the
> article is: http://jakarta.apache.org/site/idedevelopers.html and I'm using
> Tomcat 4.1.24, Windows XP, Eclipse 2.1 (RC), and Sysdeo V2.1.
>
> Also, in my Tomcat preferences, I have the "Don't run Tomcat in debug mode"
> box unchecked. Is that why it is debugging when I run the servlet while it
> has breakpoints set, even though I didn't ask it to debug? Will I need to
> check this box or remove my breakpoints in order to run the servlet in
> normal (non-debug) mode?
>
> In short, I'm not sure if I've set things up wrong or the article is wrong.
> Could anyone clarify this for me?
>
> Rhino
>
> "Rhino" <rhino1@NOSPAM.sympatico.ca> wrote in message
> news:b9ba0i$as5$1@rogue.oti.com...
>
>>I put the debug options in the catalina.bat file as described in the
>
> article
>
>>I cited in my original post. Isn't that the right place to do it? Or do I
>>need to do it a second time within Eclipse somewhere?
>>
>>Rhino
>>
>>"Jed Anderson" <jed_anderson@us.ibm.com> wrote in message
>>news:b9b9l6$9lj$3@rogue.oti.com...
>>
>>>Rhino,
>>>
>>>When you start your application server, you need to start it with debug
>>>options:
>>>
>>> -Xdebug -Xnoagent
>>> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=800 0
>>>-Djava.compiler=NONE
>>>
>>>Then you can connect to it with the Eclipse debugger.
>>>
>>>jkca
>>>
>>>Rhino wrote:
>>>
>>>>I am trying to run debug on a pure servlet (as opposed to a JSP) for
>>>
> the
>
>>>>first time but it fails with the message "Failed to connect to remote
>>>
> VM
>
>>as
>>
>>>>connection was refused."
>>>>
>>>>I followed the instructions in the Debugging articles at
>>>>http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
>>>>Eclipse.
>>>>
>>>>When I clicked on Run->Debug I got the "Remote Java Application"
>>>
> option,
>
>>and
>>
>>>>created my new profile with these values:
>>>>- Project: SDACServlet [which is the correct name of my project]
>>>>- Connection Type: Standard (Socket Attach) [this is the only option
>>>
> in
>
>>the
>>
>>>>drop-down]
>>>>- Host: localhost
>>>>- Port: 8000
>>>>- Allow termination of remote VM unchecked [I tried it checked too but
>>>
>>got
>>
>>>>the same error]
>>>>I didn't touch anything in the Source or Common tabs so they are all
>>>
>>using
>>
>>>>their defaults.
>>>>
>>>>What do I need to do to get my debug session to start?
>>>>
>>>>I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows
>>>
>>XP
>>
>>>>Pro with all critical service installed.
>>>>
>>>
>>
>
>
Re: Debug on servlet fails to start [message #28667 is a reply to message #28658] Wed, 07 May 2003 14:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rhino1.NOSPAM.sympatico.ca

Okay, now I'm *really* confused.

I read your second reply and took it to mean that the debug parameters
should not be in the catalina.bat file like the article suggested since this
would put Tomcat in debug mode all the time. That raised the question of
where I *should* put the debug parameters. The only logical place I could
think of was in the JVM settings in the Tomcat node of the
Window->Preferences in Eclipse.

I remmed out the line in catalina.bat that set the CATALINA_OPTS and put
the -Xdebug, -Xrunjdwp,
-Xnoagent and -D parameters in the "Append to JVM Parameters" area of the
JVM Settings. I saved both changes.

Now I can't start Tomcat at all! (I'm using the Stop/Start/Restart Tomcat
buttons created by Sysdeo.) When I click on the Start Tomcat button, it
depresses itself for a couple of seconds and then sets itself flat again.
Tomcat doesn't start and there is no message of any kind in the console or
anywhere else, including the Tomcat log.

If I remove the debug parameters from the JVM settings, Tomcat starts again
just fine with the usual messages in the console.

When I try to start debug with the Run->Debug option, I get the same message
that prompted this whole thread in the first place: "Failed to connect to
remote VM as connection was refused".

What do I need to do differently to get my servlets to debug, ideally only
when I want to run them in debug mode?

I'm going to activate that remmed-out line in catalina.bat for now so that I
can resume debugging my servlet. If you could kindly tell me where I'm going
wrong, I would greatly appreciate it.

By the way, is there any documentation on how to debug servlets in Eclipse?
I didn't see anything in my Eclipse help on this but lots of other people
have apparently figured out how to debug servlets. If there is
documentation, can someone point me to it? I would be happy to "rtfm" if I
knew where the "m" was; the article I've been citing is the only thing I've
been to find on debugging....

Rhino


"Jed Anderson" <jed_anderson@us.ibm.com> wrote in message
news:b9be99$9lj$4@rogue.oti.com...
> Rhino,
>
> By adding the debug arguments to your catalina.bat file, you will
> _always_ launch Tomcat in debug mode. The arguments are given directly
> to the Java VM, the Tomcat preferences will not have any effect. So if
> you want to simply run your servlet, you need to remove the arguments.
>
> Most likely, when you attempted to use your servlet, the debugger was
> still connected to the tomcat server. That is why you hit the breakpoint.
>
> I think the article is reasonibly correct. :)
>
> jkca
>
> Rhino wrote:
> > Debug is now starting for me but it doesn't work the way the article
> > described.
> >
> > After stopping and starting Tomcat a few times after posting my previous
> > note, I tried to run my servlet normally, i.e. *not* in debug mode. When
I
> > ran the servlet in my browser, I found that it was starting in debug
mode in
> > Eclipse, presumably because I have a breakpoint set in the servlet
source
> > code. I can now trace through my code, even though I didn't
intentionally
> > launch it in debug mode.
> >
> > According to the article, I need to explicitly choose Run->Debug from
the
> > Eclipse menu bar to get this behaviour but I didn't do this. Is the
article
> > obsolete due to changes in Eclipse and/or Tomcat? Again, the URL for the
> > article is: http://jakarta.apache.org/site/idedevelopers.html and I'm
using
> > Tomcat 4.1.24, Windows XP, Eclipse 2.1 (RC), and Sysdeo V2.1.
> >
> > Also, in my Tomcat preferences, I have the "Don't run Tomcat in debug
mode"
> > box unchecked. Is that why it is debugging when I run the servlet while
it
> > has breakpoints set, even though I didn't ask it to debug? Will I need
to
> > check this box or remove my breakpoints in order to run the servlet in
> > normal (non-debug) mode?
> >
> > In short, I'm not sure if I've set things up wrong or the article is
wrong.
> > Could anyone clarify this for me?
> >
> > Rhino
> >
> > "Rhino" <rhino1@NOSPAM.sympatico.ca> wrote in message
> > news:b9ba0i$as5$1@rogue.oti.com...
> >
> >>I put the debug options in the catalina.bat file as described in the
> >
> > article
> >
> >>I cited in my original post. Isn't that the right place to do it? Or do
I
> >>need to do it a second time within Eclipse somewhere?
> >>
> >>Rhino
> >>
> >>"Jed Anderson" <jed_anderson@us.ibm.com> wrote in message
> >>news:b9b9l6$9lj$3@rogue.oti.com...
> >>
> >>>Rhino,
> >>>
> >>>When you start your application server, you need to start it with debug
> >>>options:
> >>>
> >>> -Xdebug -Xnoagent
> >>> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=800 0
> >>>-Djava.compiler=NONE
> >>>
> >>>Then you can connect to it with the Eclipse debugger.
> >>>
> >>>jkca
> >>>
> >>>Rhino wrote:
> >>>
> >>>>I am trying to run debug on a pure servlet (as opposed to a JSP) for
> >>>
> > the
> >
> >>>>first time but it fails with the message "Failed to connect to remote
> >>>
> > VM
> >
> >>as
> >>
> >>>>connection was refused."
> >>>>
> >>>>I followed the instructions in the Debugging articles at
> >>>>http://jakarta.apache.org/site/idedevelopers.html for both Tomcat and
> >>>>Eclipse.
> >>>>
> >>>>When I clicked on Run->Debug I got the "Remote Java Application"
> >>>
> > option,
> >
> >>and
> >>
> >>>>created my new profile with these values:
> >>>>- Project: SDACServlet [which is the correct name of my project]
> >>>>- Connection Type: Standard (Socket Attach) [this is the only option
> >>>
> > in
> >
> >>the
> >>
> >>>>drop-down]
> >>>>- Host: localhost
> >>>>- Port: 8000
> >>>>- Allow termination of remote VM unchecked [I tried it checked too but
> >>>
> >>got
> >>
> >>>>the same error]
> >>>>I didn't touch anything in the Source or Common tabs so they are all
> >>>
> >>using
> >>
> >>>>their defaults.
> >>>>
> >>>>What do I need to do to get my debug session to start?
> >>>>
> >>>>I am running Eclipse 2.1 RC1, Tomcat 4.1.24, and Sysdeo V21 on Windows
> >>>
> >>XP
> >>
> >>>>Pro with all critical service installed.
> >>>>
> >>>
> >>
> >
> >
>
Re: Debug on servlet fails to start [message #28728 is a reply to message #28667] Wed, 07 May 2003 17:59 Go to previous message
Eclipse UserFriend
Originally posted by: jed_anderson.us.ibm.com

Rhino,

Where the options should be is really a matter of opinion/usage. During
development, you will want to debug, so I suggest that you leave them in
catalina.bat. When you deploy your servlet, you will want to start the
server _without_ the options, this will allow the server to run faster.

Debugging a servlet is only slightly more complex than debugging a
standard Java application (it is exactly like debugging a Java
application on a remote machine).

The Java program to be debugged must be started in debug mode, this
means specifying the flags to the Java VM when the program starts.

The debugger, Eclipse in this case, then connects to the debugged
program. Boom, you're debugging.

So, setting the CATALINA_OPTS tells Tomcat to start the Java VM with
those options. Then you should be able to connect with Eclipse. You
had this working... right?

There is no documentation on debugging servlets, as servlets are a J2EE
thing that Eclipse Project has yet to support (other people have written
J2EE plugins that do this, but they are not offically a part of the
Eclipse Project (read: third party plugins)). You might also want to
check the wiki (http://eclipsewiki.swiki.net/).

jkca

Rhino wrote:
> Okay, now I'm *really* confused.
>
> I read your second reply and took it to mean that the debug parameters
> should not be in the catalina.bat file like the article suggested since this
> would put Tomcat in debug mode all the time. That raised the question of
> where I *should* put the debug parameters. The only logical place I could
> think of was in the JVM settings in the Tomcat node of the
> Window->Preferences in Eclipse.
>
> I remmed out the line in catalina.bat that set the CATALINA_OPTS and put
> the -Xdebug, -Xrunjdwp,
> -Xnoagent and -D parameters in the "Append to JVM Parameters" area of the
> JVM Settings. I saved both changes.
>
> Now I can't start Tomcat at all! (I'm using the Stop/Start/Restart Tomcat
> buttons created by Sysdeo.) When I click on the Start Tomcat button, it
> depresses itself for a couple of seconds and then sets itself flat again.
> Tomcat doesn't start and there is no message of any kind in the console or
> anywhere else, including the Tomcat log.
>
> If I remove the debug parameters from the JVM settings, Tomcat starts again
> just fine with the usual messages in the console.
>
> When I try to start debug with the Run->Debug option, I get the same message
> that prompted this whole thread in the first place: "Failed to connect to
> remote VM as connection was refused".
>
> What do I need to do differently to get my servlets to debug, ideally only
> when I want to run them in debug mode?
>
> I'm going to activate that remmed-out line in catalina.bat for now so that I
> can resume debugging my servlet. If you could kindly tell me where I'm going
> wrong, I would greatly appreciate it.
>
> By the way, is there any documentation on how to debug servlets in Eclipse?
> I didn't see anything in my Eclipse help on this but lots of other people
> have apparently figured out how to debug servlets. If there is
> documentation, can someone point me to it? I would be happy to "rtfm" if I
> knew where the "m" was; the article I've been citing is the only thing I've
> been to find on debugging....
>
> Rhino
Previous Topic:File delete
Next Topic:What is new in eclipse-2.1.1?
Goto Forum:
  


Current Time: Fri May 16 03:09:04 EDT 2025

Powered by FUDForum. Page generated in 0.29499 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top