Re: AW: Maybe a stupid (Windows related) question

2022-03-23 Thread Konstantin Kolinko
ср, 23 мар. 2022 г. в 14:12, Rony G. Flatscher (Apache) :
>
> skip...
>
> startup.bat uses start to run catalina.bat in a new cmd window with:
>
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> catalina.bat then starts Tomcat as:
>
> %_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% 
> %CATALINA_OPTS% %DEBUG_OPTS%
> -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%"
> -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
> -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% 2>&1 1>
> D:\orx.debug\work_rii_tomcat\test.log
>
> This does not work.

(It does not matter, but you somehow lost "%ACTION%" at the end of the
above line.)

If I prefix the above line with "echo" to see what command is being
executed, like this:

echo %_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER%
%JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS%
-D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%"
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
-Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS%
%ACTION% 1>>mylog.txt 2>&1

then I get the following results:

a) After calling "startup.bat" or "catalina.bat start" I see the
following in mylog.txt:

start "Tomcat" "C:\pathtojava\java.exe" .
org.apache.catalina.startup.Bootstrap start

b) After calling "catalina.bat run" I see the following:

"C:\pathtojava\java.exe" . org.apache.catalina.startup.Bootstrap start

Note the difference.

It is the "start" command that creates a new window.  The "call"
command that you mentioned is just a command to execute a different
batch file and return to continue executing the original batch file.

BTW, commands "help start" and "help call" print some reference for
those commands.


Looking at the reference for "start", I think your only option is to
use "catalina.bat run" to start Tomcat. When I do so, the redirection
works as expected.


The following also works, without any modifications to the catalina.bat file:

catalina.bat run 1>>mylog.txt 2>&1

or with remote debugging being enabled:

catalina.bat jpda run 1>>mylog.txt 2>&1

Best regards,
Konstantin Kolinko

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



Re: Unknown http2 settings is logged with wrong settings key

2022-03-23 Thread Rémy Maucherat
On Wed, Mar 23, 2022 at 8:28 PM Thomas Hoffmann (Speed4Trade GmbH)
 wrote:
>
>
>
> > -Ursprüngliche Nachricht-
> > Von: Christopher Schultz 
> > Gesendet: Mittwoch, 23. März 2022 16:56
> > An: users@tomcat.apache.org
> > Betreff: Re: Unknown http2 settings is logged with wrong settings key
> >
> > Thomas,
> >
> > On 3/23/22 10:13, Thomas Hoffmann (Speed4Trade GmbH) wrote:
> > > Hello,
> > >
> > > I got some warnings logged from http2 protocol and the logged values
> > seem to be wrong.
> > > If an unknown http2 settings is received, it logs the key and the value to
> > the logfile:
> > >
> > > /org/apache/coyote/http2/ConnectionSettingsBase.java, line 90:
> > >
> > >  case UNKNOWN:
> > >  // Unrecognised. Ignore it.
> > >  log.warn(sm.getString("connectionSettings.unknown",
> > >  connectionId, setting, Long.toString(value)));
> > >  return;
> > >
> > > The value of the settings-variable was unfortunately converted before
> > > to Integer.MAX_VALUE within the settings.java
> > >
> > > enum Setting {
> > >  HEADER_TABLE_SIZE(1),
> > >  ENABLE_PUSH(2),
> > >  MAX_CONCURRENT_STREAMS(3),
> > >  INITIAL_WINDOW_SIZE(4),
> > >  MAX_FRAME_SIZE(5),
> > >  MAX_HEADER_LIST_SIZE(6),
> > >  UNKNOWN(Integer.MAX_VALUE);
> > >
> > > Thus, the logfile doesn’t contain the received, unknown settings-key but
> > MAX_VALUE instead.
> > >
> > > Is it possible to log the real settings key, which was received by the 
> > > server?
> > > Maybe the logging can be moved to the Setting.java instead or the real
> > > key value would have to be transferred to the function which logs(?)
> >
> > I think the existing log can probably just be fixed, no? Want to take a 
> > stab at
> > writing a PR for this?
> >
> > -chris
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
>
> Hello Chris,
>
> I forked tomcat and commited/pushed a change.
> Somehow I got lost with the pull request. I haven’t created one yet because I 
> committed one file which shouldn’t be contained in the commit.
> But somehow the commit was already authored (?)
> Not sure if I messed up something up to now.
>
> Can I create a pull request even if one file (gitignore) was accidentally 
> contained in the commit?
> How can my push already be authored before any pull request?
> https://github.com/HoffmannTom/tomcat/commit/6da6f9444192a1ca1d8d0eda1c6694b7c12451ef

In your patch, you are still logging Setting.UNKNOWN:
Setting key = Setting.valueOf(id);
if (log.isDebugEnabled() && key == Setting.UNKNOWN) {
log.warn(sm.getString("connectionSettings.unknown",
connectionId, key, Long.toString(value)));
}

Instead, you should be logging the original id:
log.warn(sm.getString("connectionSettings.unknown",
connectionId, Integer.toString(id),
Long.toString(value)));

Rémy

> Could you help me out how to continue?
> If my change is a mess, then you can tell me and I skip the pull request.
>
> Thanks! Thomas
>
>

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



Re: Unknown http2 settings is logged with wrong settings key

2022-03-23 Thread Rémy Maucherat
On Wed, Mar 23, 2022 at 8:28 PM Thomas Hoffmann (Speed4Trade GmbH)
 wrote:
>
>
>
> > -Ursprüngliche Nachricht-
> > Von: Christopher Schultz 
> > Gesendet: Mittwoch, 23. März 2022 16:56
> > An: users@tomcat.apache.org
> > Betreff: Re: Unknown http2 settings is logged with wrong settings key
> >
> > Thomas,
> >
> > On 3/23/22 10:13, Thomas Hoffmann (Speed4Trade GmbH) wrote:
> > > Hello,
> > >
> > > I got some warnings logged from http2 protocol and the logged values
> > seem to be wrong.
> > > If an unknown http2 settings is received, it logs the key and the value to
> > the logfile:
> > >
> > > /org/apache/coyote/http2/ConnectionSettingsBase.java, line 90:
> > >
> > >  case UNKNOWN:
> > >  // Unrecognised. Ignore it.
> > >  log.warn(sm.getString("connectionSettings.unknown",
> > >  connectionId, setting, Long.toString(value)));
> > >  return;
> > >
> > > The value of the settings-variable was unfortunately converted before
> > > to Integer.MAX_VALUE within the settings.java
> > >
> > > enum Setting {
> > >  HEADER_TABLE_SIZE(1),
> > >  ENABLE_PUSH(2),
> > >  MAX_CONCURRENT_STREAMS(3),
> > >  INITIAL_WINDOW_SIZE(4),
> > >  MAX_FRAME_SIZE(5),
> > >  MAX_HEADER_LIST_SIZE(6),
> > >  UNKNOWN(Integer.MAX_VALUE);
> > >
> > > Thus, the logfile doesn’t contain the received, unknown settings-key but
> > MAX_VALUE instead.
> > >
> > > Is it possible to log the real settings key, which was received by the 
> > > server?
> > > Maybe the logging can be moved to the Setting.java instead or the real
> > > key value would have to be transferred to the function which logs(?)
> >
> > I think the existing log can probably just be fixed, no? Want to take a 
> > stab at
> > writing a PR for this?
> >
> > -chris
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
>
> Hello Chris,
>
> I forked tomcat and commited/pushed a change.
> Somehow I got lost with the pull request. I haven’t created one yet because I 
> committed one file which shouldn’t be contained in the commit.
> But somehow the commit was already authored (?)
> Not sure if I messed up something up to now.
>
> Can I create a pull request even if one file (gitignore) was accidentally 
> contained in the commit?
> How can my push already be authored before any pull request?
> https://github.com/HoffmannTom/tomcat/commit/6da6f9444192a1ca1d8d0eda1c6694b7c12451ef
>
> Could you help me out how to continue?
> If my change is a mess, then you can tell me and I skip the pull request.

I had a look a little bit earlier and I also thought this was the way
to improve that logging.

Rémy

> Thanks! Thomas
>
>

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



AW: Unknown http2 settings is logged with wrong settings key

2022-03-23 Thread Thomas Hoffmann (Speed4Trade GmbH)


> -Ursprüngliche Nachricht-
> Von: Christopher Schultz 
> Gesendet: Mittwoch, 23. März 2022 16:56
> An: users@tomcat.apache.org
> Betreff: Re: Unknown http2 settings is logged with wrong settings key
> 
> Thomas,
> 
> On 3/23/22 10:13, Thomas Hoffmann (Speed4Trade GmbH) wrote:
> > Hello,
> >
> > I got some warnings logged from http2 protocol and the logged values
> seem to be wrong.
> > If an unknown http2 settings is received, it logs the key and the value to
> the logfile:
> >
> > /org/apache/coyote/http2/ConnectionSettingsBase.java, line 90:
> >
> >  case UNKNOWN:
> >  // Unrecognised. Ignore it.
> >  log.warn(sm.getString("connectionSettings.unknown",
> >  connectionId, setting, Long.toString(value)));
> >  return;
> >
> > The value of the settings-variable was unfortunately converted before
> > to Integer.MAX_VALUE within the settings.java
> >
> > enum Setting {
> >  HEADER_TABLE_SIZE(1),
> >  ENABLE_PUSH(2),
> >  MAX_CONCURRENT_STREAMS(3),
> >  INITIAL_WINDOW_SIZE(4),
> >  MAX_FRAME_SIZE(5),
> >  MAX_HEADER_LIST_SIZE(6),
> >  UNKNOWN(Integer.MAX_VALUE);
> >
> > Thus, the logfile doesn’t contain the received, unknown settings-key but
> MAX_VALUE instead.
> >
> > Is it possible to log the real settings key, which was received by the 
> > server?
> > Maybe the logging can be moved to the Setting.java instead or the real
> > key value would have to be transferred to the function which logs(?)
> 
> I think the existing log can probably just be fixed, no? Want to take a stab 
> at
> writing a PR for this?
> 
> -chris
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org

Hello Chris,

I forked tomcat and commited/pushed a change.
Somehow I got lost with the pull request. I haven’t created one yet because I 
committed one file which shouldn’t be contained in the commit.
But somehow the commit was already authored (?)
Not sure if I messed up something up to now.

Can I create a pull request even if one file (gitignore) was accidentally 
contained in the commit?
How can my push already be authored before any pull request?
https://github.com/HoffmannTom/tomcat/commit/6da6f9444192a1ca1d8d0eda1c6694b7c12451ef

Could you help me out how to continue?
If my change is a mess, then you can tell me and I skip the pull request.

Thanks! Thomas




Re: AW: Maybe a stupid (Windows related) question

2022-03-23 Thread Rony G. Flatscher (Apache)
On 23.03.2022 18:21, EXT-Denton, Sam T wrote:
> I believe that "2>&1 1>D:\orx.debug\work_rii_tomcat\test.log" will first 
> redirect stderr to stdout, and then redirect stdout to the file, leaving 
> stderr pointing to the original stdout, which is presumably the terminal.
>
> Try "1>D:\orx.debug\work_rii_tomcat\test.log 2>&1"

Thank you, this does not change the behaviour.

---rony


>
>
> -Original Message-
> From: Rony G. Flatscher (Apache)  
> Sent: Wednesday, March 23, 2022 6:12 AM
> To: users@tomcat.apache.org
> Subject: Re: AW: Maybe a stupid (Windows related) question
>
> On 23.03.2022 11:45, Thomas Hoffmann (Speed4Trade GmbH) wrote:
>>> -Ursprüngliche Nachricht-
>>> Von: Rony G. Flatscher (Apache) 
>>> Gesendet: Mittwoch, 23. März 2022 11:34
>>> An: users@tomcat.apache.org
>>> Betreff: Re: Maybe a stupid (Windows related) question
>>>
>>> On 22.03.2022 20:18, Christopher Schultz wrote:
>>>
>>> ... cut ...
>>>
 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.
>>>
>>> The problem is different: redirecting stderr and stdout does not redirect in
>>> this scenario (employing %CATALINA_HOME%\bin\startup.bat), rather
>>> output statements to stderr
>>> (System.err.println(...)) and stdout (System.out.println(...)) gets still
>>> displayed in the Tomcat window.
>>>
>>> This involves (at least in my experiments) editing bin\startup.bat and/or
>>> bin\catalina.bat which should not be necessary if understanding Tomcat's
>>> philsophy correctly. If adjustments are necessary it is advised to supply a
>>> "bin\setup.bat" script to do so.
>>>
>>> So what I would be looking for is either a configuration change or an
>>> environment variable to set which allows redirecting stdout and stderr to
>>> appropriate log files as is done with the service version by default.
>>>
 Using the Windows Service is really the best way to do it on Windows.
>>> The use case is testing Tomcat 10 in various ways, including running it in
>>> debug mode and attaching via IntelliJ for inspection.
>>>
>>> ---rony
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> The bat-file uses the line:
>> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>>
>> At this place you might be able to redirect the output:
>> call "%EXECUTABLE%" start %CMD_LINE_ARGS%  > out.log
>>
>> You could also try to pass the redirect param to the argument of 
>> startup.bat, don’t know if this works, e.g.
>> startup.bat " > out.log"
> startup.bat uses start to run catalina.bat in a new cmd window with:
>
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> catalina.bat then starts Tomcat as:
>
> %_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% 
> %CATALINA_OPTS% %DEBUG_OPTS%
> -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%"
> -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
> -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% 2>&1 1>
> D:\orx.debug\work_rii_tomcat\test.log
>
> This does not work.
>
> ---rony
>
>

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



RE: AW: Maybe a stupid (Windows related) question

2022-03-23 Thread EXT-Denton, Sam T
I believe that "2>&1 1>D:\orx.debug\work_rii_tomcat\test.log" will first 
redirect stderr to stdout, and then redirect stdout to the file, leaving stderr 
pointing to the original stdout, which is presumably the terminal.

Try "1>D:\orx.debug\work_rii_tomcat\test.log 2>&1"


-Original Message-
From: Rony G. Flatscher (Apache)  
Sent: Wednesday, March 23, 2022 6:12 AM
To: users@tomcat.apache.org
Subject: Re: AW: Maybe a stupid (Windows related) question

On 23.03.2022 11:45, Thomas Hoffmann (Speed4Trade GmbH) wrote:
>> -Ursprüngliche Nachricht-
>> Von: Rony G. Flatscher (Apache) 
>> Gesendet: Mittwoch, 23. März 2022 11:34
>> An: users@tomcat.apache.org
>> Betreff: Re: Maybe a stupid (Windows related) question
>>
>> On 22.03.2022 20:18, Christopher Schultz wrote:
>>
>> ... cut ...
>>
>>> 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.
>>
>> The problem is different: redirecting stderr and stdout does not redirect in
>> this scenario (employing %CATALINA_HOME%\bin\startup.bat), rather
>> output statements to stderr
>> (System.err.println(...)) and stdout (System.out.println(...)) gets still
>> displayed in the Tomcat window.
>>
>> This involves (at least in my experiments) editing bin\startup.bat and/or
>> bin\catalina.bat which should not be necessary if understanding Tomcat's
>> philsophy correctly. If adjustments are necessary it is advised to supply a
>> "bin\setup.bat" script to do so.
>>
>> So what I would be looking for is either a configuration change or an
>> environment variable to set which allows redirecting stdout and stderr to
>> appropriate log files as is done with the service version by default.
>>
>>> Using the Windows Service is really the best way to do it on Windows.
>> The use case is testing Tomcat 10 in various ways, including running it in
>> debug mode and attaching via IntelliJ for inspection.
>>
>> ---rony
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> The bat-file uses the line:
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> At this place you might be able to redirect the output:
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%  > out.log
>
> You could also try to pass the redirect param to the argument of startup.bat, 
> don’t know if this works, e.g.
> startup.bat " > out.log"

startup.bat uses start to run catalina.bat in a new cmd window with:

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

catalina.bat then starts Tomcat as:

%_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% 
%CATALINA_OPTS% %DEBUG_OPTS%
-D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%"
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
-Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% 2>&1 1>
D:\orx.debug\work_rii_tomcat\test.log

This does not work.

---rony



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



Re: Unknown http2 settings is logged with wrong settings key

2022-03-23 Thread Christopher Schultz

Thomas,

On 3/23/22 10:13, Thomas Hoffmann (Speed4Trade GmbH) wrote:

Hello,

I got some warnings logged from http2 protocol and the logged values seem to be 
wrong.
If an unknown http2 settings is received, it logs the key and the value to the 
logfile:

/org/apache/coyote/http2/ConnectionSettingsBase.java, line 90:

 case UNKNOWN:
 // Unrecognised. Ignore it.
 log.warn(sm.getString("connectionSettings.unknown",
 connectionId, setting, Long.toString(value)));
 return;

The value of the settings-variable was unfortunately converted before to 
Integer.MAX_VALUE within the settings.java

enum Setting {
 HEADER_TABLE_SIZE(1),
 ENABLE_PUSH(2),
 MAX_CONCURRENT_STREAMS(3),
 INITIAL_WINDOW_SIZE(4),
 MAX_FRAME_SIZE(5),
 MAX_HEADER_LIST_SIZE(6),
 UNKNOWN(Integer.MAX_VALUE);

Thus, the logfile doesn’t contain the received, unknown settings-key but 
MAX_VALUE instead.

Is it possible to log the real settings key, which was received by the server?
Maybe the logging can be moved to the Setting.java instead or the real key 
value would have to be transferred to the function which logs(?)


I think the existing log can probably just be fixed, no? Want to take a 
stab at writing a PR for this?


-chris

-
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-23 Thread Felix Schumacher



Am 23. März 2022 12:14:25 MEZ schrieb rupali singh :
>Hi Chris,
>
>I already tried with fully qualified name but its not working

Can you be more specific, what you tried?

Is Chris right and your context name is apex? 

Felix
>
>On Tue, Mar 22, 2022, 7:15 PM Christopher Schultz <
>ch...@christopherschultz.net> wrote:
>
>> 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
>>
>>

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



Unknown http2 settings is logged with wrong settings key

2022-03-23 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello,

I got some warnings logged from http2 protocol and the logged values seem to be 
wrong.
If an unknown http2 settings is received, it logs the key and the value to the 
logfile:

/org/apache/coyote/http2/ConnectionSettingsBase.java, line 90:

case UNKNOWN:
// Unrecognised. Ignore it.
log.warn(sm.getString("connectionSettings.unknown",
connectionId, setting, Long.toString(value)));
return;

The value of the settings-variable was unfortunately converted before to 
Integer.MAX_VALUE within the settings.java

enum Setting {
HEADER_TABLE_SIZE(1),
ENABLE_PUSH(2),
MAX_CONCURRENT_STREAMS(3),
INITIAL_WINDOW_SIZE(4),
MAX_FRAME_SIZE(5),
MAX_HEADER_LIST_SIZE(6),
UNKNOWN(Integer.MAX_VALUE);

Thus, the logfile doesn’t contain the received, unknown settings-key but 
MAX_VALUE instead.

Is it possible to log the real settings key, which was received by the server?
Maybe the logging can be moved to the Setting.java instead or the real key 
value would have to be transferred to the function which logs(?)

Greetings, Thomas


Re: Maybe a stupid (Windows related) question

2022-03-23 Thread Rony G. Flatscher (Apache)
On 23.03.2022 13:22, Mark Thomas wrote:
> On 23/03/2022 10:34, Rony G. Flatscher (Apache) wrote:
>> The use case is testing Tomcat 10 in various ways, including running it in 
>> debug mode and attaching
>> via IntelliJ for inspection.
>
> You can still do this when Tomcat is running as a service. Just set the 
> appropriate properties.

Yes, looks like I will have to do it that way.

(Currently I have a Tomcat 10 service installation that I shutdown and then run 
a different (newer),
separate Tomcat installation for testing purposes for which I need the 
redirection of stdout and
stderr.)

---rony



-
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-23 Thread Mark Thomas

On 23/03/2022 10:34, Rony G. Flatscher (Apache) wrote:

The use case is testing Tomcat 10 in various ways, including running it in 
debug mode and attaching
via IntelliJ for inspection.


You can still do this when Tomcat is running as a service. Just set the 
appropriate properties.


Mark

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



Re: What causes "client errors" with mod_jk

2022-03-23 Thread Christopher Schultz

All,

On 3/23/22 08:08, Christopher Schultz wrote:
What kinds of things will cause a "client error" in mod_jk's accounting? 
Does that mean things like unexpected disconnects on the part of the 
remote client (i.e. web browser), or does it mean failure of the jk 
module itself to connect (as a client) to the back-end Tomcat?


I'm starting to see situations where we have small numbers of client 
errors occurring "all the time", meaning that we accumulate maybe 10-20 
per day. If that's web browser disconnects then I don't care at all. If 
it's a problem I have with my internal networking and 
resource-allocation, then it's something I have to adjust.


I have items such as these in the mod_jk.log file:

[Wed Mar 23 12:07:36.192 2022] [22062:140330401956416] [info] 
ajp_process_callback::jk_ajp_common.c (2077): (myworker) Writing to 
client aborted or client network problems
[Wed Mar 23 12:07:36.192 2022] [22062:140330401956416] [info] 
ajp_service::jk_ajp_common.c (2773): (myworker) sending request to 
tomcat failed (unrecoverable), because of client write error (attempt=1)
[Wed Mar 23 12:07:36.194 2022] [22062:140330401956416] [info] 
service::jk_lb_worker.c (1595): service failed, worker myworker is in 
local error state
[Wed Mar 23 12:07:36.194 2022] [22062:140330401956416] [info] 
service::jk_lb_worker.c (1614): unrecoverable error 200, request failed. 
Client failed in the middle of request, we can't recover to another 
instance.
[Wed Mar 23 12:07:36.194 2022] [22062:140330401956416] [info] 
jk_handler::mod_jk.c (2984): Aborting connection for worker=myworker


Those messages are somewhat confusing because some of them seem to 
indicate that the remote client (i.e. web browser) is gone, but then I 
see "worker myworker is in local error state" which looks like mod_jk is 
considering this *worker* to be in an error-state, meaning that it would 
direct traffic to another worker. I'm not seeing the worker being put 
into an ERR state. Is that log message just misleading?


Thanks,
-chris

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



What causes "client errors" with mod_jk

2022-03-23 Thread Christopher Schultz

All,

What kinds of things will cause a "client error" in mod_jk's accounting? 
Does that mean things like unexpected disconnects on the part of the 
remote client (i.e. web browser), or does it mean failure of the jk 
module itself to connect (as a client) to the back-end Tomcat?


I'm starting to see situations where we have small numbers of client 
errors occurring "all the time", meaning that we accumulate maybe 10-20 
per day. If that's web browser disconnects then I don't care at all. If 
it's a problem I have with my internal networking and 
resource-allocation, then it's something I have to adjust.


Thanks,
-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-23 Thread Rony G. Flatscher (Apache)

On 23.03.2022 12:11, Rony G. Flatscher (Apache) wrote:
> On 23.03.2022 11:51, Konstantin Kolinko wrote:
>> вт, 22 мар. 2022 г. в 20:21, 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.
>>>
>>> 
>>>
>>> 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!
>> First, I second Chris's answer
>>
>> вт, 22 мар. 2022 г. в 22:19, Christopher Schultz 
>> :
>>> 
>>>
>>> ... 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
>>>
>> Note that
>> "startup.bat" is an equivalent of calling "catalina.bat start".
>> "shutdown.bat" is an equivalent of "catalina.bat stop".
>>
>> The above command (with " run") is a different one:
>> it starts Tomcat in the same console window, as opposed to " start"
>> that opens a new console window.
>>
>> Second,
>> To redirect java.util.logging output to a file, replace ConsoleHandler
>> in conf/logging.properties with a FileHandler that writes all those
>> log lines to a file.
>>
>> Actually, logging.properties already has such a FileHandler
>> configured. See the following line:
>>
>> .handlers = 1catalina.org.apache.juli.AsyncFileHandler,
>> java.util.logging.ConsoleHandler
>>
>> It configures handlers for "." (the root). So all the same information
>> is also being written to a "1catalina" FileHandler. Removing the
>> "ConsoleHandler" from that line will stop duplicating all those log
>> messages to the console.
> The %CATALINA_HOME%\conf\logging.properties got changed according to
> 
> as:
>
> handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> 2localhost.org.apache.juli.AsyncFileHandler, 
> 3manager.org.apache.juli.Async
> FileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, 
> java.util.logging.ConsoleHandler
>
> # .handlers = 1catalina.org.apache.juli.AsyncFileHandler, 
> java.util.logging.ConsoleHandler
>
> .handlers = 1catalina.org.apache.juli.AsyncFileHandler
>
> ... cut ...
>
> Still stdout and stderr goes to the console. The redirection "2>&1 >test.log" 
> creates the empty file
> but no output is there.
>
>> Third,
>> If you app is actually calling System.err.println(), see about
>> "swallowOutput" setting here
>> https://tomcat.apache.org/tomcat-10.0-doc/logging.html#Console
>> https://tomcat.apache.org/tomcat-10.0-doc/config/context.html
> Will try that next thank you!

Tried two ways:

  * %CATALINA_HOME%\conf\context.xml adding attribute, so " only

Did not make a difference.

Having permutated so many different things I will delete everything and start 
over with a pristine
unzipped Tomcat 10 to see if that makes a difference.

---rony




Re: Fwd: tomcat 9.50 - rewrite rule question

2022-03-23 Thread rupali singh
Hi Chris,

I already tried with fully qualified name but its not working

On Tue, Mar 22, 2022, 7:15 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> 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: Problems deploying new .war application on Linux

2022-03-23 Thread Scott,Tim
Hi all,

If only for the email archives – just a note to say that I have not yet found a 
solution.

Thanks,
Tim

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

cc: IT file

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

From: Scott,Tim
Sent: Tuesday, March 15, 2022 2:45 PM
To: 'Tomcat Users List' 
Subject: RE: Problems deploying new .war application on Linux

Hi Thomas,

> Another approach is to do remote debugging and step into the class with the 
> error 
> (javax.enterprise.inject.se.SeContainerInitializer.findSeContainerInitializer)
I set an Exception breakpoint on IllegalStateException and this opened the 
class for me to set a breakpoint prior to the exception.

When I retried that, I can see that the ServiceLoader is passed:
ParallelWebappClassLoader
  context: sru
  delegate: false
--> Parent Classloader:
java.net.URLClassLoader@1623b78d

Under loader / resources / classResources, the list includes:
#37 = 
file:/app/dev/tomcat/webapps/sru/WEB-INF/lib/jakarta.enterprise.cdi-api-3.0.0.jar
#51 = file:/app/dev/tomcat/webapps/sru/WEB-INF/lib/cdi-api-2.0.SP1.jar
#52 = file:/app/dev/tomcat/webapps/sru/WEB-INF/lib/jersey-cdi2-se-2.34.jar

When I compare this with a breakpoint prior to that exception, deployed on my 
PC, the breakpoint is never reached.

When I set a breakpoint in the ServiceLoader class/load() method on my PC and 
skip through to each pause I can see that it does not get called to find 
SeContainerInitializer.

I had hoped to compare the ClassLoader passed in to ServiceLoader.load() to 
help pin down the problem. I had not expected an absence of a call to the 
method!

Any further ideas?

Thanks,
Tim

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

cc: IT file

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



Re: AW: Maybe a stupid (Windows related) question

2022-03-23 Thread Rony G. Flatscher (Apache)
On 23.03.2022 11:45, Thomas Hoffmann (Speed4Trade GmbH) wrote:
>> -Ursprüngliche Nachricht-
>> Von: Rony G. Flatscher (Apache) 
>> Gesendet: Mittwoch, 23. März 2022 11:34
>> An: users@tomcat.apache.org
>> Betreff: Re: Maybe a stupid (Windows related) question
>>
>> On 22.03.2022 20:18, Christopher Schultz wrote:
>>
>> ... cut ...
>>
>>> 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.
>>
>> The problem is different: redirecting stderr and stdout does not redirect in
>> this scenario (employing %CATALINA_HOME%\bin\startup.bat), rather
>> output statements to stderr
>> (System.err.println(...)) and stdout (System.out.println(...)) gets still
>> displayed in the Tomcat window.
>>
>> This involves (at least in my experiments) editing bin\startup.bat and/or
>> bin\catalina.bat which should not be necessary if understanding Tomcat's
>> philsophy correctly. If adjustments are necessary it is advised to supply a
>> "bin\setup.bat" script to do so.
>>
>> So what I would be looking for is either a configuration change or an
>> environment variable to set which allows redirecting stdout and stderr to
>> appropriate log files as is done with the service version by default.
>>
>>> Using the Windows Service is really the best way to do it on Windows.
>> The use case is testing Tomcat 10 in various ways, including running it in
>> debug mode and attaching via IntelliJ for inspection.
>>
>> ---rony
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
> The bat-file uses the line:
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%
>
> At this place you might be able to redirect the output:
> call "%EXECUTABLE%" start %CMD_LINE_ARGS%  > out.log
>
> You could also try to pass the redirect param to the argument of startup.bat, 
> don’t know if this works, e.g.
> startup.bat " > out.log"

startup.bat uses start to run catalina.bat in a new cmd window with:

call "%EXECUTABLE%" start %CMD_LINE_ARGS%

catalina.bat then starts Tomcat as:

%_EXECJAVA% %CATALINA_LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% 
%CATALINA_OPTS% %DEBUG_OPTS%
-D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%"
-Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%"
-Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% 2>&1 1>
D:\orx.debug\work_rii_tomcat\test.log

This does not work.

---rony




Re: Maybe a stupid (Windows related) question

2022-03-23 Thread Rony G. Flatscher (Apache)

On 23.03.2022 11:51, Konstantin Kolinko wrote:
> вт, 22 мар. 2022 г. в 20:21, 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.
>>
>> 
>>
>> 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!
> First, I second Chris's answer
>
> вт, 22 мар. 2022 г. в 22:19, Christopher Schultz 
> :
>> 
>>
>> ... 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
>>
> Note that
> "startup.bat" is an equivalent of calling "catalina.bat start".
> "shutdown.bat" is an equivalent of "catalina.bat stop".
>
> The above command (with " run") is a different one:
> it starts Tomcat in the same console window, as opposed to " start"
> that opens a new console window.
>
> Second,
> To redirect java.util.logging output to a file, replace ConsoleHandler
> in conf/logging.properties with a FileHandler that writes all those
> log lines to a file.
>
> Actually, logging.properties already has such a FileHandler
> configured. See the following line:
>
> .handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> java.util.logging.ConsoleHandler
>
> It configures handlers for "." (the root). So all the same information
> is also being written to a "1catalina" FileHandler. Removing the
> "ConsoleHandler" from that line will stop duplicating all those log
> messages to the console.

The %CATALINA_HOME%\conf\logging.properties got changed according to

as:

handlers = 1catalina.org.apache.juli.AsyncFileHandler,
2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.Async
FileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, 
java.util.logging.ConsoleHandler

# .handlers = 1catalina.org.apache.juli.AsyncFileHandler, 
java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.AsyncFileHandler

... cut ...

Still stdout and stderr goes to the console. The redirection "2>&1 >test.log" 
creates the empty file
but no output is there.

> Third,
> If you app is actually calling System.err.println(), see about
> "swallowOutput" setting here
> https://tomcat.apache.org/tomcat-10.0-doc/logging.html#Console
> https://tomcat.apache.org/tomcat-10.0-doc/config/context.html

Will try that next thank you!

---rony



Re: Maybe a stupid (Windows related) question

2022-03-23 Thread Konstantin Kolinko
вт, 22 мар. 2022 г. в 20:21, 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.
>
> 
>
> 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!

First, I second Chris's answer

вт, 22 мар. 2022 г. в 22:19, Christopher Schultz :
> 
>
> ... 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
>

Note that
"startup.bat" is an equivalent of calling "catalina.bat start".
"shutdown.bat" is an equivalent of "catalina.bat stop".

The above command (with " run") is a different one:
it starts Tomcat in the same console window, as opposed to " start"
that opens a new console window.

Second,
To redirect java.util.logging output to a file, replace ConsoleHandler
in conf/logging.properties with a FileHandler that writes all those
log lines to a file.

Actually, logging.properties already has such a FileHandler
configured. See the following line:

.handlers = 1catalina.org.apache.juli.AsyncFileHandler,
java.util.logging.ConsoleHandler

It configures handlers for "." (the root). So all the same information
is also being written to a "1catalina" FileHandler. Removing the
"ConsoleHandler" from that line will stop duplicating all those log
messages to the console.

Third,
If you app is actually calling System.err.println(), see about
"swallowOutput" setting here
https://tomcat.apache.org/tomcat-10.0-doc/logging.html#Console
https://tomcat.apache.org/tomcat-10.0-doc/config/context.html

Best regards,
Konstantin Kolinko

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



AW: Maybe a stupid (Windows related) question

2022-03-23 Thread Thomas Hoffmann (Speed4Trade GmbH)


> -Ursprüngliche Nachricht-
> Von: Rony G. Flatscher (Apache) 
> Gesendet: Mittwoch, 23. März 2022 11:34
> An: users@tomcat.apache.org
> Betreff: Re: Maybe a stupid (Windows related) question
> 
> On 22.03.2022 20:18, Christopher Schultz wrote:
> 
> ... cut ...
> 
> > 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.
> 
> The problem is different: redirecting stderr and stdout does not redirect in
> this scenario (employing %CATALINA_HOME%\bin\startup.bat), rather
> output statements to stderr
> (System.err.println(...)) and stdout (System.out.println(...)) gets still
> displayed in the Tomcat window.
> 
> This involves (at least in my experiments) editing bin\startup.bat and/or
> bin\catalina.bat which should not be necessary if understanding Tomcat's
> philsophy correctly. If adjustments are necessary it is advised to supply a
> "bin\setup.bat" script to do so.
> 
> So what I would be looking for is either a configuration change or an
> environment variable to set which allows redirecting stdout and stderr to
> appropriate log files as is done with the service version by default.
> 
> > Using the Windows Service is really the best way to do it on Windows.
> 
> The use case is testing Tomcat 10 in various ways, including running it in
> debug mode and attaching via IntelliJ for inspection.
> 
> ---rony
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org

The bat-file uses the line:
call "%EXECUTABLE%" start %CMD_LINE_ARGS%

At this place you might be able to redirect the output:
call "%EXECUTABLE%" start %CMD_LINE_ARGS%  > out.log

You could also try to pass the redirect param to the argument of startup.bat, 
don’t know if this works, e.g.
startup.bat " > out.log"



Re: Maybe a stupid (Windows related) question

2022-03-23 Thread Rony G. Flatscher (Apache)
On 22.03.2022 20:18, Christopher Schultz wrote:

... cut ...

> 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.

The problem is different: redirecting stderr and stdout does not redirect in 
this scenario
(employing %CATALINA_HOME%\bin\startup.bat), rather output statements to stderr
(System.err.println(...)) and stdout (System.out.println(...)) gets still 
displayed in the Tomcat
window.

This involves (at least in my experiments) editing bin\startup.bat and/or 
bin\catalina.bat which
should not be necessary if understanding Tomcat's philsophy correctly. If 
adjustments are necessary
it is advised to supply a "bin\setup.bat" script to do so.

So what I would be looking for is either a configuration change or an 
environment variable to set
which allows redirecting stdout and stderr to appropriate log files as is done 
with the service
version by default.

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

The use case is testing Tomcat 10 in various ways, including running it in 
debug mode and attaching
via IntelliJ for inspection.

---rony

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