You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Léa Massiot <lm...@orange.fr> on 2014/11/19 16:23:16 UTC

Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Hello and thank you for reading my post.

My problem is about debugging a Webapp in Eclipse running Tomcat as a
stand-alone JVM process.

-- In more details --
Below is what I would like to do:
- Start Tomcat:
  - on Windows: via "startup.bat" in a "cmd.exe" ;
  - on Unix (Debian Squeeze): via "JSVC" in a "/etc/init.d/tomcat7" script.
- Run Eclipse (Juno):
  as a non-root user (say "U").
- Debug a Webapp in Eclipse running Tomcat as a stand-alone JVM process
  (NOT running Tomcat from within the Eclipse JVM).

This article states that it is possible to do this:
http://blogs.mulesoft.org/debugging-your-tomcat-webapp-with-eclipse/
Excerpt:
"Once you have Tomcat running successfully as a separate process,
and your webapp happily running on it,
you can begin configuring remote debugging."

A) First of all, I do not manage to: 
have Tomcat run successfully as a separate process,
and your webapp happily running on it
[in Eclipse (personal addition)].
Can you tell me what I have to do?
(I hope it doesn't mean putting a .war file in the Tomcat "webapps"
directory because I know how to do that already).

B) Second of all.
As for the debugging part, below is what I did so far:
1) In "startup.bat", I added the two lines:
   set "JPDA_ADDRESS=8000"
   set "JPDA_TRANSPORT=dt_socket"
   I modified the line:
   call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
   Below is the "startup.bat" that I have presently:
	-------------------------------------------------------------------------- 
	@echo off
	rem
---------------------------------------------------------------------------
	rem Start script for the CATALINA Server
	rem
