Re: Maybe a stupid (Windows related) question

2022-03-22 Thread Christopher Schultz

All,

On 3/22/22 15:12, Christopher Schultz wrote:

Rony,

On 3/22/22 13:21, Rony G. Flatscher (Apache) wrote:
For debugging purposes I downloaded the zip-version of Tomcat 10.0.18 
and start it up using

%CATALINA_HOME%\bin\startup.bat.

This will create by default a separate process (terminal, commandline 
window) in which Tomcat runs
and dispatches all output including stdout and stderr output into that 
window.


By contrast the Windows service installation would redirect stdout and 
stderr by default to
%CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-dd.log" and 
"tomcat10-stdout.-mm-dd.log" as
their name. The same would be desired for the "startup.bat" version of 
Tomcat 10.


Windows does not appear to have any of the following features woich 
would be required for that behavior:


1. nohup
2. backgrounding of CLI processes
3. shell-based redirection of stderr

I think you can achieve all of the above if you use catalina.sh from 
within bash-on-Windows, but I'm no expert.


You may also be able to do this kind of thing with a PowerShell script. 
Again, I'm no expert. But it couldn't be a .bat file, it'd have to be a 
.ps1 file instead.


Probably I have been doing something wrong in the past hours and not 
seeing the forest for the trees
anymore I kindly request help: what is needed to successfully redirect 
stderr and stdout to
%CATALINA_HOME%\logs after unzipping Tomcat 10 and starting it on 
Windows using

%CATALINA_HOME%\bin\startup.bat?


I don't believe this is possible. You may be able to somewhat simulate 
what you want by using:


C:> bin\catalina.bat run > stdout_and_stderr.log

But you won't get the C:> prompt back, and your cmd.exe window will have 
to stay open until you stop the Tomcat process.
Aaand, I'm already wrong. Windows CAN redirect both stdout and stderr to 
two different places, and also to combine them just like you can on *nix:


bin\catalina.bat run 2>&1 > stdout_stderr.log

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb490982(v=technet.10)?redirectedfrom=MSDN

You still can't really "background" the process the way you can on *nix. 
Sure, you can get your command-prompt back, but if you kill cmd.exe, so 
does your child process die. And if you log out, that process dies as well.


Using the Windows Service is really the best way to do it on Windows.

-chris


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



Re: Maybe a stupid (Windows related) question

2022-03-22 Thread Christopher Schultz

Rony,

On 3/22/22 13:21, Rony G. Flatscher (Apache) wrote:

For debugging purposes I downloaded the zip-version of Tomcat 10.0.18 and start 
it up using
%CATALINA_HOME%\bin\startup.bat.

This will create by default a separate process (terminal, commandline window) 
in which Tomcat runs
and dispatches all output including stdout and stderr output into that window.

By contrast the Windows service installation would redirect stdout and stderr 
by default to
%CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-dd.log" and 
"tomcat10-stdout.-mm-dd.log" as
their name. The same would be desired for the "startup.bat" version of Tomcat 
10.


Windows does not appear to have any of the following features woich 
would be required for that behavior:


1. nohup
2. backgrounding of CLI processes
3. shell-based redirection of stderr

I think you can achieve all of the above if you use catalina.sh from 
within bash-on-Windows, but I'm no expert.


You may also be able to do this kind of thing with a PowerShell script. 
Again, I'm no expert. But it couldn't be a .bat file, it'd have to be a 
.ps1 file instead.



Probably I have been doing something wrong in the past hours and not seeing the 
forest for the trees
anymore I kindly request help: what is needed to successfully redirect stderr 
and stdout to
%CATALINA_HOME%\logs after unzipping Tomcat 10 and starting it on Windows using
%CATALINA_HOME%\bin\startup.bat?


I don't believe this is possible. You may be able to somewhat simulate 
what you want by using:


C:> bin\catalina.bat run > stdout_and_stderr.log

But you won't get the C:> prompt back, and your cmd.exe window will have 
to stay open until you stop the Tomcat process.


Hope that helps,
-chris

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



RE: Maybe a stupid (Windows related) question

2022-03-22 Thread jonmcalexander
> -Original Message-
> From: Rony G. Flatscher (Apache) 
> Sent: Tuesday, March 22, 2022 12:21 PM
> To: users@tomcat.apache.org
> Subject: Maybe a stupid (Windows related) question
> 
> For debugging purposes I downloaded the zip-version of Tomcat 10.0.18 and
> start it up using %CATALINA_HOME%\bin\startup.bat.
> 
> This will create by default a separate process (terminal, commandline
> window) in which Tomcat runs and dispatches all output including stdout and
> stderr output into that window.
> 
> By contrast the Windows service installation would redirect stdout and stderr
> by default to %CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-
> dd.log" and "tomcat10-stdout.-mm-dd.log" as their name. The same
> would be desired for the "startup.bat" version of Tomcat 10.
> 
> Searched
>  doc/logging.html__;!!F9svGWnIaVPGSwU!73l7pAR1e6xCG3INKjeg0PnyhD7k
> yWl2kyHrFKAdlps4BB1jpO4ZbG-apDxsEvad_K823Jw$ > and
>  doc/setup.html__;!!F9svGWnIaVPGSwU!73l7pAR1e6xCG3INKjeg0PnyhD7ky
> Wl2kyHrFKAdlps4BB1jpO4ZbG-apDxsEvadogS4Vco$ > to no avail. Searching
> the Internet the best I could find was
>  ow-to-redirect-tomcat-console-log-to-files-tomcat-started-via-windows-
> bat__;!!F9svGWnIaVPGSwU!73l7pAR1e6xCG3INKjeg0PnyhD7kyWl2kyHrFKA
> dlps4BB1jpO4ZbG-apDxsEvadZtWA7FE$ > which indeed redirects the Tomcat
> startup information to %CATALINA_HOME%\logs\catalina.-mm-dd.log,
> but not stdout and stderr which do not get redirected.
> Using redirections directly in "startup.bat" or "catalina.bat" as suggested
> further down in the serverfault.com did not yield the desired redirection.
> 
> Probably I have been doing something wrong in the past hours and not
> seeing the forest for the trees anymore I kindly request help: what is needed
> to successfully redirect stderr and stdout to %CATALINA_HOME%\logs after
> unzipping Tomcat 10 and starting it on Windows using
> %CATALINA_HOME%\bin\startup.bat?
> 
> TIA for any help/pointer!
> 
> ---rony
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org

Would it not be best to use CATALINA_BASE instead of CATALINA_HOME? The idea 
being that HOME should be the binaries, and BASE is mobile Just my .02 
worth.

Thanks,



Dream * Excel * Explore * Inspire
Jon McAlexander
Infrastructure Engineer
Asst Vice President
He/His

Middleware Product Engineering
Enterprise CIO | EAS | Middleware | Infrastructure Solutions

8080 Cobblestone Rd | Urbandale, IA 50322
MAC: F4469-010
Tel 515-988-2508 | Cell 515-988-2508

jonmcalexan...@wellsfargo.com
This message may contain confidential and/or privileged information. If you are 
not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose, or take any action based on this message or any 
information herein. If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. Thank you for 
your cooperation.


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



Re: Maybe a stupid (Windows related) question

2022-03-22 Thread Noelette Stout
maybe redirect stderr to stdout then redirect to the log:  startup.bat 2>&1
1>yourFile.log
I believe that kind of redirection works in Windows as well as Linux (but
it's been a while since I had to do that sort of thing in Windows, so I may
be mistaken)

On Tue, Mar 22, 2022 at 11:26 AM Rob Sargent  wrote:

>
>
> On 3/22/22 11:21, Rony G. Flatscher (Apache) wrote:
> > For debugging purposes I downloaded the zip-version of Tomcat 10.0.18
> and start it up using
> > %CATALINA_HOME%\bin\startup.bat.
> >
> > This will create by default a separate process (terminal, commandline
> window) in which Tomcat runs
> > and dispatches all output including stdout and stderr output into that
> window.
> >
> > By contrast the Windows service installation would redirect stdout and
> stderr by default to
> > %CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-dd.log" and
> "tomcat10-stdout.-mm-dd.log" as
> > their name. The same would be desired for the "startup.bat" version of
> Tomcat 10.
> >
> > Searched  and
> >  to no avail.
> Searching the Internet the best
> > I could find
> > was
> > <
> https://serverfault.com/questions/252934/how-to-redirect-tomcat-console-log-to-files-tomcat-started-via-windows-bat
> >
> > which indeed redirects the Tomcat startup information to
> > %CATALINA_HOME%\logs\catalina.-mm-dd.log, but not stdout and stderr
> which do not get redirected.
> > Using redirections directly in "startup.bat" or "catalina.bat" as
> suggested further down in the
> > serverfault.com did not yield the desired redirection.
> >
> > Probably I have been doing something wrong in the past hours and not
> seeing the forest for the trees
> > anymore I kindly request help: what is needed to successfully redirect
> stderr and stdout to
> > %CATALINA_HOME%\logs after unzipping Tomcat 10 and starting it on
> Windows using
> > %CATALINA_HOME%\bin\startup.bat?
> >
> > TIA for any help/pointer!
> >
> > ---rony
> >
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> Maybe startup.bat > your.log
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