---------------------------------------------------------------------------

	setlocal

	rem Guess CATALINA_HOME if not defined
	set "CURRENT_DIR=%cd%"
	if not "%CATALINA_HOME%" == "" goto gotHome
	set "CATALINA_HOME=%CURRENT_DIR%"
	if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
	cd ..
	set "CATALINA_HOME=%cd%"
	cd "%CURRENT_DIR%"
	:gotHome
	if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
	echo The CATALINA_HOME environment variable is not defined correctly
	echo This environment variable is needed to run this program
	goto end
	:okHome

	set "JPDA_ADDRESS=8000"
	set "JPDA_TRANSPORT=dt_socket"

	set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"

	rem Check that target executable exists
	if exist "%EXECUTABLE%" goto okExec
	echo Cannot find "%EXECUTABLE%"
	echo This file is needed to run this program
	goto end
	:okExec

	rem Get remaining unshifted command line arguments and save them in the
	set CMD_LINE_ARGS=
	:setArgs
	if ""%1""=="""" goto doneSetArgs
	set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
	shift
	goto setArgs
	:doneSetArgs

	call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

	:end
	-------------------------------------------------------------------------- 
2) In Eclipse, I went to the menu "Run -> Debug Configurations... -> Remote
Java Application"
    I entered the following values:
        
-------------------------------------------------------------------------- 
         Name: ExternalTomcat
	 Project: webapp_pjt1
	 Connection type: Standard (Socket Attach)
	 Host: localhost
	 Port: 8000
        
-------------------------------------------------------------------------- 
    I clicked the buttons "Apply" and then "Debug".
3) I set a breakpoint somewhere relevant in the Webapp code.
4) I tried to send an HTTP request to the Tomcat server:
    I entered https://localhost/webapp_pjt1/welcome.jsp in a browser (NOT
the Eclipse internal browser).
    I got a HTTP 404 error.

Can you see what I'm doing wrong?
Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 11/19/14 8:35 PM, Konstantin Kolinko wrote:
> 2014-11-19 22:06 GMT+03:00 Léa Massiot <lm...@orange.fr>:
>> Thank you for your answer. Your link helped.
>> 
>> What was missing from the scenario I described previously was: 
>> exporting the .war of the webapps into the Tomcat "webapps"
>> directory.
>> 
>> Actually, I was hoping it would be done automatically
>> "somehow"... :'/ Is there - by any chance - an option "somewhere"
>> that I have been missing which would automatically export the
>> webapps .war archives to the Tomcat "webapps" directory... at
>> build time for instance? Hope my question is clear enough.
> 
> 
> The proper temp is not "exporting", but "deployment".
> 
> Deployment can be done from Ant or from Maven. There exists tools
> for that.
> 
> If you are developing your web application, is there a reason why
> you run Tomcat standalone and not from within Eclipse IDE?

Because she wants to debug remotely (I think).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUbitlAAoJEBzwKT+lPKRYRCYP/1mKtwk1yCS5xGm1S64crTbl
GIPk01QgsA+TMpl9ardAIDsu4ylmRUFOspgy32j9ZxYMvqVlKw2XWo4j/7NdlcYo
dZb/YIhXugak8h0kz/EDt17VVMoqvAuooYPedBegtQw7aE77SkrMmdJpE18KXKU3
XxT3YJsON52JQ3MrsPpCeEmHX/Ot/9Ss241S1W5oC2DsXdfGga2hCBQ70+cHtOZx
bHOI2cw1eTub9kRawlto8wXKmdvhoJ60doangvuiR83lSogJC5NV9ygyhv2zFCu9
HayZs3Kf3mzR0XGQP51lpQmPm8ztY9yBoN4eIJxirBnvzFbeVA+uKxELxsXjjKNK
BjEQosniRgpIxZpSXZrJPUSb5EniOsYz6ffE2pDjFbla2mp0aVgl3kqSbwXQbNGG
VhhAsJ1nA5KjXLIUT10FRLJpQDPgfb1cJCVK40/MfyO9ArpgVELPXhz1giQCjIzM
WoC/dl4g6IHZ459UIhEUSST5fzrMzd2CWbFTjoi/min2QvpuAENCahwomqqd1G/A
kXKJQSkmQIFiutqhJqzx86cSzF5/zlz1sSAvBWZlsf9OD4sy4s9EWTCDOsoAbFaE
ZcMYmuNGCR/dOFTbDj+3mnLpQBXKTCDWLldV0QonLqMWZAhABL9V+yr9LB7nVg5z
6uuVlhuNWmskecLekZtm
=fVHQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Léa,

On 11/20/2014 7:24 AM, Léa Massiot wrote:
> Thank you for your answer.
> 
>> Konstantin Kolinko wrote: Why do you need the ports to be 80 and
>> 443? (You cannot open those on Linux unless you are a root). You
>> can a) change the port numbers in your configuration b) use
>> firewall (iptables) to map different local ports to those
>> external ones 
>> https://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F
>
>> 
> Well, apparently, according to the author of this article, I chose
> the best method (JSVC)! But thank you very much for pointing me
> towards this article and this FAQ which looks very interesting,
> full of interesting questions (and answers). Indeed the iptables
> solution looks attracting. I chose JSVC because I wanted Tomcat to
> be started at boot time and, if I'm not mistaken, this is root who
> runs the "/etc/init.d/" scripts including the "/etc/init.d/tomcat7"
> script... but I needed Tomcat to be run as a non-root user etc.
> etc.
> 
>> Konstantin Kolinko wrote: Also, 
>> https://wiki.apache.org/tomcat/FAQ/Linux_Unix#Q5
> 
> That's exactly what I did and I did it for exactly the same reasons
> given in this article. I didn't install the Tomcat Debian package. 
> I'm glad I did right.
> 
> Best regards.

On my Linux development machines where I also run a Tomcat at boot
time, I just use different ports.

I have a requirement to use Apache HTTPD in front of Tomcat, so that
runs on ports 80/443. Tomcat is installed and run as a non-privileged
user and I normally use the default ports (unless I have multiple
Tomcat installations).

This means that my development Tomcat (run as me and controlled by
NetBeans) has to run on a different set of ports. This should be
possible with Eclipse as well. Just edit server.xml.

In short, don't use the Tomcat started by init (soon to be systemd)
for development work. Run one from your account and control it with
the IDE. This way you can restart it in debug mode, examine the logs
without becoming root, and bring the server up and down with no issues.

Once you are to a point in the development process where you want
others to test, you can deploy the WAR file to the Tomcat started
during boot time.

. . . just my two cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUbhDBAAoJEEFGbsYNeTwtROQH+wbs532qNBwn8Kca1zqF1TVE
GQvM9kmKmquPx5qMVdU0yNXLGUHMmk62X5bKvwZMEFbhf1tcXwcM52X3x5n5lMRe
TijipLvsVFftEaFUNomD+VPTKhcYCMUdK9eupolaipHfkjoO9yczMQX3HsoQG273
FVenkzonldwq08Awq4U1B0MsnT8/Hp9GktFh67OjXitij7QnJTohDESNPQ+Y4Hry
2XQfLo1DKbTf4n+oDFJR7rojH+Uj/i9zDEWRij0lFwfkWM8BUzb8Sta80eGMrxNt
Ii/0wlBJBTjZCFxJz9w/8EinARxiEi6L8eQpocc7mn3+r/mu+WeUvn70yKJmvnI=
=FewI
-----END PGP SIGNATURE-----

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Léa Massiot <lm...@orange.fr>.
Thank you for yours answers.
@Glen Peterson: Thanks for sharing about the method you use.

Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025883.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 11/20/14 4:09 PM, Mark Eggers wrote:
> 
> Chris,
> 
> On 11/20/2014 12:11 PM, Christopher Schultz wrote:
>> Léa,
> 
>> On 11/20/14 1:21 PM, Léa Massiot wrote:
>>> Thank you for your answers.
> 
>>> @MarkEggers Thank you very much for sharing.
> 
>>>> Christopher Schultz wrote There are reasons to use jsvc, but 
>>>> the ability to run as a non-root uses is not one of them.
> 
>>> What are these reasons according to you (apart from running 
>>> Tomcat as a daemon on Unix which was also one of my goals at
>>> the time)?
> 
>> Several I can think of without spending too much time:
> 
>> 1. (by a large margin) Allows access to ports < 1024
> 
> This is not required. Use either su -c or runuser -c (if using 
> SELinux) to access ports < 1024.

Run as root? No thanks. Perhaps SELinux will allow a non-root user to
bind to low ports, but "normal" Linux does not.

>> 2. Automatic re-start of JVM process if the JVM exits
> 
> This is nice, especially for misbehaving web applications that
> cannot (or will not) be fixed.

True. But auto-restart is sometimes better than getting a page. ;)

>> 3. Control JVM process by sending signal to parent process
> 
> This is also nice, but reasonably written init scripts will do most
> of what is needed.

+1

>> 4. Enable rotation of stdout/stderr files
> 
> Without restarting, this is nice. There are several hacks you can
> do with logrotate that are useful, but they all have drawbacks.

+1

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUb3azAAoJEBzwKT+lPKRYw4oP/joQeMsxqkt7C5DBZnc1+cAE
uS4EKgN0Zua/BiJ+EwgUFYyH4wmZWz6piChdF9XUAszvKCpLK4PvW/ejcxq4sYh5
4W8tn6cnl6dZNXi8M/+fCRC+7BmBn6trlYgB38kAKrl2+WuhTycxS3hymiM5WduM
hhtlfY3C83IlvvZx0aTfjZLlRDzTA0v4w0/m1YKBtRMdOVpqtCZ78xXVyrAi8PFb
01XBPfVE6c9C5i9MIhgkB2ZykGnCOWOc4nEIS5oDS9n1tjrbOmLzwS4IvGIMPMDY
dXITCCf0byayMCJTYuEq2N5xIvmf0KYIvbaZ1EkjcoGWWT/8ZMOpxuHPlr1bhoXm
1ian4IxCX1KTMjONHcn18zEjkDspZVej/T3jfzU5Dkzy3C6jTHqQAMgco0tj6eg/
apCeouOMjMQLTO0rsBrjEHjs3PEJTdpIIPKZWJXwdIZqruObNZeagZy17/+P1Bw4
zbYtfNw8pOQDlELdFCJXXjRLS1GqsopNZn/LFfeRwXAwSniydiDMB34IATyj3/fB
mlcoCaXvl2ERUOvQmhRbS17JKaZx3NI8dW3BrjYVIPlrlmCtV28gTqHeYRTUeIdN
IUMUN9HVA4ludtAJW5i0Oy5/qE2GqZUBMQJ4/xttL33+zDiCW1xoR9XzTHnC4KzS
xeTab+/gvO/QeBZPoOfk
=1V0W
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Chris,

On 11/20/2014 12:11 PM, Christopher Schultz wrote:
> Léa,
> 
> On 11/20/14 1:21 PM, Léa Massiot wrote:
>> Thank you for your answers.
> 
>> @MarkEggers Thank you very much for sharing.
> 
>>> Christopher Schultz wrote There are reasons to use jsvc, but
>>> the ability to run as a non-root uses is not one of them.
> 
>> What are these reasons according to you (apart from running
>> Tomcat as a daemon on Unix which was also one of my goals at the
>> time)?
> 
> Several I can think of without spending too much time:
> 
> 1. (by a large margin) Allows access to ports < 1024

This is not required. Use either su -c or runuser -c (if using
SELinux) to access ports < 1024.

> 2. Automatic re-start of JVM process if the JVM exits

This is nice, especially for misbehaving web applications that cannot
(or will not) be fixed.

> 3. Control JVM process by sending signal to parent process

This is also nice, but reasonably written init scripts will do most of
what is needed.

> 4. Enable rotation of stdout/stderr files

Without restarting, this is nice. There are several hacks you can do
with logrotate that are useful, but they all have drawbacks.

> 
>> Also Excerpt from here: 
>> http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Unix_daemon 
>> "jsvc has other useful parameters, such as -user which causes it
>> to switch to another user after the daemon initialization is
>> complete. This allows, for example, running Tomcat as a non
>> privileged user while still being able to use privileged ports."
> 
> This is just a note about additional features, certainly not the 
> primary feature of jsvc.
> 
> -chris

. . . just my two cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJUblihAAoJEEFGbsYNeTwtQBMH/2fONQ2DF5PuZUtSihPwJEtG
GUov/q7jlsG4Ou5PG25czuL8s69eDPzpNX3BO3mrk5pIUb54UveJVz4ht8Xqq0B9
/1G9NWBb1Yx6lHDrXRdERACfxdQgpE4GuzJ8Uc0ZsLq+QMcdyBMXLYFrP3EPFXhn
bdiIL5VjsGXUhMWdmM2qaTfgXdMSCXsY5CWV80mk3Gi6KY1owv4EB69LMymXXYC3
+yz1PR3qujioMF72wNMF16Pk1VXcoaUSknt3+Gqgcp7UdNnqP1o8mmiARls/ij5F
F/KMlLPp3hpuLS/qVpr1kui/9G8bGzxzvdga1k9AY8AH1a1AhIOnK5W6PtGcBTU=
=Trk/
-----END PGP SIGNATURE-----

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Glen,

On 11/20/14 3:31 PM, Glen Peterson wrote:
> I never looked into jsvc.  It sounds very interesting!  To use a < 
> 1024 port as a non-root user, I've always used iptables to
> redirect traffic to a higher-numbered port.  When experimenting
> with iptables on a remote server, I actually like to schedule a
> reboot for 10 or 15 minutes, so that if I lock myself out, I can
> just wait a bit, then get back in without bothering anyone.

Some systems have "iptables-apply" which will save the existing rules,
apply the new ones, and then pause for a predetermined amount of time
so you can check to see that you can at least ssh back into the
server. After that timeout, it will roll-back the new iptables rules
unless you affirm that the changes should be saved.

So you can avoid the reboot-schedule and then having to cancel it.
It's just a bit more convenient.

> I hope that helps.  I have no idea about the pros and cons of
> iptables vs. jsvc for this.  I just know we were using iptables for
> security already, so this was a convenient way around the "root <
> 1024 port" restriction.

iptables does get you around the port number restrictions which is
most often the reason I hear of folks using jsvc.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUb3XIAAoJEBzwKT+lPKRYa2MP/jgGw1xG48kEB+/3/6B9QD1K
Dvf523PnOQA1GlnHIVnsABr7/LJmR/SCsOv3MPHt+il09JfA55XP76PO+ublNn5+
M09g/2xusRjK7F04O8g2wGYRBpVF3W6UIoR0xCzWo3TTVlTOxeJTi4QvGs4Hesmt
X1CnqXtgwZjZ0cXO+G+JKSFTG9zWckpI6s4Op4s+jBdo8Nw7mSOy3NNgIjfyZ0Xo
orc03eQnHfa2e0rYjB6lYZ2/tfiH0dZsP9qwAZmm63G1oGE+IAl9Z8VL2ze5G+xC
HDtBCCZQG2Ccly9iwlH8wdZPJD03uz9XrCk+Wvj6maDjMuskU5a8qLlOfpWZqPJo
Tg2i202pILY5YB/CJYBECqe7WK+8CUhyfiDnwNnmd3aolJylHj3imVweqbnbmtaQ
dgZGbIBNzw777dNKRv2yMkjhJ+TipcYOYuBDIIUoOHyYwNx8onq0IUqmpFVOH9ZA
+ZXtiII9co8EM5RMiXgXLvcbig56qilAsDrm6CoKCKZ0Y7juL0n5Oz2vfnT8AE88
bsAZzAOb9y4JvvH502H5YExxjLRna0IE+EZ3XsCHdEN8WjFGCe/fC4l/BWsmxE6Z
6BH+Tf+oK5bq14tU/VGtkk2VEA27E62weAGXu+PZei4roSvM4sGw6k8F6+jPgN75
3d5hACx4KQO/nifbdbzs
=8D0+
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Glen Peterson <gl...@organicdesign.org>.
I never looked into jsvc.  It sounds very interesting!  To use a <
1024 port as a non-root user, I've always used iptables to redirect
traffic to a higher-numbered port.  When experimenting with iptables
on a remote server, I actually like to schedule a reboot for 10 or 15
minutes, so that if I lock myself out, I can just wait a bit, then get
back in without bothering anyone.  But assuming that you are an
iptables pro already, here's the critical part.

# Allow an inbound packet to initiate an HTTPS session
$IPTABLES -A INPUT -p tcp -j ACCEPT --dport 443 -m state --state NEW
$IPTABLES -A INPUT -p tcp -j ACCEPT --dport 8443 -m state --state NEW

# Forward port 443 to 8443 where tomcat is listening as a non-root user
# Redirect for both ethernet cards for consistency.
$IPTABLES -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443

I hope that helps.  I have no idea about the pros and cons of iptables
vs. jsvc for this.  I just know we were using iptables for security
already, so this was a convenient way around the "root < 1024 port"
restriction.

Oh, and I put these rules in an /etc/init.d startup script, with the
proper dependencies, so that if the server is rebooted for some
reason, the web server automatically starts up on reboot (after all
its dependencies are satisfied).  That's saved me a number of
late-night headaches.

On Thu, Nov 20, 2014 at 3:11 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Léa,
>
> On 11/20/14 1:21 PM, Léa Massiot wrote:
>> Thank you for your answers.
>>
>> @MarkEggers Thank you very much for sharing.
>>
>>> Christopher Schultz wrote There are reasons to use jsvc, but the
>>> ability to run as a non-root uses is not one of them.
>>
>> What are these reasons according to you (apart from running Tomcat
>> as a daemon on Unix which was also one of my goals at the time)?
>
> Several I can think of without spending too much time:
>
> 1. (by a large margin) Allows access to ports < 1024
> 2. Automatic re-start of JVM process if the JVM exits
> 3. Control JVM process by sending signal to parent process
> 4. Enable rotation of stdout/stderr files
>
>> Also Excerpt from here:
>> http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Unix_daemon
>> "jsvc has other useful parameters, such as -user which causes it to
>> switch to another user after the daemon initialization is complete.
>> This allows, for example, running Tomcat as a non privileged user
>> while still being able to use privileged ports."
>
> This is just a note about additional features, certainly not the
> primary feature of jsvc.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJUbkrZAAoJEBzwKT+lPKRYjFAP/195ZdVNNt3h8nsR1/p2N5Lo
> 72pU7Zc15spYaQo3G7AfbvF/JMX4uAeR5nxHtvegU8YoIz+W8smb4MiipOfqFgn9
> CBr/+3hnu9kzsFkjMxj62mT8fPtdM/dYG6Er52aiSrjOCC62wPyOq7I4gf9RV8k/
> NmbkQugOrX1ZOyzGaHKSZODZHIGZSErW6jZQ8XC1K7AEjfez5enrAElkJ41h3MAx
> 02NeCNvs9sub/HMk2PCSSXpV4zGj7sUehc2Q/cNqHnVSh55EnENwJUZqpaP/4t6G
> rkNGYeEW31r1YTfTtDtCDTMz9bcVFWcbB8tJBXz+JaYtxI+xmcK9U4FBdKIZLDw5
> iF1IVJbAmbL6ANhnMBwlZEtwDtSfnDEpQCsVrTD7p/kbdW/wOnNpWzbJ14+bhBRi
> wsK+kiYNk0dqMByu81Yfx1e1ISByXydu+M96CxxJi+zTBwcg4qSEUQke9nfW0HNF
> YlgOVxPdHnjXHeid7xaTBjmqpFkwMSxguiaIvn6hO20aUo+jtOrz3YCNWIPC+Aih
> Da1LLhNzjVtxparX1cmsh5Xp/KsSe1lRP3AWmBRVe69tpUxHYjtr/ag8a5Mw5YOz
> Hd7Uc00irwWy/eewOJpDnVmLvnEhVwCSwJ8KQ4p3SyqLkyFSAlabic7A/4yRed/7
> sm+Kwyvimw/b7MjTL2Nr
> =pYTG
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



-- 
Glen K. Peterson
(828) 393-0081

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Léa,

On 11/20/14 1:21 PM, Léa Massiot wrote:
> Thank you for your answers.
> 
> @MarkEggers Thank you very much for sharing.
> 
>> Christopher Schultz wrote There are reasons to use jsvc, but the
>> ability to run as a non-root uses is not one of them.
> 
> What are these reasons according to you (apart from running Tomcat
> as a daemon on Unix which was also one of my goals at the time)?

Several I can think of without spending too much time:

1. (by a large margin) Allows access to ports < 1024
2. Automatic re-start of JVM process if the JVM exits
3. Control JVM process by sending signal to parent process
4. Enable rotation of stdout/stderr files

> Also Excerpt from here: 
> http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Unix_daemon 
> "jsvc has other useful parameters, such as -user which causes it to
> switch to another user after the daemon initialization is complete.
> This allows, for example, running Tomcat as a non privileged user
> while still being able to use privileged ports."

This is just a note about additional features, certainly not the
primary feature of jsvc.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUbkrZAAoJEBzwKT+lPKRYjFAP/195ZdVNNt3h8nsR1/p2N5Lo
72pU7Zc15spYaQo3G7AfbvF/JMX4uAeR5nxHtvegU8YoIz+W8smb4MiipOfqFgn9
CBr/+3hnu9kzsFkjMxj62mT8fPtdM/dYG6Er52aiSrjOCC62wPyOq7I4gf9RV8k/
NmbkQugOrX1ZOyzGaHKSZODZHIGZSErW6jZQ8XC1K7AEjfez5enrAElkJ41h3MAx
02NeCNvs9sub/HMk2PCSSXpV4zGj7sUehc2Q/cNqHnVSh55EnENwJUZqpaP/4t6G
rkNGYeEW31r1YTfTtDtCDTMz9bcVFWcbB8tJBXz+JaYtxI+xmcK9U4FBdKIZLDw5
iF1IVJbAmbL6ANhnMBwlZEtwDtSfnDEpQCsVrTD7p/kbdW/wOnNpWzbJ14+bhBRi
wsK+kiYNk0dqMByu81Yfx1e1ISByXydu+M96CxxJi+zTBwcg4qSEUQke9nfW0HNF
YlgOVxPdHnjXHeid7xaTBjmqpFkwMSxguiaIvn6hO20aUo+jtOrz3YCNWIPC+Aih
Da1LLhNzjVtxparX1cmsh5Xp/KsSe1lRP3AWmBRVe69tpUxHYjtr/ag8a5Mw5YOz
Hd7Uc00irwWy/eewOJpDnVmLvnEhVwCSwJ8KQ4p3SyqLkyFSAlabic7A/4yRed/7
sm+Kwyvimw/b7MjTL2Nr
=pYTG
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Léa Massiot <lm...@orange.fr>.
Thank you for your answers.

@MarkEggers
Thank you very much for sharing.

> Christopher Schultz wrote
> There are reasons to use jsvc, but the ability to run as a non-root uses
> is not one of them.

What are these reasons according to you (apart from running Tomcat as a
daemon on Unix which was also one of my goals at the time)?

Also Excerpt from here:
http://tomcat.apache.org/tomcat-7.0-doc/setup.html#Unix_daemon
"jsvc has other useful parameters, such as -user which causes it to switch
to another user after the daemon initialization is complete. This allows,
for example, running Tomcat as a non privileged user while still being able
to use privileged ports."

Thanks.
Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025674.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Léa,

On 11/20/14 10:24 AM, Léa Massiot wrote:
> Thank you for your answer.
> 
>> Konstantin Kolinko wrote: Why do you need the ports to be 80 and
>> 443? (You cannot open those on Linux unless you are a root). You
>> can a) change the port numbers in your configuration b) use
>> firewall (iptables) to map different local ports to those
>> external ones 
>> https://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F
>
>> 
> Well, apparently, according to the author of this article, I chose
> the best method (JSVC)! But thank you very much for pointing me
> towards this article and this FAQ which looks very interesting,
> full of interesting questions (and answers). Indeed the iptables
> solution looks attracting. I chose JSVC because I wanted Tomcat to
> be started at boot time and, if I'm not mistaken, this is root who
> runs the "/etc/init.d/" scripts including the "/etc/init.d/tomcat7"
> script... but I needed Tomcat to be run as a non-root user etc.
> etc.
> 
>> Konstantin Kolinko wrote: Also, 
>> https://wiki.apache.org/tomcat/FAQ/Linux_Unix#Q5
> 
> That's exactly what I did and I did it for exactly the same reasons
> given in this article. I didn't install the Tomcat Debian package. 
> I'm glad I did right.

We also run on Debian Linux and we do not use jsvc. We just use "su"
to run a command as a different user on startup. There are reasons to
use jsvc, but the ability to run as a non-root uses is not one of them.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUbiulAAoJEBzwKT+lPKRY/+oP/1jXK7B1AiEE7JT1U3TKKX7K
6xQg8+a/ZMyRtO/9zsheUz2h9Pvo/+aUCKOLeBfaDnJI5SCA92/6ag1cj/BZonlT
3EO1ExXIpjtYOwYTfVTBgAV5pgTJDpcbbUaAfyGEp1JEp4clm+T/fVFmYT+jqtru
mMVGWtrCXxALNBo/ot7nbSLUwRFuQZHtJ48lWHo1cTtq8YKe/LG8k/zZp0IafA7g
kxfRGk7rUN1XcfhhM3WCNv1bgcmcuQ52yjo+iEmsQI+tmiP+18D+WkE9+dv8ihM9
irhS79Tkclj0ytKOchm13lIspYSPbS/tRxnfitF4DNnRjZYKdyHSWyKNnO1HWcOc
r71K8NdacRG3EbOzoa7BDsaEU6q/dcnOc3Y5p/ALxZi5fGGciup0KOrSgh2DC+YN
TeppUGDmrHXo+yY/uWlRKdQeqHKeDcXn2ZYVyY35J7r6bI5xEQU4BtreA1nfVjUu
gYC+jUBqmEE4vbO3IMPg53881hBbi4CtSwJWrYP+qn8oQOqorhH9wnzW3PTcMy8x
0Esz73WKC/Yx6trFEftgrjU7g3yL/eij8vBQP+QnWHBhSjt7ydSlNACQ0VMskUAu
pZuVC9cOxyFmMTbKAludWlRjfgkvPP85kgaPw0La3FR3rreRDGnKg9EJ6QsPK/Ka
/hHoASHjDWLB0uNAAOli
=b7y2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Léa Massiot <lm...@orange.fr>.
Thank you for your answer.

> Konstantin Kolinko wrote:
> Why do you need the ports to be 80 and 443? (You cannot open those on
> Linux unless you are a root).
> You can
> a) change the port numbers in your configuration
> b) use firewall (iptables) to map different local ports to those external
> ones
> https://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F

Well, apparently, according to the author of this article, I chose the best
method (JSVC)!
But thank you very much for pointing me towards this article and this FAQ
which looks very interesting, full of interesting questions (and answers).
Indeed the iptables solution looks attracting.
I chose JSVC because I wanted Tomcat to be started at boot time and, 
if I'm not mistaken, this is root who runs the "/etc/init.d/" scripts
including the "/etc/init.d/tomcat7" script... 
but I needed Tomcat to be run as a non-root user etc. etc.

> Konstantin Kolinko wrote:
> Also,
> https://wiki.apache.org/tomcat/FAQ/Linux_Unix#Q5

That's exactly what I did and I did it for exactly the same reasons given in
this article.
I didn't install the Tomcat Debian package.
I'm glad I did right.

Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025663.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-11-20 13:56 GMT+03:00 Léa Massiot <lm...@orange.fr>:
> Thank you for your answer.
>
>> Konstantin Kolinko wrote:
>> Deployment can be done from Ant or from Maven. There exists tools for
>> that.
>
> Ok, I understand.
>
>> Konstantin Kolinko wrote:
>> If you are developing your web application, is there a reason why you
>> run Tomcat standalone and not from within Eclipse IDE?
>
> Here is why.
> On a Unix machine, I start Tomcat as a service, as a non-root user and via
> JSVC. (This is the "as a non-root user" part which is important here for
> me).
> Below is what I tried.
> First test:
> - remove "/etc/init.d/tomcat7" from "/etc/init.d/" and reboot the machine so
> that Tomcat is not automatically started at all (and so that I'm sure no
> other process is using the TCP ports 80 and 443) ;
> - run Eclipse as a non-root user ;
> - add a "local" Tomcat server to the Eclipse workspace ;
> - run a JSP on the server.
> => I get the error message:
> "Several ports (443, 80) required by Tomcat v7.0 Server at localhost are
> already in use. The server may already be running in another process, or a
> system process may be using the port. To start this server you will need to
> stop the other process or change the port number(s)."
>
> Second test:
> - run Eclipse as root ;
> - run a JSP on the server.
> => There is no error message anymore.
>
> BUT, I need to run Tomcat as a non-root user. In particular, I need it for
> subsequent operations made via the webapps deployed on the Tomcat server
> (for example: directories and files creations).
>
> This is the reason why I wanted to "use" the standalone Tomcat that is
> started via the "/etc/init.d/tomcat7" script.
>
> Usually, on my Windows development machine, I do not have these kind of
> issues.
> This is why I normally and usually use the Tomcat running on the Eclipse
> JVM.
>
> Does it make any sense?
> I wonder how people developing daily on a Unix machine do to debug their
> webapps in Eclipse as a non-root user.
> Maybe you do? I would totally be glad to know what is the usual practice.


Why do you need the ports to be 80 and 443? (You cannot open those on
Linux unless you are a root).

You can
a) change the port numbers in your configuration
b) use firewall (iptables) to map different local ports to those external ones
https://wiki.apache.org/tomcat/HowTo#How_to_run_Tomcat_without_root_privileges.3F

Also,
https://wiki.apache.org/tomcat/FAQ/Linux_Unix#Q5

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Léa Massiot <lm...@orange.fr>.
Thank you for your answer.

> Konstantin Kolinko wrote:
> Deployment can be done from Ant or from Maven. There exists tools for
> that. 

Ok, I understand.

> Konstantin Kolinko wrote:
> If you are developing your web application, is there a reason why you
> run Tomcat standalone and not from within Eclipse IDE? 

Here is why.
On a Unix machine, I start Tomcat as a service, as a non-root user and via
JSVC. (This is the "as a non-root user" part which is important here for
me).
Below is what I tried.
First test:
- remove "/etc/init.d/tomcat7" from "/etc/init.d/" and reboot the machine so
that Tomcat is not automatically started at all (and so that I'm sure no
other process is using the TCP ports 80 and 443) ;
- run Eclipse as a non-root user ;
- add a "local" Tomcat server to the Eclipse workspace ;
- run a JSP on the server.
=> I get the error message:
"Several ports (443, 80) required by Tomcat v7.0 Server at localhost are
already in use. The server may already be running in another process, or a
system process may be using the port. To start this server you will need to
stop the other process or change the port number(s)."

Second test:
- run Eclipse as root ;
- run a JSP on the server.
=> There is no error message anymore.

BUT, I need to run Tomcat as a non-root user. In particular, I need it for
subsequent operations made via the webapps deployed on the Tomcat server
(for example: directories and files creations).

This is the reason why I wanted to "use" the standalone Tomcat that is
started via the "/etc/init.d/tomcat7" script.

Usually, on my Windows development machine, I do not have these kind of
issues.
This is why I normally and usually use the Tomcat running on the Eclipse
JVM.

Does it make any sense?
I wonder how people developing daily on a Unix machine do to debug their
webapps in Eclipse as a non-root user.
Maybe you do? I would totally be glad to know what is the usual practice.

Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025651.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-11-19 22:06 GMT+03:00 Léa Massiot <lm...@orange.fr>:
> Thank you for your answer.
> Your link helped.
>
> What was missing from the scenario I described previously was:
> exporting the .war of the webapps into the Tomcat "webapps" directory.
>
> Actually, I was hoping it would be done automatically "somehow"... :'/
> Is there - by any chance - an option "somewhere" that I have been missing
> which would automatically export the webapps .war archives to the Tomcat
> "webapps" directory... at build time for instance?
> Hope my question is clear enough.


The proper temp is not "exporting", but "deployment".

Deployment can be done from Ant or from Maven. There exists tools for that.

If you are developing your web application, is there a reason why you
run Tomcat standalone and not from within Eclipse IDE?

https://wiki.apache.org/tomcat/FAQ/Developing#Q6

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Léa Massiot <lm...@orange.fr>.
Thank you for your answer.
Your link helped.

What was missing from the scenario I described previously was:
exporting the .war of the webapps into the Tomcat "webapps" directory.

Actually, I was hoping it would be done automatically "somehow"... :'/
Is there - by any chance - an option "somewhere" that I have been missing
which would automatically export the webapps .war archives to the Tomcat
"webapps" directory... at build time for instance?
Hope my question is clear enough.

Best regards.



--
View this message in context: http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025614.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

Posted by Mark Thomas <ma...@apache.org>.
On 19/11/2014 16:23, Léa Massiot wrote:
> Can you see what I'm doing wrong?

http://wiki.apache.org/tomcat/FAQ/Developing#Q1

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org