-- 
Noelette Stout
ITS Enterprise Applications - Senior Application Administrator
Idaho State University
E-mail: stounoel "at" isu "dot" edu
Desk: 208-282-2554


Re: Maybe a stupid (Windows related) question

2022-03-22 Thread Rob Sargent




On 3/22/22 11:21, Rony G. Flatscher (Apache) wrote:

For debugging purposes I downloaded the zip-version of Tomcat 10.0.18 and start 
it up using
%CATALINA_HOME%\bin\startup.bat.

This will create by default a separate process (terminal, commandline window) 
in which Tomcat runs
and dispatches all output including stdout and stderr output into that window.

By contrast the Windows service installation would redirect stdout and stderr 
by default to
%CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-dd.log" and 
"tomcat10-stdout.-mm-dd.log" as
their name. The same would be desired for the "startup.bat" version of Tomcat 
10.

Searched  and
 to no avail. Searching 
the Internet the best
I could find
was

which indeed redirects the Tomcat startup information to
%CATALINA_HOME%\logs\catalina.-mm-dd.log, but not stdout and stderr which 
do not get redirected.
Using redirections directly in "startup.bat" or "catalina.bat" as suggested 
further down in the
serverfault.com did not yield the desired redirection.

Probably I have been doing something wrong in the past hours and not seeing the 
forest for the trees
anymore I kindly request help: what is needed to successfully redirect stderr 
and stdout to
%CATALINA_HOME%\logs after unzipping Tomcat 10 and starting it on Windows using
%CATALINA_HOME%\bin\startup.bat?

TIA for any help/pointer!

---rony



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


Maybe startup.bat > your.log

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



Maybe a stupid (Windows related) question

2022-03-22 Thread Rony G. Flatscher (Apache)
For debugging purposes I downloaded the zip-version of Tomcat 10.0.18 and start 
it up using
%CATALINA_HOME%\bin\startup.bat.

This will create by default a separate process (terminal, commandline window) 
in which Tomcat runs
and dispatches all output including stdout and stderr output into that window.

By contrast the Windows service installation would redirect stdout and stderr 
by default to
%CATALINA_HOME%\logs\ using "tomcat10-stderr.yyy-mm-dd.log" and 
"tomcat10-stdout.-mm-dd.log" as
their name. The same would be desired for the "startup.bat" version of Tomcat 
10.

Searched  and
 to no avail. Searching 
the Internet the best
I could find
was

which indeed redirects the Tomcat startup information to
%CATALINA_HOME%\logs\catalina.-mm-dd.log, but not stdout and stderr which 
do not get redirected.
Using redirections directly in "startup.bat" or "catalina.bat" as suggested 
further down in the
serverfault.com did not yield the desired redirection.

Probably I have been doing something wrong in the past hours and not seeing the 
forest for the trees
anymore I kindly request help: what is needed to successfully redirect stderr 
and stdout to
%CATALINA_HOME%\logs after unzipping Tomcat 10 and starting it on Windows using
%CATALINA_HOME%\bin\startup.bat?

TIA for any help/pointer!

---rony



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



Re: Fwd: tomcat 9.50 - rewrite rule question

2022-03-22 Thread Christopher Schultz

All,

On 3/21/22 10:19, Felix Schumacher wrote:


Am 21.03.22 um 06:39 schrieb rupali singh:

Hi Felix,

location of context.xml file is

  cat context.xml| grep RewriteValve
 
  pwd
/opt/tomcat/apache-tomcat-9.0.54/instance/conf
That context.xml is thought to be a default template for all installed 
webapps. It will work, but remember, that every installed webapp will 
get its own copy of a rewrite valve.


+1

This is probably the problem.


more
/opt/tomcat/apache-tomcat-9.0.54/instance/webapps/ROOT/WEB-INF/rewrite.config
RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/apex/f$ /apex/myapp [R,L]



I think you want:

RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/f$ /myapp [R,L]

The prefix /apex is already a part of the context-path and should be 
removed from the URL patterns being matched. If you want to redirect to 
another web application, you need a fully-qualified redirect like this:


RewriteCond %{QUERY_STRING} p=10001
RewriteRule ^/f$ https://www.google.com/ [R,L]

-chris

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



Re: tomcat 9.50 - rewrite rule question

2022-03-22 Thread Christopher Schultz

Ripali,

On 3/20/22 14:13, rupali singh wrote:

i have tried below but its not working

RewriteRule ^/apex/f?p=1001  /apex/myapp [R,L]


What is the context-path of your web application?

-chris


On Sat, 19 Mar 2022 at 10:19, Jason Wee  wrote:


have you try?

RewriteRule ^/apex/f?p=1001  /apex/myapp [R,L]

On Sat, Mar 19, 2022 at 2:05 PM rupali singh 
wrote:


Hi Team,

We are using tomcat 9.54 version.
Need help in rewriting rule.

background   : We have an Oracle apex server ( version 21.1)  and tomcat

is

installed on the same server. We have F5 url which redirects to apex
installed on tomcat  eg https://xyz.ae/apex/f?p=1001
   so xyz.ae is published on our F5 which
redirects internally to tomcat server on port 8080.

we want to redirect  https://xyz.ae/apex/f?p=1001
   to
  https://xyz.ae/apex/myapp    as it's

difficult

for business users to remember f?p=1001 

i have prepared context.xml and rewrite.config rule but redirection not
working and there is no error in catalina.log

in access log we are getting 404.

i have tried steps mentioned in


https://stackoverflow.com/questions/38618473/tomcat-9-rewrite-with-ords-and-oracle-apex


rewrite.config content

RewriteCond %{REQUEST_URI} ^/myapp$
RewriteRule ^/myapp$ https://xyz.ae/apex/myapp [R,L]


please advise how to resolve the issue
--
Thanks and Regards,
Rupali


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






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



Re: [External] Re: RemoteAddrFilter (org.apache.catalina.filters)

2022-03-22 Thread Christopher Schultz

Tim,

On 3/22/22 05:33, Scott,Tim wrote:

Hi Chris and Mark,

Thank you both for your input.

I arrived at an sru.xml file in conf\Catalina\localhost, containing:










This means that private IPs (just those stating with 10.) can connect on port 
8443; any IP on port 8080. It’s there as a reminder that this can be done – my 
first test was limiting to (locahost);8443, similar to the example in the 
documentation, but allowed me to confirm that I can/cannot connect depending 
which port I use. This gave me confidence in the config.

Now I’m reminded why I wanted it to be configurable – it’s behind a load 
balancer in production and I don’t know what the load balancer is going to 
deliver as I don’t have one in my development environment. I also don’t know 
the network route the calling service will take.


If all requests (even "local" ones) will be going through the 
load-balancer (or even not, I guess), then you should configure the 
RemoteIpValve[1]. This will allow the load balancer to send you the 
original IP of the actual client through HTTP headers, and those will be 
used in log files, etc.


I *think* it will use those same remote IPs for your RemoteAddrValve, 
but you must make sure to have the RemoteIPValve configured to run 
*before* the RemoteAddrValve so that the addresses have a chance to be 
copied from those headers before they are evaluated for local-ness.


Ask your LB operator to enable the "X-Forwarded-For" header on the LB 
which is how that information it typically sent to back-end servers.


Hope that helps,
-chris

[1] 
https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Remote_IP_Valve




Thanks,
Tim

--
Tim Scott
OCLC · Senior Software Engineer / Technical Product Manager

cc: IT file

OCLC COVID-19 resources: 
oc.lc/covid19-service-info



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



[ANN] Apache Tomcat Native 1.2.32 released

2022-03-22 Thread Mark Thomas

The Apache Tomcat team announces the immediate availability of Apache
Tomcat Native 1.2.32 stable.

The key features of this release are:
- Windows binaries built using OpenSSL 1.1.1n

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/native-doc/miscellaneous/changelog.html

Downloads:
http://tomcat.apache.org/download-native.cgi

The Apache Tomcat Native Library provides portable API for features
not found in contemporary JDK's. It uses Apache Portable Runtime as
operating system abstraction layer and OpenSSL for SSL networking and
allows optimal performance in production environments.

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



RE: [External] Re: RemoteAddrFilter (org.apache.catalina.filters)

2022-03-22 Thread Scott,Tim
Hi Chris and Mark,

Thank you both for your input.

I arrived at an sru.xml file in conf\Catalina\localhost, containing:










This means that private IPs (just those stating with 10.) can connect on port 
8443; any IP on port 8080. It’s there as a reminder that this can be done – my 
first test was limiting to (locahost);8443, similar to the example in the 
documentation, but allowed me to confirm that I can/cannot connect depending 
which port I use. This gave me confidence in the config.

Now I’m reminded why I wanted it to be configurable – it’s behind a load 
balancer in production and I don’t know what the load balancer is going to 
deliver as I don’t have one in my development environment. I also don’t know 
the network route the calling service will take.

Thanks,
Tim

--
Tim Scott
OCLC · Senior Software Engineer / Technical Product Manager

cc: IT file

OCLC COVID-19 resources: 
oc.lc/covid19-service-info