How to properly enable logging in "org.apache.catalina.core.StandardContext"

2024-02-29 Thread David Karr
In our SpringBoot services, we sometimes run into situations where we get
an exception like this:

org.springframework.context.ApplicationContextException: Unable to start
web server; nested exception is
org.springframework.boot.web.server.WebServerException: Unable to start
embedded Tomcat


It doesn't provide any meaningful root cause.  I've googled how to get more
verbosity from this, but the results are so varied and often conflicting,
and I've never found a strategy that works. It appears that the logger used
in Catalina is not directly compatible with logback, or I'm not figuring
out the correct logger name to use.

I was finally able to figure out why this particular failure was happening,
but that was by carefully stepping through the code and finding new
breakpoints to drill down further. I saw references to the "juli" framework
for logging, which I had seen mentioned in the threads that talk about
getting these logs, but I was never able to get it to work.

As opposed to using my serious debugging skills, I'd like to figure out how
to simply increase the Tomcat logging levels so we can get better
information.


contextVersion NullPointerException due to race condition

2024-02-29 Thread FRANTS Patrick
Not sure this is the right mailing list or that it should go to dev.



One of our unit tests will occasionally have a null pointer exception durin=

g shutdown. Unfortunately I have not been able to create a small reproducti=

on yet.



The scenario is as follows.



  *   SpringApplicationShutdownHook calls Tomcat.stop() and a contextVersio=

n used by a SSE request is removed through MapperListener.unregisterContext

  *   A tomcat thread processes an IOException ("Connection reset by peer")=

 exception for that SSE request and ends up in Mapper.map() and gets a null=

 result

from contextObjectToContextVersionMap.get(context). In the end this causes =

a NullPointerException in internalMapWrapper when

calling contextVersion.path.length()





This seems to be only in Tomcat 10.1.12+. Tomcat 10.1.11 does not have the =

problem.



Regards,



Patrick


This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Syst?mes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/



RE: server.xml setting broken with Tomcat 9.0.81

2024-02-28 Thread Jonathan Ho
I resolved my issue by recreate the private key with different encryption
My old key was encrypted with DES-CBC, and new one I used AES-256-CBC
https://stackoverflow.com/questions/17733536/how-to-convert-a-private-key-to-an-rsa-private-key

openssl rsa -aes256 -in server.key  -out new.key

To answer some of your questions:
I tested with 9.0.86, 9.0.82, 9.0.81 and they all gave the me same 
error/failure.

-Original Message-
From: Konstantin Kolinko  
Sent: Wednesday, February 28, 2024 10:48 AM
To: users@tomcat.apache.org
Subject: Re: server.xml setting broken with Tomcat 9.0.81

ср, 28 февр. 2024 г. в 14:42, Jonathan Ho :
>
> I have following connectors in server.xml file and working for a long time 
> with various version of Tomcat 9 until I upgrade to 9.0.81 or newer versions. 
> I verified that 9.0.80 is working.
> What I am getting from 9.0.81 on startup is I will get pass phrase prompt on 
> tomcat start up and following errors in the log.
> I see openssl upgrade by tomcat from 1.x to 3.x in 9.0.81, could that be the 
> problem?
>

1. OpenSSL 1.1.1 has reached End-of-Life, 
https://www.openssl.org/blog/blog/2023/09/11/eol-111/

2. If you suspect, that the version of Tomcat Native is the trigger of this 
issue:

On Windows it is easy to verify whether it is the cause:
just replace "bin/tcnative-1.dll" with an older version.

> or newer versions.
3. What never versions have you tested?

Have you tested the current Tomcat 9.0.86?
It updates Tomcat Native further, to 1.3.0.

Have you tested 9.0.83 or later?
https://bz.apache.org/bugzilla/show_bug.cgi?id=67675
Is not exactly your issue, but of a similar topic.

> I will get pass phrase prompt
4. That prompt is not issued by Tomcat.
Is that prompt expected?
Are you typing the password correctly?
Are you able to decode your key file using openssl.exe from a command line?

Note that a copy of openssl.exe is included with Tomcat Native binaries 
downloadable from https://tomcat.apache.org/download-native.cgi

Best regards,
Konstantin Kolinko

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



Re: server.xml setting broken with Tomcat 9.0.81

2024-02-28 Thread Konstantin Kolinko
ср, 28 февр. 2024 г. в 14:42, Jonathan Ho :
>
> I have following connectors in server.xml file and working for a long time 
> with various version of Tomcat 9 until I upgrade to 9.0.81 or newer versions. 
> I verified that 9.0.80 is working.
> What I am getting from 9.0.81 on startup is I will get pass phrase prompt on 
> tomcat start up and following errors in the log.
> I see openssl upgrade by tomcat from 1.x to 3.x in 9.0.81, could that be the 
> problem?
>

1. OpenSSL 1.1.1 has reached End-of-Life,
https://www.openssl.org/blog/blog/2023/09/11/eol-111/

2. If you suspect, that the version of Tomcat Native is the trigger of
this issue:

On Windows it is easy to verify whether it is the cause:
just replace "bin/tcnative-1.dll" with an older version.

> or newer versions.
3. What never versions have you tested?

Have you tested the current Tomcat 9.0.86?
It updates Tomcat Native further, to 1.3.0.

Have you tested 9.0.83 or later?
https://bz.apache.org/bugzilla/show_bug.cgi?id=67675
Is not exactly your issue, but of a similar topic.

> I will get pass phrase prompt
4. That prompt is not issued by Tomcat.
Is that prompt expected?
Are you typing the password correctly?
Are you able to decode your key file using openssl.exe from a command line?

Note that a copy of openssl.exe is included with Tomcat Native
binaries downloadable from
https://tomcat.apache.org/download-native.cgi

Best regards,
Konstantin Kolinko

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



server.xml setting broken with Tomcat 9.0.81

2024-02-28 Thread Jonathan Ho
I have following connectors in server.xml file and working for a long time with 
various version of Tomcat 9 until I upgrade to 9.0.81 or newer versions. I 
verified that 9.0.80 is working.
What I am getting from 9.0.81 on startup is I will get pass phrase prompt on 
tomcat start up and following errors in the log.
I see openssl upgrade by tomcat from 1.x to 3.x in 9.0.81, could that be the 
problem?

Thanks

28-Feb-2024 06:26:05.127 INFO [main] org.apache.coyote.AbstractProtocol.init 
Initializing ProtocolHandler ["http-nio2-8080"]
28-Feb-2024 06:26:05.150 INFO [main] 
org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The 
["https-openssl-nio-9749"] connector has been configured to support negotiation 
to [h2] via ALPN
28-Feb-2024 06:26:05.150 INFO [main] org.apache.coyote.AbstractProtocol.init 
Initializing ProtocolHandler ["https-openssl-nio-9749"]
28-Feb-2024 06:27:47.172 WARNING [main] 
org.apache.tomcat.util.net.openssl.OpenSSLContext.init Error initializing SSL 
context
  java.lang.Exception: Unable to load certificate key 
C:\opt\Apache-SF\Tomcat-9/conf/r3m/files/server.key (error:1E08010C:DECODER 
routines::unsupported)
 at 
org.apache.tomcat.jni.SSLContext.setCertificate(Native Method)
 at 
org.apache.tomcat.util.net.openssl.OpenSSLContext.addCertificate(OpenSSLContext.java:492)
 at 
org.apache.tomcat.util.net.openssl.OpenSSLContext.init(OpenSSLContext.java:349)
 at 
org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:268)
 at 
org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:107)
 at 
org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
 at 
org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:236)
 at 
org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1334)
 at 
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1347)
 at 
org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:654)
 at 
org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:75)
 at 
org.apache.catalina.connector.Connector.initInternal(Connector.java:1009)
 at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
 at 
org.apache.catalina.core.StandardService.initInternal(StandardService.java:554)
 at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
 at 
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1046)
 at 
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)
 at 
org.apache.catalina.startup.Catalina.load(Catalina.java:686)
 at 
org.apache.catalina.startup.Catalina.load(Catalina.java:709)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at 
org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:302)
 at 
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
28-Feb-2024 06:27:47.174 INFO [main] 
org.apache.tomcat.util.net.AbstractEndpoint.logCertificate Connector 
[https-openssl-nio-9749], TLS virtual host [_default_], certificate type [RSA] 
configured from key [C:\opt\Apache-SF\Tomcat-9/conf/r3m/files/server.key], 
certificate [C:\opt\Apache-SF\Tomcat-9/conf/r3m/files/server.cer] and 
certificate chain 
[C:\opt\Apache-SF\Tomcat-9/conf/r3m/files/server.chain.net.pem] with trust 
store [null]
28-Feb-2024 06:27:47.175 INFO [main] 
org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The 
["https-openssl-nio-9869"] connector has been configured to support negotiation 
to [h2] via ALPN






























Re: Core Dump File Generation

2024-02-28 Thread Olaf Kock


On 28.02.24 12:03, Chaudhary, Mohit wrote:

Hi,

Java version 1.8.0_121 is running on server.


From the release notes of Java 1.8.0_121
(https://www.oracle.com/java/technologies/javase/8u121-relnotes.html):

The JRE expires whenever a new release with security vulnerability fixes
becomes available. Critical patch updates, which contain security
vulnerability fixes, are announced one year in advance on Critical Patch
Updates, Security Alerts and Third Party Bulletin
. This JRE (version 8u121) will
expire with the release of the next critical patch update scheduled for
April 18, 2017.

Take special note of the year-portion of the mentioned date.

And evaluate what other neglected software you run on a potentially
public-facing server.

Check first if you run into an issue that might have been fixed some
time in the past 7 years already, before debugging /any/ further.

Olaf


Re: Core Dump File Generation

2024-02-28 Thread Olaf Kock



On 28.02.24 09:57, Chaudhary, Mohit wrote:

Hi All,

We are facing issues on tomcat. Core dump file generating very frequent twice 
to thrice in a month and core file size would be 13GB to 15GB every time 
.Whenever this issue is happening tomcat services stopped automatically. We 
have done analysis of hs_err_pid.log file and based on analysis we have tried 
many thing (such increased tomcat heap memory ) but unable to resolve this 
issue. Please suggest.


There's not much to suggest: A core dump can be analyzed for the root
cause of it being generated. Typically a problem that goes beyond what
Java code itself is capable to do. More often than not, native code - if
there is any involved - would be my first place to look at.

Also, as the JVM is native code itself: Make sure that it's up-to-date.

On top of that: Yes, when a core dump is generated, the process for
which it was generated is indeed stopped. That's what a crash does to
your process (even if core dumps were disabled or went to /dev/null).
You might want to set up your systems for automatic restart, most likely
with alerting someone of the condition and the restart, so that you have
an overview over how often it happens, but generally keep the service up.

Olaf


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



Re: Core Dump File Generation

2024-02-28 Thread Chaudhary, Mohit
Hi,

Java version 1.8.0_121 is running on server.

Get Outlook for iOS

From: Simon Matter 
Sent: Wednesday, February 28, 2024 4:06:09 PM
To: Tomcat Users List 
Subject: RE: Core Dump File Generation

[You don't often get email from simon.mat...@invoca.ch. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hi,

> Hi,
>
> I am talking about java core dump file which is generating on tomcat/bin
> path and the OS is RHEL 6.

What's the exact version of Java running?

Regards,
Simon

>
> Thanks & Regards,
> Mohit Chaudhary
>
>
> -Original Message-
> From: Simon Matter 
> Sent: Wednesday, February 28, 2024 3:03 PM
> To: Tomcat Users List 
> Subject: Re: Core Dump File Generation
>
> [You don't often get email from simon.mat...@invoca.ch. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Mohit,
>
>> Hi All,
>>
>> We are facing issues on tomcat. Core dump file generating very
>> frequent twice to thrice in a month and core file size would be 13GB
>> to 15GB every time .Whenever this issue is happening tomcat services
>> stopped
>
> I'm a bit confused, are you talking about a UNIX style core file here or
> some kind of dump from Java?
>
> If it's a UNIX style core file then the culprit may be Java and not Tomcat
> - because Java should never ever dump a core file if it's running without
> errors.
>
> Regards,
> Simon
>
>
> -
> 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
>
>



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




RE: Core Dump File Generation

2024-02-28 Thread Simon Matter
Hi,

> Hi,
>
> I am talking about java core dump file which is generating on tomcat/bin
> path and the OS is RHEL 6.

What's the exact version of Java running?

Regards,
Simon

>
> Thanks & Regards,
> Mohit Chaudhary
>
>
> -Original Message-
> From: Simon Matter 
> Sent: Wednesday, February 28, 2024 3:03 PM
> To: Tomcat Users List 
> Subject: Re: Core Dump File Generation
>
> [You don't often get email from simon.mat...@invoca.ch. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Hi Mohit,
>
>> Hi All,
>>
>> We are facing issues on tomcat. Core dump file generating very
>> frequent twice to thrice in a month and core file size would be 13GB
>> to 15GB every time .Whenever this issue is happening tomcat services
>> stopped
>
> I'm a bit confused, are you talking about a UNIX style core file here or
> some kind of dump from Java?
>
> If it's a UNIX style core file then the culprit may be Java and not Tomcat
> - because Java should never ever dump a core file if it's running without
> errors.
>
> Regards,
> Simon
>
>
> -
> 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
>
>



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



RE: Core Dump File Generation

2024-02-28 Thread Chaudhary, Mohit
Hi,

I am talking about java core dump file which is generating on tomcat/bin path 
and the OS is RHEL 6.

Thanks & Regards,
Mohit Chaudhary


-Original Message-
From: Simon Matter 
Sent: Wednesday, February 28, 2024 3:03 PM
To: Tomcat Users List 
Subject: Re: Core Dump File Generation

[You don't often get email from simon.mat...@invoca.ch. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hi Mohit,

> Hi All,
>
> We are facing issues on tomcat. Core dump file generating very
> frequent twice to thrice in a month and core file size would be 13GB
> to 15GB every time .Whenever this issue is happening tomcat services
> stopped

I'm a bit confused, are you talking about a UNIX style core file here or some 
kind of dump from Java?

If it's a UNIX style core file then the culprit may be Java and not Tomcat
- because Java should never ever dump a core file if it's running without 
errors.

Regards,
Simon


-
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: Core Dump File Generation

2024-02-28 Thread Simon Matter
Hi Mohit,

> Hi All,
>
> We are facing issues on tomcat. Core dump file generating very frequent
> twice to thrice in a month and core file size would be 13GB to 15GB every
> time .Whenever this issue is happening tomcat services stopped

I'm a bit confused, are you talking about a UNIX style core file here or
some kind of dump from Java?

If it's a UNIX style core file then the culprit may be Java and not Tomcat
- because Java should never ever dump a core file if it's running without
errors.

Regards,
Simon


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



Core Dump File Generation

2024-02-28 Thread Chaudhary, Mohit
Hi All,

We are facing issues on tomcat. Core dump file generating very frequent twice 
to thrice in a month and core file size would be 13GB to 15GB every time 
.Whenever this issue is happening tomcat services stopped automatically. We 
have done analysis of hs_err_pid.log file and based on analysis we have tried 
many thing (such increased tomcat heap memory ) but unable to resolve this 
issue. Please suggest.


Thanks & Regards,
Mohit Chaudhary



SpringBoot Embedded Tomcat Server RateLimitFilter

2024-02-27 Thread Ved
Hi,
I am using spring boot and wanted to use Rate Limit. I can find it in
package org.apache.catalina.filters; //in embedded tomcat

But this RateLimitFilter is never called. I want to understand when this
filter is called and how I can customize it.

Regards,
Ved Prakash


RE: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

2024-02-27 Thread Saha, Rajib
Hi Chris,

I got your point.

Actually, this service for us is a core service of our product, which control 
several core servers on it.
But, we will Definity see the options to unblock the dependency as you said.

Regards
Rajib

-Original Message-
From: Christopher Schultz 
Sent: 27 February 2024 19:51
To: users@tomcat.apache.org
Subject: Re: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

[You don't often get email from ch...@christopherschultz.net. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Rajib,

On 2/26/24 23:43, Saha, Rajib wrote:
> Hi Mark,
>
> Thanks for your explanation and suggestion.
> For my use case, I have used the below option and its working fine.
> =
> --ServiceUser="LocalSystem"
> =
>
> Thank you very much for showing the way. 

I'm glad you got your service working.

But.

Your next task should be to determine why you need to run your service
as (essentially) local-Administrator and fix it so you don't have to.
Anyone who is able to take control of your application will have
complete control of the local machine.

This is a huge red-flag from a security standpoint.

-chris

> -Original Message-
> From: Mark Thomas 
> Sent: 26 February 2024 14:23
> To: users@tomcat.apache.org
> Subject: Re: Need help for a problem on migrating from Tomcat-8 to Tomcat-9
>
> [You don't often get email from ma...@apache.org. Learn why this is important 
> at https://aka.ms/LearnAboutSenderIdentification ]
>
> On 26/02/2024 06:11, Saha, Rajib wrote:
>> Hi Experts,
>>
>> In our product, we are using Tomcat [OriginalFileName:  prunsrv.exe] for 
>> creating a service[Say, Service-A]. It's a huge product running in market 
>> for last 20 years.
>> We are in progress of moving from Tomcat-8 to tomcat-9.
>>
>> When we are creating the Service-A with Tomcat-8 [tomcat8.exe]. In 
>> "Services" desktop app, we can see the service is created with "Local 
>> System" in "Log On as".
>> When we are creating the Service-A with Tomcat-9 [tomcat9.exe]. in 
>> "Services" desktop app, we can see the service is created with "Local 
>> service" in "Log On as".
>>
>> Looks like "Local service" has less power than "Local System".
>> Due to it, Service-A created with Tomcat-9 failing for several operation 
>> inside product.
>
> That should be a security concern. Local System is broadly equivalent to
> local administrator. You generally don't want to be running Tomcat under
> Local System.
>
>> Can somebody suggest, how we can create a service with tomcat-9, with the 
>> privilege of "Local System"?
>
> Have you looked at the documentation?
>
> https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html
>
> Look for "--ServiceUser"
>
> Mark
>
> -
> 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
>

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



Re: Any way to look-up a session from application?

2024-02-27 Thread Robert Turner
Chris,

I think maybe Mark answered a similar question a while back indicating the
only supported method within the Servlet API was custom session tracking. I
could be remembering incorrectly. That's what we do however, because
without "snooping" into the Tomcat internals, I don't think there was a way
that we found.

Robert



On Tue, Feb 27, 2024 at 3:10 PM Olaf Kock  wrote:

> Hi Chris
>
> On 27.02.24 15:19, Christopher Schultz wrote:
> > All,
> >
> > I'm looking at building some administrative tools into my application,
> > and I'd like to be able to inspect user sessions for certain attributes.
> >
> > I know that I can use JMX to make calls to the (session) Manager, but
> > it looks like the only things really exposed are:
> >
> > String[] listSessionIds()
> > String getSessionAttribute(String sessionId, String attributeName)
> >
> > There are other operations available but they aren't related to what
> > I'd like to do: get a reference to the Session object itself, so I can
> > get attributes as their *actual* types and not converted to a String.
> >
> > Is that possible using existing Tomcat-provided tools?
> >
> > Another option would be to register an HttpSessionListener /
> > HttpSessionActivationListener and keep track of all the events so I
> > have my own "private" set of references to all of those sessions.
> >
> > Is there a way to do this without writing my own session-tracking
> > code? The old HttpSessionContext interface has been deprecated for
> > ages and implementations are required to be no-ops.
> >
> I can't really provide a recipe, but have a question for clarification:
>
> As you mention JMX, it sounds like you want to access the session from
> out-of-application context? If that is the case, you might have a hard
> time getting any session objects, if their classes are private to the
> web application's classloader. Strings naturally will work, but for
> others you'd need severe class loading or reflection magic to make sense
> of them.
>
> HttpSessionListener sounds more "in context", and more doable.
>
> I'm not aware of a way that does not involve custom session tracking
> code. But that doesn't mean anything: I can easily be proven wrong :)
>
> Olaf
>
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Any way to look-up a session from application?

2024-02-27 Thread Olaf Kock

Hi Chris

On 27.02.24 15:19, Christopher Schultz wrote:

All,

I'm looking at building some administrative tools into my application,
and I'd like to be able to inspect user sessions for certain attributes.

I know that I can use JMX to make calls to the (session) Manager, but
it looks like the only things really exposed are:

String[] listSessionIds()
String getSessionAttribute(String sessionId, String attributeName)

There are other operations available but they aren't related to what
I'd like to do: get a reference to the Session object itself, so I can
get attributes as their *actual* types and not converted to a String.

Is that possible using existing Tomcat-provided tools?

Another option would be to register an HttpSessionListener /
HttpSessionActivationListener and keep track of all the events so I
have my own "private" set of references to all of those sessions.

Is there a way to do this without writing my own session-tracking
code? The old HttpSessionContext interface has been deprecated for
ages and implementations are required to be no-ops.


I can't really provide a recipe, but have a question for clarification:

As you mention JMX, it sounds like you want to access the session from
out-of-application context? If that is the case, you might have a hard
time getting any session objects, if their classes are private to the
web application's classloader. Strings naturally will work, but for
others you'd need severe class loading or reflection magic to make sense
of them.

HttpSessionListener sounds more "in context", and more doable.

I'm not aware of a way that does not involve custom session tracking
code. But that doesn't mean anything: I can easily be proven wrong :)

Olaf





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



Re: configuring Tomcat 9.0.85 for debugging

2024-02-27 Thread Mark Caruso
 Mark
Your input is very helpful.  Thank You very much!  I have been having headaches 
with all the issues you mentioned and will be following your guidance.

On Monday, February 26, 2024 at 06:12:49 PM EST, Mark Eggers 
 wrote:  
 
 On 2/26/2024 2:18 PM, Mark Caruso wrote:
> If anyone has guidance for configuring Tomcat 9.0.85 for debugging please 
> send it along. I am running the program under Ubuntu 20.04. I am not sure the 
> guidance on the internet for modifying catalina.sh is right.  My goal is to 
> then attach a debugger from Netbeans 16 and debug my web app.
> Thank youMark

Mark,

In my opinion, running a service-oriented (systemd for Ubuntu 20.04) or 
package-installed Tomcat for development and debugging is not ideal.

In no particular order, you'll run into:

1. Start / stop issues (you'll need sudo)
2. Log permissions (looking at logs may be an issue)
3. Deployment permissions (more about that below)

Also, NetBeans 21 just came out and is available via snap. Is there any 
reason to run NetBeans 16?

NetBeans allows you to start up a Tomcat instance in normal, debug, or 
profile mode from the IDE. It does this by using the Tomcat-provided 
catalina.(sh/bat) script. That's going to be an issue if you're using a 
package-installed Tomcat.

In the NetBeans server setup, you can either use shared memory or JMX 
(and specify the port) for a Tomcat server. By default, NetBeans will 
use shared memory for a Tomcat running on the same machine.

NetBeans deploys an application to Tomcat that it controls by copying a 
context.xml file over to the appropriate location in a Tomcat installation
($CATALINA_HOME/conf/Catalina/localhost/appname.xml) with an appropriate 
docBase.  For example, if you are running a Maven project, that docBase 
will be:

${project.basedir}/${project.build.directory}/${project.artifactId}-${project.version}

This enables a project to be deployed quickly, as well as enables hot 
reloads if you enable compile on save.

Deploying and redeploying a web application for debugging may run into 
permissions issue if you're using a package-installed version of Tomcat.

So, in summary:

1. Download Tomcat from tomcat.apache.org
2. Extract and install it in a reasonable spot underneath your home 
directory
3. Edit server.xml to change any ports (if necessary)
4. Edit tomcat-users.xml to add a user with a manager-script role (see 
comments in file)
5. Configure NetBeans to use the freshly installed Tomcat

Debugging is then simply starting Tomcat in debug mode. This is how I 
work on Windows, Ubuntu, Fedora, and have people set up on MacOS.

. . . just my two cents
/mde/

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

  

Re: configuring Tomcat 9.0.85 for debugging

2024-02-27 Thread Mark Caruso
 Thank you very much!

On Monday, February 26, 2024 at 05:43:02 PM EST, Chuck Caldarale 
 wrote:  
 
 
> On Feb 26, 2024, at 16:18, Mark Caruso  wrote:
> 
> If anyone has guidance for configuring Tomcat 9.0.85 for debugging please 
> send it along. I am running the program under Ubuntu 20.04. I am not sure the 
> guidance on the internet for modifying catalina.sh is right.  My goal is to 
> then attach a debugger from Netbeans 16 and debug my web app.


Might want to start with the Tomcat FAQ, in particular this page:
https://cwiki.apache.org/confluence/display/TOMCAT/Troubleshooting+and+Diagnostics

  - Chuck

  

Re: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

2024-02-27 Thread Christopher Schultz

Rajib,

On 2/26/24 23:43, Saha, Rajib wrote:

Hi Mark,

Thanks for your explanation and suggestion.
For my use case, I have used the below option and its working fine.
=
--ServiceUser="LocalSystem"
=

Thank you very much for showing the way. 


I'm glad you got your service working.

But.

Your next task should be to determine why you need to run your service 
as (essentially) local-Administrator and fix it so you don't have to. 
Anyone who is able to take control of your application will have 
complete control of the local machine.


This is a huge red-flag from a security standpoint.

-chris


-Original Message-
From: Mark Thomas 
Sent: 26 February 2024 14:23
To: users@tomcat.apache.org
Subject: Re: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 26/02/2024 06:11, Saha, Rajib wrote:

Hi Experts,

In our product, we are using Tomcat [OriginalFileName:  prunsrv.exe] for 
creating a service[Say, Service-A]. It's a huge product running in market for 
last 20 years.
We are in progress of moving from Tomcat-8 to tomcat-9.

When we are creating the Service-A with Tomcat-8 [tomcat8.exe]. In "Services" desktop app, we can 
see the service is created with "Local System" in "Log On as".
When we are creating the Service-A with Tomcat-9 [tomcat9.exe]. in "Services" desktop app, we can 
see the service is created with "Local service" in "Log On as".

Looks like "Local service" has less power than "Local System".
Due to it, Service-A created with Tomcat-9 failing for several operation inside 
product.


That should be a security concern. Local System is broadly equivalent to
local administrator. You generally don't want to be running Tomcat under
Local System.


Can somebody suggest, how we can create a service with tomcat-9, with the privilege of 
"Local System"?


Have you looked at the documentation?

https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html

Look for "--ServiceUser"

Mark

-
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



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



Any way to look-up a session from application?

2024-02-27 Thread Christopher Schultz

All,

I'm looking at building some administrative tools into my application, 
and I'd like to be able to inspect user sessions for certain attributes.


I know that I can use JMX to make calls to the (session) Manager, but it 
looks like the only things really exposed are:


String[] listSessionIds()
String getSessionAttribute(String sessionId, String attributeName)

There are other operations available but they aren't related to what I'd 
like to do: get a reference to the Session object itself, so I can get 
attributes as their *actual* types and not converted to a String.


Is that possible using existing Tomcat-provided tools?

Another option would be to register an HttpSessionListener / 
HttpSessionActivationListener and keep track of all the events so I have 
my own "private" set of references to all of those sessions.


Is there a way to do this without writing my own session-tracking code? 
The old HttpSessionContext interface has been deprecated for ages and 
implementations are required to be no-ops.


-chris

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



RE: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

2024-02-26 Thread Saha, Rajib
Hi Mark,

Thanks for your explanation and suggestion.
For my use case, I have used the below option and its working fine.
=
--ServiceUser="LocalSystem"
=

Thank you very much for showing the way. 

Regards
Rajib

-Original Message-
From: Mark Thomas 
Sent: 26 February 2024 14:23
To: users@tomcat.apache.org
Subject: Re: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 26/02/2024 06:11, Saha, Rajib wrote:
> Hi Experts,
>
> In our product, we are using Tomcat [OriginalFileName:  prunsrv.exe] for 
> creating a service[Say, Service-A]. It's a huge product running in market for 
> last 20 years.
> We are in progress of moving from Tomcat-8 to tomcat-9.
>
> When we are creating the Service-A with Tomcat-8 [tomcat8.exe]. In "Services" 
> desktop app, we can see the service is created with "Local System" in "Log On 
> as".
> When we are creating the Service-A with Tomcat-9 [tomcat9.exe]. in "Services" 
> desktop app, we can see the service is created with "Local service" in "Log 
> On as".
>
> Looks like "Local service" has less power than "Local System".
> Due to it, Service-A created with Tomcat-9 failing for several operation 
> inside product.

That should be a security concern. Local System is broadly equivalent to
local administrator. You generally don't want to be running Tomcat under
Local System.

> Can somebody suggest, how we can create a service with tomcat-9, with the 
> privilege of "Local System"?

Have you looked at the documentation?

https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html

Look for "--ServiceUser"

Mark

-
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: configuring Tomcat 9.0.85 for debugging

2024-02-26 Thread Mark Eggers

On 2/26/2024 2:18 PM, Mark Caruso wrote:

If anyone has guidance for configuring Tomcat 9.0.85 for debugging please send 
it along. I am running the program under Ubuntu 20.04. I am not sure the 
guidance on the internet for modifying catalina.sh is right.  My goal is to 
then attach a debugger from Netbeans 16 and debug my web app.
Thank youMark


Mark,

In my opinion, running a service-oriented (systemd for Ubuntu 20.04) or 
package-installed Tomcat for development and debugging is not ideal.


In no particular order, you'll run into:

1. Start / stop issues (you'll need sudo)
2. Log permissions (looking at logs may be an issue)
3. Deployment permissions (more about that below)

Also, NetBeans 21 just came out and is available via snap. Is there any 
reason to run NetBeans 16?


NetBeans allows you to start up a Tomcat instance in normal, debug, or 
profile mode from the IDE. It does this by using the Tomcat-provided 
catalina.(sh/bat) script. That's going to be an issue if you're using a 
package-installed Tomcat.


In the NetBeans server setup, you can either use shared memory or JMX 
(and specify the port) for a Tomcat server. By default, NetBeans will 
use shared memory for a Tomcat running on the same machine.


NetBeans deploys an application to Tomcat that it controls by copying a 
context.xml file over to the appropriate location in a Tomcat installation
($CATALINA_HOME/conf/Catalina/localhost/appname.xml) with an appropriate 
docBase.  For example, if you are running a Maven project, that docBase 
will be:


${project.basedir}/${project.build.directory}/${project.artifactId}-${project.version}

This enables a project to be deployed quickly, as well as enables hot 
reloads if you enable compile on save.


Deploying and redeploying a web application for debugging may run into 
permissions issue if you're using a package-installed version of Tomcat.


So, in summary:

1. Download Tomcat from tomcat.apache.org
2. Extract and install it in a reasonable spot underneath your home 
directory

3. Edit server.xml to change any ports (if necessary)
4. Edit tomcat-users.xml to add a user with a manager-script role (see 
comments in file)

5. Configure NetBeans to use the freshly installed Tomcat

Debugging is then simply starting Tomcat in debug mode. This is how I 
work on Windows, Ubuntu, Fedora, and have people set up on MacOS.


. . . just my two cents
/mde/

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



Re: configuring Tomcat 9.0.85 for debugging

2024-02-26 Thread Chuck Caldarale

> On Feb 26, 2024, at 16:18, Mark Caruso  wrote:
> 
> If anyone has guidance for configuring Tomcat 9.0.85 for debugging please 
> send it along. I am running the program under Ubuntu 20.04. I am not sure the 
> guidance on the internet for modifying catalina.sh is right.  My goal is to 
> then attach a debugger from Netbeans 16 and debug my web app.


Might want to start with the Tomcat FAQ, in particular this page:
https://cwiki.apache.org/confluence/display/TOMCAT/Troubleshooting+and+Diagnostics

  - Chuck



configuring Tomcat 9.0.85 for debugging

2024-02-26 Thread Mark Caruso
If anyone has guidance for configuring Tomcat 9.0.85 for debugging please send 
it along. I am running the program under Ubuntu 20.04. I am not sure the 
guidance on the internet for modifying catalina.sh is right.  My goal is to 
then attach a debugger from Netbeans 16 and debug my web app.
Thank youMark





Re: A curious case of Tomcat 10.1.x NIO(1) acceptor not stopping clearly on some setups

2024-02-26 Thread Michał Szymborski
Thank you, that clears things up. I did not think about implication of 
using wildcard. I will try to use explicit addresses from now on. You 
learn something new every day!


Cheers,
Michał

On 26.02.2024 09:48, Mark Thomas wrote:

On 25/02/2024 18:18, Michał Szymborski wrote:



On quick inspection the acceptor thread 
(https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/Acceptor.java#L128) was listening on [/[0:0:0:0:0:0:0:0]:39033]
, which was correctly picked up at first, but then this local address 
got transformed:


0.0.0.0 is shorthand for "all configured IP address". Tomcat can't use 
that address to establish a connection to the Acceptor thread so it has 
to try and deduce a valid IP local address from the network 
configuration information exposed through the Java APIs.



https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/AbstractEndpoint.java#L1164

It started picking up interfaces to use, and it stopped at the first 
non-loopback non-link local address, which also happens to be some 
sort of a bridge network for one of my VMs. I don't quite know why 
there is no routing set up, but this interface should not have been 
picked in the first place.


It is a local IP address so as far as Tomcat can see it should be valid 
to connect to the Acceptor.




I'll take a look at how it works on my work laptop with MacOs, but I'd 
wager a guess that some corporate VPNs have interfaces which have 
messed up routing as well. Can't tell if it's a bug or a feature, but 
it sure is unexpected. Making this timeout for acceptor shutdown 
configurable would be one sort of band-aid.


It is configurable. socket.unlockTimeout. Documented default is 250ms 
although looking at the code it appears there is a minimum of 2000ms - 
need to see why that is.


Configuring a specific address (even 127.0.0.1) for the Connector would 
also address this.


Mark

-
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: Need help for a problem on migrating from Tomcat-8 to Tomcat-9

2024-02-26 Thread Mark Thomas

On 26/02/2024 06:11, Saha, Rajib wrote:

Hi Experts,

In our product, we are using Tomcat [OriginalFileName:  prunsrv.exe] for 
creating a service[Say, Service-A]. It's a huge product running in market for 
last 20 years.
We are in progress of moving from Tomcat-8 to tomcat-9.

When we are creating the Service-A with Tomcat-8 [tomcat8.exe]. In "Services" desktop app, we can 
see the service is created with "Local System" in "Log On as".
When we are creating the Service-A with Tomcat-9 [tomcat9.exe]. in "Services" desktop app, we can 
see the service is created with "Local service" in "Log On as".

Looks like "Local service" has less power than "Local System".
Due to it, Service-A created with Tomcat-9 failing for several operation inside 
product.


That should be a security concern. Local System is broadly equivalent to 
local administrator. You generally don't want to be running Tomcat under 
Local System.



Can somebody suggest, how we can create a service with tomcat-9, with the privilege of 
"Local System"?


Have you looked at the documentation?

https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html

Look for "--ServiceUser"

Mark

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



Re: A curious case of Tomcat 10.1.x NIO(1) acceptor not stopping clearly on some setups

2024-02-26 Thread Mark Thomas

On 25/02/2024 18:18, Michał Szymborski wrote:



On quick inspection the acceptor thread 
(https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/Acceptor.java#L128) was listening on [/[0:0:0:0:0:0:0:0]:39033]
, which was correctly picked up at first, but then this local address 
got transformed:


0.0.0.0 is shorthand for "all configured IP address". Tomcat can't use 
that address to establish a connection to the Acceptor thread so it has 
to try and deduce a valid IP local address from the network 
configuration information exposed through the Java APIs.



https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/AbstractEndpoint.java#L1164

It started picking up interfaces to use, and it stopped at the first 
non-loopback non-link local address, which also happens to be some sort 
of a bridge network for one of my VMs. I don't quite know why there is 
no routing set up, but this interface should not have been picked in the 
first place.


It is a local IP address so as far as Tomcat can see it should be valid 
to connect to the Acceptor.




I'll take a look at how it works on my work laptop with MacOs, but I'd 
wager a guess that some corporate VPNs have interfaces which have messed 
up routing as well. Can't tell if it's a bug or a feature, but it sure 
is unexpected. Making this timeout for acceptor shutdown configurable 
would be one sort of band-aid.


It is configurable. socket.unlockTimeout. Documented default is 250ms 
although looking at the code it appears there is a minimum of 2000ms - 
need to see why that is.


Configuring a specific address (even 127.0.0.1) for the Connector would 
also address this.


Mark

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



Need help for a problem on migrating from Tomcat-8 to Tomcat-9

2024-02-25 Thread Saha, Rajib
Hi Experts,

In our product, we are using Tomcat [OriginalFileName:  prunsrv.exe] for 
creating a service[Say, Service-A]. It's a huge product running in market for 
last 20 years.
We are in progress of moving from Tomcat-8 to tomcat-9.

When we are creating the Service-A with Tomcat-8 [tomcat8.exe]. In "Services" 
desktop app, we can see the service is created with "Local System" in "Log On 
as".
When we are creating the Service-A with Tomcat-9 [tomcat9.exe]. in "Services" 
desktop app, we can see the service is created with "Local service" in "Log On 
as".

Looks like "Local service" has less power than "Local System".
Due to it, Service-A created with Tomcat-9 failing for several operation inside 
product.

Can somebody suggest, how we can create a service with tomcat-9, with the 
privilege of "Local System"?

Please let me know, if any more details is required from my side.

Regards
Rajib








Re: A curious case of Tomcat 10.1.x NIO(1) acceptor not stopping clearly on some setups

2024-02-25 Thread Michał Szymborski
Thank you for taking the time. Removing Gradle from equation did not 
make a difference.


I did what I should have done in the beginning though and turned up the 
logging level. When an endpoint gets shut down, since there is no other 
way of waking the Acceptor up, a fake connection is made. This is timing 
out apparently:



Feb 25, 2024 6:23:24 PM org.apache.tomcat.util.net.AbstractEndpoint unlockAccept
FINE: Caught exception trying to unlock accept on port [0]
java.net.SocketTimeoutException: Connect timed out
at 
java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:633)
at 
org.apache.tomcat.util.net.AbstractEndpoint.unlockAccept(AbstractEndpoint.java:1124)
at 
org.apache.tomcat.util.net.NioEndpoint.unlockAccept(NioEndpoint.java:390)
at 
org.apache.tomcat.util.net.AbstractEndpoint.pause(AbstractEndpoint.java:1394)
at org.apache.coyote.AbstractProtocol.pause(AbstractProtocol.java:678)
at org.apache.catalina.connector.Connector.pause(Connector.java:963)
at 
org.apache.catalina.core.StandardService.stopInternal(StandardService.java:484)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242)
at 
org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:974)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:447)
at SlowStop.main(SlowStop.java:14)


You can see the procedure here: 
https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/AbstractEndpoint.java#L1086


What I noted:
- the local address for shutdown is NOT loopback
- the connection is timing out

After I did some magic to increase the connection timeout from 2000ms to 
60 000ms - I got "No route to host".


So after looking up which IP the device belonged to - it wasn't the 
interface I was looking for.


On quick inspection the acceptor thread 
(https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/Acceptor.java#L128) 
was listening on [/[0:0:0:0:0:0:0:0]:39033]
, which was correctly picked up at first, but then this local address 
got transformed:


https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/AbstractEndpoint.java#L1164

It started picking up interfaces to use, and it stopped at the first 
non-loopback non-link local address, which also happens to be some sort 
of a bridge network for one of my VMs. I don't quite know why there is 
no routing set up, but this interface should not have been picked in the 
first place.


Here's a list of my interfaces:

- lo (loopback)
- wlp4s0 (wifi)
- docker0 (docker networking stuff)
- br-e26d1e697a66 (some bridge)
- br-54aa505a4d52 (some bridge)

The code picked up br-54aa505a4d52 first, it has those IP addresses:

- /fe80:0:0:0:0:0:0:1%br-e26d1e697a66
- /fc00:f853:ccd:e793:0:0:0:1%br-e26d1e697a66
- /172.18.0.1

It stopped iterating once it got to the second one, tried using it and 
failed. It should not have tried to touch the bridge networks at all.


I'll take a look at how it works on my work laptop with MacOs, but I'd 
wager a guess that some corporate VPNs have interfaces which have messed 
up routing as well. Can't tell if it's a bug or a feature, but it sure 
is unexpected. Making this timeout for acceptor shutdown configurable 
would be one sort of band-aid.


Chuck - could you please share your thoughts on this?

Sample logs, I updated the repo with this script:


$ ./no_gradle.sh
Feb 25, 2024 7:13:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-auto-1"]
Feb 25, 2024 7:13:08 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Feb 25, 2024 7:13:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-auto-1-37591"]
Feb 25, 2024 7:13:08 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-auto-1-37591"]
Feb 25, 2024 7:13:08 PM org.apache.tomcat.util.net.AbstractEndpoint unlockAccept
FINER: About to unlock socket 
for:/[fc00:f853:ccd:e793:0:0:0:1%br-e26d1e697a66]:37591
Feb 25, 2024 7:13:09 PM org.apache.tomcat.util.net.NioEndpoint$Poller timeout
FINER: timeout completed: keys processed=0; now=1708884789930; 
nextExpiration=0; keyCount=0; hasEvents=false; eval=false
Feb 25, 2024 7:13:10 PM org.apache.tomcat.util.net.AbstractEndpoint unlockAccept
FINE: Caught exception trying to unlock accept on port [0]
java.net.SocketTimeoutException: Connect timed out
at 
java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
at 

Re: A curious case of Tomcat 10.1.x NIO(1) acceptor not stopping clearly on some setups

2024-02-25 Thread Chuck Caldarale

> On Feb 23, 2024, at 10:18, Michał Szymborski  
> wrote:
> 
> Hi, I've encountered an issue where the acceptor doesn't stop cleanly when 
> shutting Tomcat down on some machines. I'm using tomcat-embed-core 10.1.19, 
> I've tested it on Ubuntu 22.04 and MacOs Sonoma 14.3.1.
> 
> Here is a minimum reproducible example (also available here 
> https://github.com/lared/tomcat-acceptor-not-stopping-cleanly):
> 
> ```
> import org.apache.catalina.LifecycleException;
> import org.apache.catalina.connector.Connector;
> import org.apache.catalina.startup.Tomcat;
> 
> class SlowStop {
>public static void main(String[] args) throws LifecycleException {
>var connector = new 
> Connector("org.apache.coyote.http11.Http11NioProtocol");
>connector.setPort(0);
> 
>Tomcat tomcat = new Tomcat();
>tomcat.getService().addConnector(connector);
> 
>tomcat.start();
>tomcat.stop();
>}
> }
> ```
> 
> 
> Whenever I run this code on setup as listed above, shutdown of the 
> ProtocolHandler times out when trying to stop the acceptor. Here is an 
> excerpt from logs:
> 
> ```
> Feb 23, 2024 4:42:34 PM org.apache.coyote.AbstractProtocol stop
> INFO: Stopping ProtocolHandler ["http-nio-8080"]
> Feb 23, 2024 4:42:44 PM org.apache.tomcat.util.net.Acceptor stop
> WARNING: The acceptor thread [http-nio-8080-Acceptor] did not stop cleanly
> ```
> 
> This can be traced down to `NioEndpoint` stopping, particularly stopping the 
> acceptor:
> 
> https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/NioEndpoint.java#L308
> 
> https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/Acceptor.java#L180
> 
> 
> This issue is not reproducible on every setup (see github actions run on the 
> linked repo), and it only affects NIO - NIO2 works as expected.
> 
> I've encountered this issue when Spring Boot got upgraded to 3.2.x line 
> (switch from Tomcat 9 to 10.1.x).
> 
> Could you please advise me where I can go from here? This is particularly 
> annoying in our testing setup, where timely teardown of the Tomcat is very 
> appreciated (even if disruptive).
> 
> Unfortunately I'm a fair bit out of my depth here when it comes to 
> troubleshooting this further. It is rather surprising that even though people 
> were not able to reproduce it on some of their setups (like MacOs 13.6.4), 
> but I actually was able to reproduce it on two machines I own, my colleagues 
> at work have the same issue.


I could not reproduce the error in several hundred executions of your test 
program on my M1 MacBook Pro (Sonoma 14.3.1, OpenJDK 21.0.1) using just command 
line execution:

chuck@Chuck-MacBookPro JavaTest > java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
chuck@Chuck-MacBookPro JavaTest > java -cp `find 
~/Downloads/apache-tomcat-10.1.19-embed -name '*.jar' | tr '\n' ':' | sed 
's/:$/:./'` SlowStop
Feb 25, 2024 8:55:54 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-auto-1"]
Feb 25, 2024 8:55:54 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Feb 25, 2024 8:55:54 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-auto-1-56406"]
Feb 25, 2024 8:55:54 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-auto-1-56406"]
Feb 25, 2024 8:55:54 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Tomcat]
Feb 25, 2024 8:55:54 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-auto-1-56406"]

Any chance the problem has something to do with your gradle environment?

  - Chuck



Re: TOMCAT CERTIFICATE RENEWAL

2024-02-23 Thread Christopher Schultz

Prabu,

On 2/19/24 02:40, Ganesan, Prabu wrote:

Thanks for your information - its jks file do we have any specific
command to pass them for renew the certificate?
If you aren't sure how to do this, maybe you aren't the right person to 
try to do this.


-chris


_
PrabuGanesan
Consultant|MS-Nordics
capgemini India Pvt. Ltd. | Bangalore
Contact: +91 8526554535
Email: prabhu.c.gane...@capgemini.com

www.capgemini.com
People matter, results count.
__
Connect with Capgemini:

  
Please consider the environment and do not print this email unless absolutely necessary.

Capgemini encourages environmental awareness.

-Original Message-
From: Thomas Hoffmann (Speed4Trade GmbH) 

Sent: Monday, February 19, 2024 12:49 PM
To: Tomcat Users List 
Subject: AW: TOMCAT CERTIFICATE RENEWAL

**This mail has been sent from an external source. Do not reply to it, or 
open any links/attachments unless you are sure of the sender's identity.**

Hello Ganesan,


Von: Ganesan, Prabu 
Gesendet: Montag, 19. Februar 2024 08:07
An: Tomcat Users List 
Betreff: TOMCAT CERTIFICATE RENEWAL
Priorität: Hoch

  Hi Guys,
  How to renew the certificate in Tomcat Can anyone provide with steps as we 
have Our tomcat certificate is about to expire in Next week, Anybody can help 
with  renew steps:
  Tomcat version : 8.5.5.0
Thanks & Regards,
_
PrabuGanesan
Consultant|MS-Nordics
capgemini India Pvt. Ltd. | Bangalore
Contact: +91 8526554535


Take a look at the server.xml and inspect the https connector.
There should be a reference to the key file and certificate-file.
Depending on the used format (pem, jks etc) you need to update these files.

Greetings,
Thomas

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


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


-
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: SSO SPNEGO GSS API CheckSum Failed Error

2024-02-23 Thread Tom Delaney
Please don't respond to this email. I was able to figure out the issue. The
server hosting devexample.domain.com was using a canonicalized hostname.
This was throwing tomcat off when reading over the token and keytab file. I
only wish there was a better way for this error to pick up on that.

On Fri, Feb 23, 2024 at 11:36 AM Thomas Delaney 
wrote:

>
>
> Hi all,
>
> I have a redhat 9.2 server hosting a web application on 5 seperate
> instances of Apache Tomcat. I have configured SPNEGO on instances 1,2,3 and
> 4. These instances are behind an apache proxy load balancer on version
> 2.4.57. Instance 1,2, and 3 are load balanced. While 4 and 5 are not. The
> application is hosted on Tomcat 9.0.54.
>
> Domain: domain.com
> Site: devexample.domain.com
>
> URL hit: https://devexample.domain.com/webclient_devex/exclient.jsp
>
> *I keep getting this when accessing the application on instance 5:*
> HTTP Status 500 – Internal Server Error
> Type Exception Report
>
> Message GSSException: Failure unspecified at GSS-API level (Mechanism
> level: Checksum failed)
> Description The server encountered an unexpected condition that prevented
> it from fulfilling the request.
> Exception
> javax.servlet.ServletException: GSSException: Failure unspecified at
> GSS-API level (Mechanism level: Checksum failed)
> net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:287)
> Root Cause
> GSSException: Failure unspecified at GSS-API level (Mechanism level:
> Checksum failed)
> sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
>
> net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
>
> net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
> net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
> Root Cause
> KrbException: Checksum failed
> sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
> Source)
> sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
> Source)
> sun.security.krb5.EncryptedData.decrypt(Unknown Source)
> sun.security.krb5.KrbApReq.authenticate(Unknown Source)
> sun.security.krb5.KrbApReq.(Unknown Source)
> sun.security.jgss.krb5.InitSecContextToken.(Unknown Source)
> sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
>
> net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
>
> net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
> net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
> Root Cause
> java.security.GeneralSecurityException: Checksum failed
> sun.security.krb5.internal.crypto.dk.AesDkCrypto.decryptCTS(Unknown Source)
> sun.security.krb5.internal.crypto.dk.AesDkCrypto.decrypt(Unknown Source)
> sun.security.krb5.internal.crypto.Aes256.decrypt(Unknown Source)
> sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
> Source)
> sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
> Source)
> sun.security.krb5.EncryptedData.decrypt(Unknown Source)
> sun.security.krb5.KrbApReq.authenticate(Unknown Source)
> sun.security.krb5.KrbApReq.(Unknown Source)
> sun.security.jgss.krb5.InitSecContextToken.(Unknown Source)
> sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
> sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
> sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
>
> net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
>
> net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
> net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
>
>
> In the catalina logs:
> Entered SpNegoContext.acceptSecContext with state=STATE_NEW
> SpNegoContext.acceptSecContext: 

No classes have been predefined during the image build to load from bytecodes at runtime

2024-02-23 Thread Jun Suzuki
By reference to the AOT support guide,
https://tomcat.apache.org/tomcat-9.0-doc/graal.html, I built a spring
framework 6.x based web application into a native image.
I'm using GraalVM for JDK17.
When finally ran the native image, it gave following error message:

INFO: Initializing Spring root WebApplicationContext
Feb 23, 2024 4:04:24 PM org.apache.catalina.core.StandardContext
listenerStart
SEVERE: Exception sending context initialized event to listener instance of
class [org.springframework.web.context.ContextLoaderListener]
com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been
predefined during the image build to load from bytecodes at runtime.
at
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
at
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
at
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
at java.base@17.0.10
/java.lang.ClassLoader.defineClass(ClassLoader.java:294)

The web application is running well in terms of WAR on Tomcat10.x, and
tomcat-stuffed-1.0.jar also running well.
Could you please confirm whether a spring framework 6.x web application is
also applicable to the AOT support approach?
And I would appreciate your insights on above native image runtime errors.

Best regards,
Jun


SSO SPNEGO GSS API CheckSum Failed Error

2024-02-23 Thread Thomas Delaney
Hi all,

I have a redhat 9.2 server hosting a web application on 5 seperate
instances of Apache Tomcat. I have configured SPNEGO on instances 1,2,3 and
4. These instances are behind an apache proxy load balancer on version
2.4.57. Instance 1,2, and 3 are load balanced. While 4 and 5 are not. The
application is hosted on Tomcat 9.0.54.

Domain: domain.com
Site: devexample.domain.com

URL hit: https://devexample.domain.com/webclient_devex/exclient.jsp

*I keep getting this when accessing the application on instance 5:*
HTTP Status 500 – Internal Server Error
Type Exception Report

Message GSSException: Failure unspecified at GSS-API level (Mechanism
level: Checksum failed)
Description The server encountered an unexpected condition that prevented
it from fulfilling the request.
Exception
javax.servlet.ServletException: GSSException: Failure unspecified at
GSS-API level (Mechanism level: Checksum failed)
net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:287)
Root Cause
GSSException: Failure unspecified at GSS-API level (Mechanism level:
Checksum failed)
sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
Root Cause
KrbException: Checksum failed
sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
Source)
sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
Source)
sun.security.krb5.EncryptedData.decrypt(Unknown Source)
sun.security.krb5.KrbApReq.authenticate(Unknown Source)
sun.security.krb5.KrbApReq.(Unknown Source)
sun.security.jgss.krb5.InitSecContextToken.(Unknown Source)
sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
Root Cause
java.security.GeneralSecurityException: Checksum failed
sun.security.krb5.internal.crypto.dk.AesDkCrypto.decryptCTS(Unknown Source)
sun.security.krb5.internal.crypto.dk.AesDkCrypto.decrypt(Unknown Source)
sun.security.krb5.internal.crypto.Aes256.decrypt(Unknown Source)
sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
Source)
sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType.decrypt(Unknown
Source)
sun.security.krb5.EncryptedData.decrypt(Unknown Source)
sun.security.krb5.KrbApReq.authenticate(Unknown Source)
sun.security.krb5.KrbApReq.(Unknown Source)
sun.security.jgss.krb5.InitSecContextToken.(Unknown Source)
sun.security.jgss.krb5.Krb5Context.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(Unknown Source)
sun.security.jgss.spnego.SpNegoContext.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
sun.security.jgss.GSSContextImpl.acceptSecContext(Unknown Source)
net.sourceforge.spnego.SpnegoAuthenticator.doSpnegoAuth(SpnegoAuthenticator.java:487)
net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:327)
net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)


In the catalina logs:
Entered SpNegoContext.acceptSecContext with state=STATE_NEW
SpNegoContext.acceptSecContext: receiving token = a0 82 07 f1 30 82 07 ed
a0 30 30 2e 06 09 2a 86 48 82 f7 12 01 02 02 06 09 2a 86 48 86 f7 12 01 02
02 06 0a 2b 06 01 04 01 82 37 02 02 1e 06 0a 2b 06 01 04 01 82 37 02 02 0a
a2 82 07 b7 04 82 07 b3 60 82 07 af 06 09 2a 86 48 86 f7 12 01 02 02 01 00
6e 82 07 9e 30 82 07 9a a0 03 02 01 05 a1 03 02 01 0e a2 07 03 05 00 20 00
00 00 a3 82 05 a4 61 82 05 a0 30 82 05 9c a0 03 02 01 05 a1 15 1b 13 52 45
41 4c 4c 59 47 4f 4f 44 53 54 55 46 46 2e 43 4f 4d a2 30 30 2e a0 03 02 01
02 a1 27 30 25 1b 04 48 54 54 50 1b 1d 72 

A curious case of Tomcat 10.1.x NIO(1) acceptor not stopping clearly on some setups

2024-02-23 Thread Michał Szymborski
Hi, I've encountered an issue where the acceptor doesn't stop cleanly 
when shutting Tomcat down on some machines. I'm using tomcat-embed-core 
10.1.19, I've tested it on Ubuntu 22.04 and MacOs Sonoma 14.3.1.


Here is a minimum reproducible example (also available here 
https://github.com/lared/tomcat-acceptor-not-stopping-cleanly):


```
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;

class SlowStop {
public static void main(String[] args) throws LifecycleException {
var connector = new 
Connector("org.apache.coyote.http11.Http11NioProtocol");

connector.setPort(0);

Tomcat tomcat = new Tomcat();
tomcat.getService().addConnector(connector);

tomcat.start();
tomcat.stop();
}
}
```


Whenever I run this code on setup as listed above, shutdown of the 
ProtocolHandler times out when trying to stop the acceptor. Here is an 
excerpt from logs:


```
Feb 23, 2024 4:42:34 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-nio-8080"]
Feb 23, 2024 4:42:44 PM org.apache.tomcat.util.net.Acceptor stop
WARNING: The acceptor thread [http-nio-8080-Acceptor] did not stop cleanly
```

This can be traced down to `NioEndpoint` stopping, particularly stopping 
the acceptor:


https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/NioEndpoint.java#L308

https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/tomcat/util/net/Acceptor.java#L180


This issue is not reproducible on every setup (see github actions run on 
the linked repo), and it only affects NIO - NIO2 works as expected.


I've encountered this issue when Spring Boot got upgraded to 3.2.x line 
(switch from Tomcat 9 to 10.1.x).


Could you please advise me where I can go from here? This is 
particularly annoying in our testing setup, where timely teardown of the 
Tomcat is very appreciated (even if disruptive).


Unfortunately I'm a fair bit out of my depth here when it comes to 
troubleshooting this further. It is rather surprising that even though 
people were not able to reproduce it on some of their setups (like MacOs 
13.6.4), but I actually was able to reproduce it on two machines I own, 
my colleagues at work have the same issue.


Thanks,
Michał

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



Re: NoClassDefFoundError for SSL operations

2024-02-22 Thread Mark Thomas

On 23/02/2024 01:14, bigelytechnol...@yahoo.com wrote:

This spammer has been unsubscribed and banned from re-subscribing.

Mark

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



Re: Long lasting websocket sessions

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Sat, Feb 17, 2024 at 2:46 AM Chuck Caldarale  wrote:

>
> > On Feb 16, 2024, at 11:31, Mark Thomas  wrote:
> >
> > On 09/02/2024 13:47, Alex O'Ree wrote:
> >> I've been experimenting with tomcat 9.x in seeing how long i can get a
> web
> >> socket session to last. I'm currently struggling to get past 30 minutes
> or
> >> so. Looking for guidance on how to best increase this or if this is a
> bad
> >> idea.
> >> Here's the current configuration and what i've tried thus far:
> >> The server continuously streams messages the client, about 1 per second
> >> The client periodically (every 30 seconds) sends a keep alive text
> message
> >> back to the server
> >> The server side endpoint sets the Session.setTimeout(0); according to
> the
> >> docs, this should prevent timeouts
> >> The server side WAR file/WEB-INF/web.xml had a session timeout defined
> at
> >> 15 minutes but i then removed it in order to increase the websocket
> >> duration.
> >> Despite all this, both the client and server log a session disconnect,
> but
> >> i'm still not sure what the reasoning is. I'm still assuming it's some
> kind
> >> of timeout mechanism.
> >
> > I think you need to do a little more investigation with your
> application. I've been running the snake WebSocket example on 9.0.x for
> over any hour wihtout any issues.
>
>
> Are there any boxes (eg, load balancer, firewall) between the client and
> server that might be forcibly dropping TCP connections after 30 minutes?
>
>   - Chuck
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Compile with JDK 17, run on JRE 11?

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Sat, Feb 17, 2024 at 11:02 PM Troels Arvin 
wrote:

> Hello,
>
> Since 9.0.83, building Tomcat has required JDK 17, according to the
> release notes.
>
> Is it possible to take the resulting binaries and run them on JRE 11?
>
> --
> Regards,
> Troels Arvin
>


Re: TOMCAT CERTIFICATE RENEWAL

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Mon, Feb 19, 2024 at 2:02 PM Ganesan, Prabu
 wrote:

>  Hi Guys,
>
> How to renew the certificate in Tomcat Can anyone provide with steps as we
> have Our tomcat certificate is about to expire in Next week, Anybody can
> help with  renew steps:
>
> Tomcat version : 8.5.5.0
>
> Thanks & Regards,
> _
> PrabuGanesan
> Consultant|MS-Nordics
> capgemini India Pvt. Ltd. | Bangalore
> Contact: +91 8526554535
> Email: prabhu.c.gane...@capgemini.com
>
> www.capgemini.com
> People matter, results count.
> __
> Connect with Capgemini:
>
>
> Please consider the environment and do not print this email unless
> absolutely necessary.
> Capgemini encourages environmental awareness.
>
> -Original Message-
> From: Christopher Schultz 
> Sent: Friday, February 16, 2024 8:56 PM
> To: users@tomcat.apache.org
> Subject: Re: Tomcat/Java starts using too much memory and not by the heap
> or non-heap memory
>
> **This mail has been sent from an external source. Do not reply to it,
> or open any links/attachments unless you are sure of the sender's
> identity.**
>
> Chuck and Brian,
>
> On 2/15/24 10:53, Chuck Caldarale wrote:
> >
> >> On Feb 15, 2024, at 09:04, Brian Braun  wrote:
> >>
> >> I discovered the JCMD command to perform the native memory tracking.
> >> When running it, after 3-4 days since I started Tomcat, I found out
> >> that the compiler was using hundreds of MB and that is exactly why
> >> the Tomcat process starts abusing the memory! This is what I saw when
> executing "sudo jcmd  VM.native_memory scale=MB":
> >>
> >> Compiler (reserved=3D340MB, commited=3D340MB) (arena=3D340MB #10)
> >>
> >> Then I discovered the Jemalloc tool (http://jemalloc.net
> >> ) and its jeprof tool, so I started launching
> >> Tomcat using it. Then, after 3-4 days after Tomcat starts I was able
> >> to create some GIF images from the dumps that Jemalloc creates. The
> >> GIF files show the problem: 75-90% of the memory is being used by
> >> some weird activity in the compiler! It seems that something called
> >> "The C2 compile/JIT compiler" starts doing something after 3-4 days,
> and that creates the leak. Why after 3-4 days and not sooner? I don't know.
> >
> >
> > There have been numerous bugs filed with OpenJDK for C2 memory leaks
> over the past few years, mostly related to recompiling certain methods. The
> C2 compiler kicks in when fully optimizing methods, and it may recompile
> methods after internal instrumentation shows that additional performance
> can be obtained by doing so.
> >
> >
> >> I am attaching the GIF in this email.
> >
> >
> > Attachments are stripped on this mailing list.
>
> :(
>
> I'd love to see these.
>
> >> Does anybody know how to deal with this?
> >
> >
> > You could disable the C2 compiler temporarily, and just let C1 handle
> your code. Performance will be somewhat degraded, but may well still be
> acceptable. Add the following to the JVM options when you launch Tomcat:
> >
> > -XX:TieredStopAtLevel=1
> >
> >
> >> By the way, I'm running my website using Tomcat 9.0.58, Java
> >> "11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am
> >> developing using Eclipse and compiling my WAR file with a "Compiler
> >> compliance level:11".
> >
> >
> > You could try a more recent JVM version; JDK 11 was first released over
> 5 years ago, although it is still being maintained.
>
> There is an 11.0.22 -- just a patch-release away from what you appear to
> have. I'm not sure if it's offered through your package-manager, but you
> could give it a try directly from e.g. Eclipse Adoptium / Temurin.
>
> Honestly, if your code runs on Java 11, it's very likely that it will run
> just fine on Java 17 or Java 21. Debian has packages for Java 17 for sure,
> so I suspect Ubuntu will have them available as well.
>
> Debian-based distros will allow you to install and run multiple JDKs/JREs
> in parallel, so you can install Java 17 (or 21) without cutting-off access
> to Java 11 if you still want it.

Re: TOMCAT CERTIFICATE RENEWAL

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Mon, Feb 19, 2024 at 2:08 PM Ganesan, Prabu
 wrote:

>  Hi Guys,
>
>  How to renew the certificate in Tomcat Can anyone provide with steps as
> we have Our tomcat certificate is about to expire in Next week, Anybody can
> help with  renew steps:
>
>  Tomcat version : 8.5.5.0
>
> Thanks & Regards,
>
> _[image:
> Email_CBE.gif]
>
> *PrabuGanesan*
>
> *Consultant|MS-Nordics*
>
> capgemini India Pvt. Ltd. | Bangalore
>
> Contact: +91 8526554535
>
> Email: prabhu.c.gane...@capgemini.com
>
>
>
> www.capgemini.com
>
> *People matter, results count.*
>
> __
>
> *Connect with Capgemini:*
> 
>  
> 
> 
> 
>
>
>
> Please consider the environment and do not print this email unless
> absolutely necessary.
>
> Capgemini encourages environmental awareness.
>
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient, you
> are not authorized to read, print, retain, copy, disseminate, distribute,
> or use this message or any part thereof. If you receive this message in
> error, please notify the sender immediately and delete all copies of this
> message.
>


Re: The custom 404 page of Tomcat8 suddenly becomes invalid

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Mon, Feb 19, 2024 at 8:35 AM LeventLee <894793...@qq.com.invalid> wrote:

> Hello,
>
>
> Here is my information:
> openjdk version "1.8.0_345" | OpenJDK Runtime Environment (build
> 1.8.0_345-b01) | OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
>
> Linux 5.10.134-12.al8.x86_64
> Apache Tomcat/8.0.24
>
>
>
> Now, please let me explain the problems encountered:
> Previously, I set up a custom 404 page in tomcat's WEB INF/web.xml, so
> that once the client accesses a non-existent page, it will return to this
> 404 page. However, not long ago, after Tomcat restarted, it was unable to
> return the custom 404 page and only returned the browser's 404 page.
> I have checked the localhost logs of Tomcat and found a large number of
> errors:org.apache.catalina.core.ApplicationContext.log ssi:
> Can't serve file:/WEB-INF/index/my404page
>
> But the custom 404 page does exist,and the path is right.
> I want to figure out what this error means. If possible, maybe can
> try this problem.
>
>
> Thanks in advance for your suggestions!


Re: Community Over Code Asia 2024 Travel Assistance Applications now open!

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15

On Tue, Feb 20, 2024 at 4:30 PM Gavin McDonald 
wrote:

> Hello to all users, contributors and Committers!
>
> The Travel Assistance Committee (TAC) are pleased to announce that
> travel assistance applications for Community over Code Asia 2024 are now
> open!
>
> We will be supporting Community over Code Asia, Hangzhou, China
> July 26th - 28th, 2024.
>
> TAC exists to help those that would like to attend Community over Code
> events, but are unable to do so for financial reasons. For more info
> on this year's applications and qualifying criteria, please visit the
> TAC website at < https://tac.apache.org/ >. Applications are already
> open on https://tac-apply.apache.org/, so don't delay!
>
> The Apache Travel Assistance Committee will only be accepting
> applications from those people that are able to attend the full event.
>
> Important: Applications close on Friday, May 10th, 2024.
>
> Applicants have until the the closing date above to submit their
> applications (which should contain as much supporting material as
> required to efficiently and accurately process their request), this
> will enable TAC to announce successful applications shortly
> afterwards.
>
> As usual, TAC expects to deal with a range of applications from a
> diverse range of backgrounds; therefore, we encourage (as always)
> anyone thinking about sending in an application to do so ASAP.
>
> For those that will need a Visa to enter the Country - we advise you to
> apply
> now so that you have enough time in case of interview delays. So do not
> wait until you know if you have been accepted or not.
>
> We look forward to greeting many of you in Hangzhou, China in July, 2024!
>
> Kind Regards,
>
> Gavin
>
> (On behalf of the Travel Assistance Committee)
>


Re: NoClassDefFoundError for SSL operations

2024-02-22 Thread bigelytechnol...@yahoo.com
 Hello Dear
Thanks for your reply
l would use this opportunity to briefly introduce our company, Bigly
Technologies Thailand,  We are one of the leading importers in Asia , and
the Middle East on general Goods and Equipment.
On behalf of Bigly Technologies Thailand, this is the samples of the
product that we want develop.
Please Kindly view our website for the samples and the product we need if
your company can
make the similar like this product.
*E-Catalogue:  *https://biglytechcatalog.es.tl

Please quote us your best prices and the cost of delivery to our port and
if the prices meets our
price target we can place our order as soon as possible.
Thank You!

Best Regards

*Wat Namtip*

Purchase Manager

*Bigly Technologies Thailand*

2/51 BangNa Complex Office Tower, 11th Floor, Soi BangNa Trat 25, Bangna
Nua, Bangna, Bangkok 10260 Thailand

Telephone: +66 (0)2150 10 15


On Fri, Feb 23, 2024 at 12:07 AM Simon Arame  wrote:

> We have Tomcat 9.0.81 running under OpenJDK 1.8.0_402-b06
>
> Since the latest OpenJDK upgrade we get some errors when trying to perform
> SSL Operations like obtaining the bytes of an HTTPS url or sending an email
> through SMTP with TLS on.
>
> Note that with the same jdk, those operations succeed when run directly
> with java outside of Tomcat.
>
> The top of the stack traces always has org/bouncycastle/asn1/x9/X9Curve as
> "class not found".
>
> Here is the stack trace for a regular smtp email send failed attempt:
>
> java.lang.NoClassDefFoundError: org/bouncycastle/asn1/x9/X9Curve
> at org.bouncycastle.asn1.x9.X9ECParameters.toASN1Object(Unknown
> Source)
> at org.bouncycastle.asn1.ASN1Encodable.getDERObject(Unknown Source)
> at org.bouncycastle.asn1.x9.X962Parameters.(Unknown Source)
> at org.bouncycastle.jce.provider.JCEECPublicKey.getEncoded(Unknown
> Source)
> at
> org.bouncycastle.jce.provider.JCEECPrivateKey.getPublicKeyDetails(Unknown
> Source)
> at org.bouncycastle.jce.provider.JCEECPrivateKey.(Unknown
> Source)
> at
> org.bouncycastle.jce.provider.asymmetric.ec
> .KeyPairGenerator$EC.generateKeyPair(Unknown
> Source)
> at
>
> sun.security.ssl.ECDHKeyExchange$ECDHEPossession.(ECDHKeyExchange.java:128)
> at
>
> sun.security.ssl.ECDHClientKeyExchange$ECDHEClientKeyExchangeProducer.produce(ECDHClientKeyExchange.java:392)
> at
>
> sun.security.ssl.ClientKeyExchange$ClientKeyExchangeProducer.produce(ClientKeyExchange.java:65)
> at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
> at
>
> sun.security.ssl.ServerHelloDone$ServerHelloDoneConsumer.consume(ServerHelloDone.java:182)
> at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
> at
> sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
> at
> sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
> at
> sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
> at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
> at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1401)
> at
> sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1309)
> at
> sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
> at
> com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
> at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:529)
> at
> com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2135)
> at
> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:734)
> at javax.mail.Service.connect(Service.java:364)
> at javax.mail.Service.connect(Service.java:222)
> at javax.mail.Service.connect(Service.java:171)
>
>
> and the stack trace while trying to obtain an HTTPS url with jersey-client
> org/bouncycastle/asn1/x9/X9Curve
> at
> org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:312)
> at
>
> org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:675)
> at
>
> org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
> at
>
> org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
> at
>
> org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
> at
>
> org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691)
> at
>
> org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:674)
> at
>
> org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:422)
> at
>
> 

AW: NoClassDefFoundError for SSL operations

2024-02-22 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Simon,

> -Ursprüngliche Nachricht-
> Von: Simon Arame 
> Gesendet: Donnerstag, 22. Februar 2024 18:06
> An: users@tomcat.apache.org
> Betreff: NoClassDefFoundError for SSL operations
> 
> We have Tomcat 9.0.81 running under OpenJDK 1.8.0_402-b06
> 
> Since the latest OpenJDK upgrade we get some errors when trying to perform
> SSL Operations like obtaining the bytes of an HTTPS url or sending an email
> through SMTP with TLS on.
> 
> Note that with the same jdk, those operations succeed when run directly with
> java outside of Tomcat.
> 
> The top of the stack traces always has org/bouncycastle/asn1/x9/X9Curve as
> "class not found".
> 
> Here is the stack trace for a regular smtp email send failed attempt:
> 
> java.lang.NoClassDefFoundError: org/bouncycastle/asn1/x9/X9Curve
> at org.bouncycastle.asn1.x9.X9ECParameters.toASN1Object(Unknown
> Source)
> at org.bouncycastle.asn1.ASN1Encodable.getDERObject(Unknown Source)
> at org.bouncycastle.asn1.x9.X962Parameters.(Unknown Source)
> at org.bouncycastle.jce.provider.JCEECPublicKey.getEncoded(Unknown
> Source)
> at
> org.bouncycastle.jce.provider.JCEECPrivateKey.getPublicKeyDetails(Unknown
> Source)
> at org.bouncycastle.jce.provider.JCEECPrivateKey.(Unknown
> Source)
> at
> org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$EC.generateKey
> Pair(Unknown
> Source)
> at
> sun.security.ssl.ECDHKeyExchange$ECDHEPossession.(ECDHKeyExchange.j
> ava:128)
> at
> sun.security.ssl.ECDHClientKeyExchange$ECDHEClientKeyExchangeProducer.pro
> duce(ECDHClientKeyExchange.java:392)
> at
> sun.security.ssl.ClientKeyExchange$ClientKeyExchangeProducer.produce(ClientK
> eyExchange.java:65)
> at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
> at
> sun.security.ssl.ServerHelloDone$ServerHelloDoneConsumer.consume(ServerHe
> lloDone.java:182)
> at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
> at
> sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
> at
> sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
> at
> sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
> at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
> at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1401)
> at
> sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1309)
> at
> sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
> at
> com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
> at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:529)
> at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2135)
> at
> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:734)
> at javax.mail.Service.connect(Service.java:364)
> at javax.mail.Service.connect(Service.java:222)
> at javax.mail.Service.connect(Service.java:171)
> 
> 
> and the stack trace while trying to obtain an HTTPS url with jersey-client
> org/bouncycastle/asn1/x9/X9Curve
> at
> org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:312)
> at
> org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.ja
> va:675)
> at
> org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
> at
> org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocati
> on.java:691)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
> at
> org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.jav
> a:390)
> at
> org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691
> )
> at
> org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:674)
> at
> org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java
> :422)
> at
> org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:318
> )
> 
> 
> I asked for an upgrade of tomcat from 9.0.81 to to 9.0.86 and am waiting to 
> see
> if this will resolve our problems. Any advice or links/reports on that problem
> would be appreciated.
> 
> Simon

Bouncycastle is a 3rd party library. It has nothing to do with Tomcat, nor the 
JDK.
Check were you reference the bouncycastle class.
You someone has edited the java.security file within the JDK.

If you are on linux, you can also grep for any references.

Greetings, Thomas


NoClassDefFoundError for SSL operations

2024-02-22 Thread Simon Arame
We have Tomcat 9.0.81 running under OpenJDK 1.8.0_402-b06

Since the latest OpenJDK upgrade we get some errors when trying to perform
SSL Operations like obtaining the bytes of an HTTPS url or sending an email
through SMTP with TLS on.

Note that with the same jdk, those operations succeed when run directly
with java outside of Tomcat.

The top of the stack traces always has org/bouncycastle/asn1/x9/X9Curve as
"class not found".

Here is the stack trace for a regular smtp email send failed attempt:

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/x9/X9Curve
at org.bouncycastle.asn1.x9.X9ECParameters.toASN1Object(Unknown
Source)
at org.bouncycastle.asn1.ASN1Encodable.getDERObject(Unknown Source)
at org.bouncycastle.asn1.x9.X962Parameters.(Unknown Source)
at org.bouncycastle.jce.provider.JCEECPublicKey.getEncoded(Unknown
Source)
at
org.bouncycastle.jce.provider.JCEECPrivateKey.getPublicKeyDetails(Unknown
Source)
at org.bouncycastle.jce.provider.JCEECPrivateKey.(Unknown
Source)
at
org.bouncycastle.jce.provider.asymmetric.ec.KeyPairGenerator$EC.generateKeyPair(Unknown
Source)
at
sun.security.ssl.ECDHKeyExchange$ECDHEPossession.(ECDHKeyExchange.java:128)
at
sun.security.ssl.ECDHClientKeyExchange$ECDHEClientKeyExchangeProducer.produce(ECDHClientKeyExchange.java:392)
at
sun.security.ssl.ClientKeyExchange$ClientKeyExchangeProducer.produce(ClientKeyExchange.java:65)
at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
at
sun.security.ssl.ServerHelloDone$ServerHelloDoneConsumer.consume(ServerHelloDone.java:182)
at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
at
sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
at
sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
at
sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1401)
at
sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1309)
at
sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
at
com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:529)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2135)
at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:734)
at javax.mail.Service.connect(Service.java:364)
at javax.mail.Service.connect(Service.java:222)
at javax.mail.Service.connect(Service.java:171)


and the stack trace while trying to obtain an HTTPS url with jersey-client
org/bouncycastle/asn1/x9/X9Curve
at
org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:312)
at
org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:675)
at
org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697)
at
org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
at
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
at
org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691)
at
org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:674)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:422)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:318)


I asked for an upgrade of tomcat from 9.0.81 to to 9.0.86 and am waiting to
see if this will resolve our problems. Any advice or links/reports on that
problem would be appreciated.

Simon


Community Over Code Asia 2024 Travel Assistance Applications now open!

2024-02-20 Thread Gavin McDonald
Hello to all users, contributors and Committers!

The Travel Assistance Committee (TAC) are pleased to announce that
travel assistance applications for Community over Code Asia 2024 are now
open!

We will be supporting Community over Code Asia, Hangzhou, China
July 26th - 28th, 2024.

TAC exists to help those that would like to attend Community over Code
events, but are unable to do so for financial reasons. For more info
on this year's applications and qualifying criteria, please visit the
TAC website at < https://tac.apache.org/ >. Applications are already
open on https://tac-apply.apache.org/, so don't delay!

The Apache Travel Assistance Committee will only be accepting
applications from those people that are able to attend the full event.

Important: Applications close on Friday, May 10th, 2024.

Applicants have until the the closing date above to submit their
applications (which should contain as much supporting material as
required to efficiently and accurately process their request), this
will enable TAC to announce successful applications shortly
afterwards.

As usual, TAC expects to deal with a range of applications from a
diverse range of backgrounds; therefore, we encourage (as always)
anyone thinking about sending in an application to do so ASAP.

For those that will need a Visa to enter the Country - we advise you to
apply
now so that you have enough time in case of interview delays. So do not
wait until you know if you have been accepted or not.

We look forward to greeting many of you in Hangzhou, China in July, 2024!

Kind Regards,

Gavin

(On behalf of the Travel Assistance Committee)


Re: Persistent Manager Implementation Question

2024-02-19 Thread Miguel Vidal
hey one question regarding this topic I'm facing an issue where my old app
is doing a creation of multiple sessions but just one is the correct one or
at least is who contains the data and works fine. the others sessions that
are created contains random data that im not sure yet what information
contains. I saw that some dependencies as javamelody create or trigger the
creation of sessions.







these are the blobs  that were encrypted :
¬í sr java.lang.Long;‹ä Ì #ß J valuexr java.lang.Number†¬• ”à‹  xp   Â*jƒsq
~ Â*¼£sr java.lang.Integer â ¤÷ ‡8 I valuexq ~   sr java.lang.BooleanÍ
r€Õœúî Z valuexp sq ~ sq ~ Â*¼¥t  E822F1886161BDE64BBAF294330834E0ppsq
~   t
testAttributet testValue

¬í sr java.lang.Long;‹ä Ì #ß J valuexr java.lang.Number†¬• ”à‹  xp    –âsq
~  –ãsr java.lang.Integer â ¤÷ ‡8 I valuexq ~   sr java.lang.BooleanÍ
r€Õœúî Z valuexp sq ~ sq ~  ™nt  07CED191BB6F3412FF9CF706F8A6CCD3ppsq
~   t org.apache.struts.action.LOCALEsr java.util.Locale~ø `œ0ùì I
hashcodeL countryt Ljava/lang/String;L
extensionsq ~ L languageq ~ L scriptq ~ L variantq ~ xpt USt  t enq ~ q
~ x

The first one is the new application where i was setting a testAttribute a
"testvalue"
but the other one is what im trying to figure out which process is doing
that.
I already turn on the logger with
org.apache.catalina.session.level = ALL
java.util.logging.ConsoleHandler.level=ALL

I can see how the sessions are being moved to stored but is there any way
to print what is saving? or to undo the encript i have a method where im
hitting the bd and getting the data

@GetMapping("/checkB")
public Map checkB() {

logger.log(Level.INFO, "Msg");

Map response = new HashMap<>();
try {
String sql = "SELECT session_data FROM tomcat_sessions WHERE
session_id='130B672C9914E98D4C11FAC8ECA621F8'"; // add your condition
here
String serializedData = jdbcTemplate.queryForObject(sql, String.class);
Object deserializedObject = deserializeData(serializedData);
// Handle the deserialized object as needed

response.put("status", "success");
response.put("message", "Session data deserialized successfully.");
} catch (Exception e) {
e.printStackTrace();
response.put("status", "error");
response.put("message", "Failed to deserialize session data.");
}
return response;
}

private Object deserializeData(String serializedData) throws Exception {
// Decode Base64 encoded serialized data
byte[] serializedBytes = Base64.getDecoder().decode(serializedData);

// Deserialize the data using ObjectInputStream
ByteArrayInputStream bis = new ByteArrayInputStream(serializedBytes);
ObjectInputStream ois = new ObjectInputStream(bis);
Object deserializedObject = ois.readObject();

// Close the input streams
ois.close();
bis.close();

return deserializedObject;
}

but it fails on the function of the decode() . Is there any way to do that?

Any help is appreciate it Thanks!

El lun, 12 feb 2024 a las 9:52, Miguel Vidal ()
escribió:

> Yes both are pointing the same configuration because i was doing some
> testing how it works all of this about session, i wasnt able to get it to
> work in a new application just using spring boot , but i just did it on
> friday. what i was missing it was use the session and not only a getter or
> endpoint without any use of the session.
>  it seems to get it to  work that you need to use the session, the
> configuration is already working
>  maxInactiveInterval="3600" debug="0" saveOnRestart="true"
> maxActiveSessions="-1" minIdleSwap="1" maxIdleSwap="2" maxIdleBackup="1" >
> dataSourceName="jdbc/tomcat"
>driverName="com.mysql.jdbc.Driver"
>sessionAppCol="app_name"
>sessionDataCol="session_data"
>sessionIdCol="session_id"
>sessionLastAccessedCol="last_access"
>sessionMaxInactiveCol="max_inactive"
>sessionTable="tomcat_sessions"
>sessionValidCol="valid_session"
> />
>
>
>  name="jdbc/tomcat"
> auth="Container"
> type="javax.sql.DataSource"
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> validationQuery="select 1"
> testOnBorrow="true"
> removeAbandoned="true"
> logAbandoned="true"
> jdbcInterceptors=
> "org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
> testWhileIdle="true"
> username="root"
> password="admin"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/tomcat?autoReconnect=true"/>
>
> jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
> org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
> 

[ANN] Apache Tomcat 9.0.86 available

2024-02-19 Thread Rémy Maucherat
The Apache Tomcat team announces the immediate availability of Apache
Tomcat 9.0.86.

Apache Tomcat 9 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and JASPIC technologies.

Apache Tomcat 9.0.86 is a bugfix and feature release. The notable
changes compared to 9.0.85 include:

- Add improvements to the CSRF prevention filter including the ability
   to skip adding nonces for resource name and subtree URL patterns.

- Add support for user provided SSLContext instances configured on
   SSLHostConfigCertificate instances. Based on pull request #673
   provided by Hakan Altındağ.

- Review usage of debug logging and downgrade trace or data dumping
   operations from debug level to trace.

Along with lots of other bug fixes and improvements.

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

Downloads:
https://tomcat.apache.org/download-90.cgi

Migration guides from Apache Tomcat 7.x and 8.x:
https://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team

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



Re: The custom 404 page of Tomcat8 suddenly becomes invalid

2024-02-19 Thread Mark Thomas

On 19/02/2024 01:35, LeventLee wrote:

Hello,


Here is my information:
openjdk version "1.8.0_345" | OpenJDK Runtime Environment (build 1.8.0_345-b01) 
| OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)

Linux 5.10.134-12.al8.x86_64
Apache Tomcat/8.0.24


That version is over 8 years old.

The 8.0.x has been unsupported for more than 5 years (since 30 Jun 2018).

Note that 8.5.x will reach EOL on 31 March 2024.

You *really* need to upgrade.

Upgrading to 9.0.x will be easiest as it still uses the Java EE APIs. 
You may want to consider an upgrade to 10.1.x but that will be more work 
is there is a package change related to the Java EE to Jakarta EE change.




Now, please let me explain the problems encountered:
Previously, I set up a custom 404 page in tomcat's WEB INF/web.xml, so that 
once the client accesses a non-existent page, it will return to this 404 page. 
However, not long ago, after Tomcat restarted, it was unable to return the 
custom 404 page and only returned the browser's 404 page.
I have checked the localhost logs of Tomcat and found a large number of 
errors:org.apache.catalina.core.ApplicationContext.log ssi:
Can't serve file:/WEB-INF/index/my404page


Is that the full error message?

Why is SSI involved?

Is the rest of the application working correctly?

Mark


But the custom 404 page does exist,and the path is right.
I want to figure out what this error means. If possible, maybe can try 
this problem.


Thanks in advance for your suggestions!


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



Re: Tomcat Manager 403's with LDAP Realm

2024-02-19 Thread Mark Thomas

On 17/02/2024 21:42, Dan McLaughlin wrote:

We've had the same LDAP realm configured for probably 10 years, and the
same roles in our LDAP for probably the same.  We have 4 roles configured
in LDAP manager-gui, manager-jmx, manager-script, and manager-status.  My
user only has the manager-gui role.  Everything has worked fine up until
about the time we moved to Tomcat 10.1.   Now, I can log in just fine, but
if I try to click stop, start, reload, or undeploy, I always get a 403.  I
don't see any errors in the logs telling me why.  Does anyone have pointers
on debugging this?  My user only has the manager-gui role; the only users
with the JMX or script roles are the users I use for Nagios monitoring of
JMX parameters.

FYI... I can't reproduce it using Tomcat 10.1 running in docker using the
same LDAP realm configuration, so that tells me it has nothing to do with
the roles not being correct...and they should be correct since they haven't
changed since I set things up probably 10 years ago.   The only change has
been the upgrade of Tomcat.  Could CSRF somehow be involved?  It might be
about when CSRF was introduced that I started having issues. I haven't
tried removing the filter yet, only because it really doesn't seem related
based on my understanding of how the filter works.

If someone knows the specific packages, I might want to bump up the logging
on; that would probably be most helpful at this point.


Try:

org.apache.catalina.filters.CsrfPreventionFilter.level=ALL

Mark

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



AW: TOMCAT CERTIFICATE RENEWAL

2024-02-19 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Ganesan,

> -Ursprüngliche Nachricht-
> Von: Ganesan, Prabu 
> Gesendet: Montag, 19. Februar 2024 08:41
> An: Tomcat Users List 
> Betreff: RE: TOMCAT CERTIFICATE RENEWAL
> 
> Hi  Tomas
> 
> Thanks for your information - its jks file do we have any specific command to
> pass them for renew the certificate?

You have several options:
1) use a tool like https://keystore-explorer.org/
2) fiddle around with the command line tool "keytool"
3) Change to pem files and modify the server.xml accordingly.
See https://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html for more 
information

> 
> Thanks & Regards,
> _
> PrabuGanesan
> Consultant|MS-Nordics
> capgemini India Pvt. Ltd. | Bangalore
> Contact: +91 8526554535
> Email: prabhu.c.gane...@capgemini.com
> 
> www.capgemini.com
> People matter, results count.
> __
> Connect with Capgemini:
> 
> 
> Please consider the environment and do not print this email unless absolutely
> necessary.
> Capgemini encourages environmental awareness.
> 
> -Original Message-
> From: Thomas Hoffmann (Speed4Trade GmbH)
> 
> Sent: Monday, February 19, 2024 12:49 PM
> To: Tomcat Users List 
> Subject: AW: TOMCAT CERTIFICATE RENEWAL
> 
> **This mail has been sent from an external source. Do not reply to it, or
> open any links/attachments unless you are sure of the sender's
> identity.**
> 
> Hello Ganesan,
> 
> > Von: Ganesan, Prabu 
> > Gesendet: Montag, 19. Februar 2024 08:07
> > An: Tomcat Users List 
> > Betreff: TOMCAT CERTIFICATE RENEWAL
> > Priorität: Hoch
> >
> > Hi Guys,
> > How to renew the certificate in Tomcat Can anyone provide with steps as we
> have Our tomcat certificate is about to expire in Next week, Anybody can help
> with  renew steps:
> > Tomcat version : 8.5.5.0
> > Thanks & Regards,
> > _
> > PrabuGanesan
> > Consultant|MS-Nordics
> > capgemini India Pvt. Ltd. | Bangalore
> > Contact: +91 8526554535
> 
> Take a look at the server.xml and inspect the https connector.
> There should be a reference to the key file and certificate-file.
> Depending on the used format (pem, jks etc) you need to update these files.
> 
> Greetings,
> Thomas
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> This message contains information that may be privileged or confidential and
> is the property of the Capgemini Group. It is intended only for the person to
> whom it is addressed. If you are not the intended recipient, you are not
> authorized to read, print, retain, copy, disseminate, distribute, or use this
> message or any part thereof. If you receive this message in error, please 
> notify
> the sender immediately and delete all copies of this message.
> 
> 
> -
> 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: TOMCAT CERTIFICATE RENEWAL

2024-02-18 Thread Ganesan, Prabu
Hi  Tomas 

Thanks for your information - its jks file do we have any specific command to 
pass them for renew the certificate?

Thanks & Regards,
_
PrabuGanesan
Consultant|MS-Nordics
capgemini India Pvt. Ltd. | Bangalore 
Contact: +91 8526554535
Email: prabhu.c.gane...@capgemini.com

www.capgemini.com
People matter, results count.
__
Connect with Capgemini:

 
Please consider the environment and do not print this email unless absolutely 
necessary.
Capgemini encourages environmental awareness.

-Original Message-
From: Thomas Hoffmann (Speed4Trade GmbH) 
 
Sent: Monday, February 19, 2024 12:49 PM
To: Tomcat Users List 
Subject: AW: TOMCAT CERTIFICATE RENEWAL

**This mail has been sent from an external source. Do not reply to it, or 
open any links/attachments unless you are sure of the sender's identity.**

Hello Ganesan,

> Von: Ganesan, Prabu  
> Gesendet: Montag, 19. Februar 2024 08:07
> An: Tomcat Users List 
> Betreff: TOMCAT CERTIFICATE RENEWAL
> Priorität: Hoch
>
> Hi Guys,
> How to renew the certificate in Tomcat Can anyone provide with steps as we 
>have Our tomcat certificate is about to expire in Next week, Anybody can help 
>with  renew steps:
> Tomcat version : 8.5.5.0
> Thanks & Regards,
> _
> PrabuGanesan
> Consultant|MS-Nordics
> capgemini India Pvt. Ltd. | Bangalore 
> Contact: +91 8526554535

Take a look at the server.xml and inspect the https connector.
There should be a reference to the key file and certificate-file.
Depending on the used format (pem, jks etc) you need to update these files.

Greetings,
Thomas

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


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


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



AW: TOMCAT CERTIFICATE RENEWAL

2024-02-18 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Ganesan,

> Von: Ganesan, Prabu  
> Gesendet: Montag, 19. Februar 2024 08:07
> An: Tomcat Users List 
> Betreff: TOMCAT CERTIFICATE RENEWAL
> Priorität: Hoch
>
> Hi Guys,
> How to renew the certificate in Tomcat Can anyone provide with steps as we 
>have Our tomcat certificate is about to expire in Next week, Anybody can help 
>with  renew steps:
> Tomcat version : 8.5.5.0
> Thanks & Regards,
> _
> PrabuGanesan
> Consultant|MS-Nordics
> capgemini India Pvt. Ltd. | Bangalore 
> Contact: +91 8526554535

Take a look at the server.xml and inspect the https connector.
There should be a reference to the key file and certificate-file.
Depending on the used format (pem, jks etc) you need to update these files.

Greetings,
Thomas

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



TOMCAT CERTIFICATE RENEWAL

2024-02-18 Thread Ganesan, Prabu
 Hi Guys,

 How to renew the certificate in Tomcat Can anyone provide with steps as we 
have Our tomcat certificate is about to expire in Next week, Anybody can help 
with  renew steps:

 Tomcat version : 8.5.5.0
Thanks & Regards,
_[Email_CBE.gif]
PrabuGanesan
Consultant|MS-Nordics
capgemini India Pvt. Ltd. | Bangalore
Contact: +91 8526554535
Email: prabhu.c.gane...@capgemini.com

www.capgemini.com
People matter, results count.
__
Connect with Capgemini:
[cid:image002.gif@01DA6330.47AD4A10][cid:image003.gif@01DA6330.47AD4A10][cid:image004.gif@01DA6330.47AD4A10][cid:image005.gif@01DA6330.47AD4A10][cid:image006.gif@01DA6330.47AD4A10][cid:image007.gif@01DA6330.47AD4A10]

Please consider the environment and do not print this email unless absolutely 
necessary.
Capgemini encourages environmental awareness.

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


TOMCAT CERTIFICATE RENEWAL

2024-02-18 Thread Ganesan, Prabu
 Hi Guys,

How to renew the certificate in Tomcat Can anyone provide with steps as we have 
Our tomcat certificate is about to expire in Next week, Anybody can help with  
renew steps:

Tomcat version : 8.5.5.0

Thanks & Regards,
_
PrabuGanesan
Consultant|MS-Nordics
capgemini India Pvt. Ltd. | Bangalore 
Contact: +91 8526554535
Email: prabhu.c.gane...@capgemini.com

www.capgemini.com
People matter, results count.
__
Connect with Capgemini:

 
Please consider the environment and do not print this email unless absolutely 
necessary.
Capgemini encourages environmental awareness.

-Original Message-
From: Christopher Schultz  
Sent: Friday, February 16, 2024 8:56 PM
To: users@tomcat.apache.org
Subject: Re: Tomcat/Java starts using too much memory and not by the heap or 
non-heap memory

**This mail has been sent from an external source. Do not reply to it, or 
open any links/attachments unless you are sure of the sender's identity.**

Chuck and Brian,

On 2/15/24 10:53, Chuck Caldarale wrote:
> 
>> On Feb 15, 2024, at 09:04, Brian Braun  wrote:
>>
>> I discovered the JCMD command to perform the native memory tracking. 
>> When running it, after 3-4 days since I started Tomcat, I found out 
>> that the compiler was using hundreds of MB and that is exactly why 
>> the Tomcat process starts abusing the memory! This is what I saw when 
>> executing "sudo jcmd  VM.native_memory scale=MB":
>>
>> Compiler (reserved=3D340MB, commited=3D340MB) (arena=3D340MB #10)
>>
>> Then I discovered the Jemalloc tool (http://jemalloc.net 
>> ) and its jeprof tool, so I started launching 
>> Tomcat using it. Then, after 3-4 days after Tomcat starts I was able 
>> to create some GIF images from the dumps that Jemalloc creates. The 
>> GIF files show the problem: 75-90% of the memory is being used by 
>> some weird activity in the compiler! It seems that something called 
>> "The C2 compile/JIT compiler" starts doing something after 3-4 days, and 
>> that creates the leak. Why after 3-4 days and not sooner? I don't know.
> 
> 
> There have been numerous bugs filed with OpenJDK for C2 memory leaks over the 
> past few years, mostly related to recompiling certain methods. The C2 
> compiler kicks in when fully optimizing methods, and it may recompile methods 
> after internal instrumentation shows that additional performance can be 
> obtained by doing so.
> 
> 
>> I am attaching the GIF in this email.
> 
> 
> Attachments are stripped on this mailing list.

:(

I'd love to see these.

>> Does anybody know how to deal with this?
> 
> 
> You could disable the C2 compiler temporarily, and just let C1 handle your 
> code. Performance will be somewhat degraded, but may well still be 
> acceptable. Add the following to the JVM options when you launch Tomcat:
> 
> -XX:TieredStopAtLevel=1
> 
> 
>> By the way, I'm running my website using Tomcat 9.0.58, Java 
>> "11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am 
>> developing using Eclipse and compiling my WAR file with a "Compiler 
>> compliance level:11".
> 
> 
> You could try a more recent JVM version; JDK 11 was first released over 5 
> years ago, although it is still being maintained.

There is an 11.0.22 -- just a patch-release away from what you appear to have. 
I'm not sure if it's offered through your package-manager, but you could give 
it a try directly from e.g. Eclipse Adoptium / Temurin.

Honestly, if your code runs on Java 11, it's very likely that it will run just 
fine on Java 17 or Java 21. Debian has packages for Java 17 for sure, so I 
suspect Ubuntu will have them available as well.

Debian-based distros will allow you to install and run multiple JDKs/JREs in 
parallel, so you can install Java 17 (or 21) without cutting-off access to Java 
11 if you still want it.

-chris

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

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


Tomcat Manager 403's with LDAP Realm

2024-02-17 Thread Dan McLaughlin
We've had the same LDAP realm configured for probably 10 years, and the
same roles in our LDAP for probably the same.  We have 4 roles configured
in LDAP manager-gui, manager-jmx, manager-script, and manager-status.  My
user only has the manager-gui role.  Everything has worked fine up until
about the time we moved to Tomcat 10.1.   Now, I can log in just fine, but
if I try to click stop, start, reload, or undeploy, I always get a 403.  I
don't see any errors in the logs telling me why.  Does anyone have pointers
on debugging this?  My user only has the manager-gui role; the only users
with the JMX or script roles are the users I use for Nagios monitoring of
JMX parameters.

FYI... I can't reproduce it using Tomcat 10.1 running in docker using the
same LDAP realm configuration, so that tells me it has nothing to do with
the roles not being correct...and they should be correct since they haven't
changed since I set things up probably 10 years ago.   The only change has
been the upgrade of Tomcat.  Could CSRF somehow be involved?  It might be
about when CSRF was introduced that I started having issues. I haven't
tried removing the filter yet, only because it really doesn't seem related
based on my understanding of how the filter works.

If someone knows the specific packages, I might want to bump up the logging
on; that would probably be most helpful at this point.

Cheers!

Dan

-- 








*NOTICE:* This e-mail message and all attachments transmitted with 
it are for the sole use of the intended recipient(s) and may contain 
confidential and privileged information. Any unauthorized review, use, 
disclosure, ​or distribution is strictly prohibited. The contents of this 
e-mail are confidential and may be subject to work product privileges. If 
you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.





Re: Compile with JDK 17, run on JRE 11?

2024-02-17 Thread Mark Thomas

On 17/02/2024 16:01, Troels Arvin wrote:

Hello,

Since 9.0.83, building Tomcat has required JDK 17, according to the 
release notes.


Is it possible to take the resulting binaries and run them on JRE 11?


Yes. The minimum Java version at runtime (8) is unchanged.

Mark

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



Compile with JDK 17, run on JRE 11?

2024-02-17 Thread Troels Arvin

Hello,

Since 9.0.83, building Tomcat has required JDK 17, according to the 
release notes.


Is it possible to take the resulting binaries and run them on JRE 11?

--
Regards,
Troels Arvin


Re: Long lasting websocket sessions

2024-02-16 Thread Alex O'Ree
No devices in-between, browser to local host. Good feedback though, I'll
try to reproduce with the snake app
Thanks!

On Fri, Feb 16, 2024, 2:47 PM Chuck Caldarale  wrote:

>
> > On Feb 16, 2024, at 11:31, Mark Thomas  wrote:
> >
> > On 09/02/2024 13:47, Alex O'Ree wrote:
> >> I've been experimenting with tomcat 9.x in seeing how long i can get a
> web
> >> socket session to last. I'm currently struggling to get past 30 minutes
> or
> >> so. Looking for guidance on how to best increase this or if this is a
> bad
> >> idea.
> >> Here's the current configuration and what i've tried thus far:
> >> The server continuously streams messages the client, about 1 per second
> >> The client periodically (every 30 seconds) sends a keep alive text
> message
> >> back to the server
> >> The server side endpoint sets the Session.setTimeout(0); according to
> the
> >> docs, this should prevent timeouts
> >> The server side WAR file/WEB-INF/web.xml had a session timeout defined
> at
> >> 15 minutes but i then removed it in order to increase the websocket
> >> duration.
> >> Despite all this, both the client and server log a session disconnect,
> but
> >> i'm still not sure what the reasoning is. I'm still assuming it's some
> kind
> >> of timeout mechanism.
> >
> > I think you need to do a little more investigation with your
> application. I've been running the snake WebSocket example on 9.0.x for
> over any hour wihtout any issues.
>
>
> Are there any boxes (eg, load balancer, firewall) between the client and
> server that might be forcibly dropping TCP connections after 30 minutes?
>
>   - Chuck
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Long lasting websocket sessions

2024-02-16 Thread Chuck Caldarale


> On Feb 16, 2024, at 11:31, Mark Thomas  wrote:
> 
> On 09/02/2024 13:47, Alex O'Ree wrote:
>> I've been experimenting with tomcat 9.x in seeing how long i can get a web
>> socket session to last. I'm currently struggling to get past 30 minutes or
>> so. Looking for guidance on how to best increase this or if this is a bad
>> idea.
>> Here's the current configuration and what i've tried thus far:
>> The server continuously streams messages the client, about 1 per second
>> The client periodically (every 30 seconds) sends a keep alive text message
>> back to the server
>> The server side endpoint sets the Session.setTimeout(0); according to the
>> docs, this should prevent timeouts
>> The server side WAR file/WEB-INF/web.xml had a session timeout defined at
>> 15 minutes but i then removed it in order to increase the websocket
>> duration.
>> Despite all this, both the client and server log a session disconnect, but
>> i'm still not sure what the reasoning is. I'm still assuming it's some kind
>> of timeout mechanism.
> 
> I think you need to do a little more investigation with your application. 
> I've been running the snake WebSocket example on 9.0.x for over any hour 
> wihtout any issues.


Are there any boxes (eg, load balancer, firewall) between the client and server 
that might be forcibly dropping TCP connections after 30 minutes?

  - Chuck


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



Re: Long lasting websocket sessions

2024-02-16 Thread Mark Thomas

On 09/02/2024 13:47, Alex O'Ree wrote:

I've been experimenting with tomcat 9.x in seeing how long i can get a web
socket session to last. I'm currently struggling to get past 30 minutes or
so. Looking for guidance on how to best increase this or if this is a bad
idea.

Here's the current configuration and what i've tried thus far:

The server continuously streams messages the client, about 1 per second
The client periodically (every 30 seconds) sends a keep alive text message
back to the server
The server side endpoint sets the Session.setTimeout(0); according to the
docs, this should prevent timeouts
The server side WAR file/WEB-INF/web.xml had a session timeout defined at
15 minutes but i then removed it in order to increase the websocket
duration.

Despite all this, both the client and server log a session disconnect, but
i'm still not sure what the reasoning is. I'm still assuming it's some kind
of timeout mechanism.


I think you need to do a little more investigation with your 
application. I've been running the snake WebSocket example on 9.0.x for 
over any hour wihtout any issues.


Mark

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



Re: ConnectionPool JDBC vs. DBCP

2024-02-16 Thread Christopher Schultz

Andreas,

On 2/16/24 02:21, Döscher, Andreas (ESI) wrote:

Moin,
in the docpage https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html it says


The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an 
alternative to the Apache Commons DBCP connection pool.

So why do we need a new connection pool?

Here are a few of the reasons:

Commons DBCP 1.x is single threaded. In order to be thread safe Commons 
locks the entire pool for short periods during both object allocation and 
object return. Note that this does not apply to Commons DBCP 2.x.

[...snip...]

I thought that Tomcat uses DBCP 2.x per default, is this document still 
relevant or is it outdated?


Recent versions of Tomcat do indeed use DBCP2.

You are reading the documentation for the pool itself, which is 
justifying the reason it was developed in the first place, back when 
Tomcat shipped with DBCP1. DBCP2 was created for many of the same 
reasons tomcat-pool was created, just on different schedules.


This document could be updated to make it clear that the comparison of 
tomcat-pool against DBCP1 is a historical comparison, and that Tomcat 
now uses DBCP2 by default which does not suffer from the same problems 
tomcat-pool was designed to address.


There are some significant architectural and feature differences between 
DBCP2 and tomcat-pool which is why we haven't shut the sub-project down.


-chris

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



Re: Tomcat/Java starts using too much memory and not by the heap or non-heap memory

2024-02-16 Thread Christopher Schultz

Chuck and Brian,

On 2/15/24 10:53, Chuck Caldarale wrote:



On Feb 15, 2024, at 09:04, Brian Braun  wrote:

I discovered the JCMD command to perform the native memory tracking. When
running it, after 3-4 days since I started Tomcat, I found out that the
compiler was using hundreds of MB and that is exactly why the Tomcat
process starts abusing the memory! This is what I saw when executing "sudo jcmd 
 VM.native_memory scale=MB":

Compiler (reserved=3D340MB, commited=3D340MB)
(arena=3D340MB #10)

Then I discovered the Jemalloc tool (http://jemalloc.net 
) and its jeprof
tool, so I started launching Tomcat using it. Then, after 3-4 days after
Tomcat starts I was able to create some GIF images from the dumps that
Jemalloc creates. The GIF files show the problem: 75-90% of the memory is
being used by some weird activity in the compiler! It seems that something
called "The C2 compile/JIT compiler" starts doing something after 3-4 days,
and that creates the leak. Why after 3-4 days and not sooner? I don't know.



There have been numerous bugs filed with OpenJDK for C2 memory leaks over the 
past few years, mostly related to recompiling certain methods. The C2 compiler 
kicks in when fully optimizing methods, and it may recompile methods after 
internal instrumentation shows that additional performance can be obtained by 
doing so.



I am attaching the GIF in this email.



Attachments are stripped on this mailing list.


:(

I'd love to see these.


Does anybody know how to deal with this?



You could disable the C2 compiler temporarily, and just let C1 handle your 
code. Performance will be somewhat degraded, but may well still be acceptable. 
Add the following to the JVM options when you launch Tomcat:

-XX:TieredStopAtLevel=1



By the way, I'm running my website using Tomcat 9.0.58, Java
"11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am developing
using Eclipse and compiling my WAR file with a "Compiler compliance
level:11".



You could try a more recent JVM version; JDK 11 was first released over 5 years 
ago, although it is still being maintained.


There is an 11.0.22 -- just a patch-release away from what you appear to 
have. I'm not sure if it's offered through your package-manager, but you 
could give it a try directly from e.g. Eclipse Adoptium / Temurin.


Honestly, if your code runs on Java 11, it's very likely that it will 
run just fine on Java 17 or Java 21. Debian has packages for Java 17 for 
sure, so I suspect Ubuntu will have them available as well.


Debian-based distros will allow you to install and run multiple 
JDKs/JREs in parallel, so you can install Java 17 (or 21) without 
cutting-off access to Java 11 if you still want it.


-chris

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



ConnectionPool JDBC vs. DBCP

2024-02-15 Thread ESI
Moin,
in the docpage https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html it says

>The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an 
>alternative to the Apache Commons DBCP connection pool.
>
>So why do we need a new connection pool?
>
>Here are a few of the reasons:
>
>Commons DBCP 1.x is single threaded. In order to be thread safe Commons 
> locks the entire pool for short periods during both object allocation and 
> object return. Note that this does not apply to Commons DBCP 2.x.
[...snip...]

I thought that Tomcat uses DBCP 2.x per default, is this document still 
relevant or is it outdated?

Thanks,
  Andreas



This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, notify the sender immediately by return email and delete the message 
and any attachments from your system.

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



Re: Tomcat/Java starts using too much memory and not by the heap or non-heap memory

2024-02-15 Thread Chuck Caldarale

> On Feb 15, 2024, at 09:04, Brian Braun  wrote:
> 
> I discovered the JCMD command to perform the native memory tracking. When
> running it, after 3-4 days since I started Tomcat, I found out that the
> compiler was using hundreds of MB and that is exactly why the Tomcat
> process starts abusing the memory! This is what I saw when executing "sudo 
> jcmd  VM.native_memory scale=MB":
> 
> Compiler (reserved=3D340MB, commited=3D340MB)
> (arena=3D340MB #10)
> 
> Then I discovered the Jemalloc tool (http://jemalloc.net 
> ) and its jeprof
> tool, so I started launching Tomcat using it. Then, after 3-4 days after
> Tomcat starts I was able to create some GIF images from the dumps that
> Jemalloc creates. The GIF files show the problem: 75-90% of the memory is
> being used by some weird activity in the compiler! It seems that something
> called "The C2 compile/JIT compiler" starts doing something after 3-4 days,
> and that creates the leak. Why after 3-4 days and not sooner? I don't know.


There have been numerous bugs filed with OpenJDK for C2 memory leaks over the 
past few years, mostly related to recompiling certain methods. The C2 compiler 
kicks in when fully optimizing methods, and it may recompile methods after 
internal instrumentation shows that additional performance can be obtained by 
doing so.


> I am attaching the GIF in this email.


Attachments are stripped on this mailing list.


> Does anybody know how to deal with this?


You could disable the C2 compiler temporarily, and just let C1 handle your 
code. Performance will be somewhat degraded, but may well still be acceptable. 
Add the following to the JVM options when you launch Tomcat:

-XX:TieredStopAtLevel=1


> By the way, I'm running my website using Tomcat 9.0.58, Java
> "11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am developing
> using Eclipse and compiling my WAR file with a "Compiler compliance
> level:11".


You could try a more recent JVM version; JDK 11 was first released over 5 years 
ago, although it is still being maintained.


  - Chuck

Re: Tomcat/Java starts using too much memory and not by the heap or non-heap memory

2024-02-15 Thread Brian Braun
Hello,

It has been a long time since I received the last suggestions to my issue
here on this support list. Since then I decided to stop asking for help and
to "do my homework". To read, to watch YouTube presentations, to spend time
on StackOverflow, etc. So I have spent a lot of time on this and I think I
have learned a lot which is nice.
This is what I have learned lately:

I definitely don't have a leak in my code (or in the libraries I am using,
as far as I understand). And my code is not creating a significant amount
of objects that would use too much memory.
The heap memory (the 3 G1s) and non-heap memory (3 CodeHeaps + compressed
class space + metaspace) together use just using a few hundred MBs and
their usage is steady and normal.
I discovered the JCMD command to perform the native memory tracking. When
running it, after 3-4 days since I started Tomcat, I found out that the
compiler was using hundreds of MB and that is exactly why the Tomcat
process starts abusing the memory! This is what I saw when executing "sudo
jcmd  VM.native_memory scale=MB":

Compiler (reserved=3D340MB, commited=3D340MB)
(arena=3D340MB #10)

All the other categories (Class, Thread, Code, GC, Internal, Symbol, etc)
look normal since they use a low amount of memory and they don't grow.

Then I discovered the Jemalloc tool (http://jemalloc.net) and its jeprof
tool, so I started launching Tomcat using it. Then, after 3-4 days after
Tomcat starts I was able to create some GIF images from the dumps that
Jemalloc creates. The GIF files show the problem: 75-90% of the memory is
being used by some weird activity in the compiler! It seems that something
called "The C2 compile/JIT compiler" starts doing something after 3-4 days,
and that creates the leak. Why after 3-4 days and not sooner? I don't know.
I am attaching the GIF in this email.

Does anybody know how to deal with this? I have been struggling with this
issue already for 3 months. At least now I know that this is a native
memory leak, but at this point I feel lost.

By the way, I'm running my website using Tomcat 9.0.58, Java
"11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am developing
using Eclipse and compiling my WAR file with a "Compiler compliance
level:11".

Thanks in advance!

Brian

On Mon, Jan 8, 2024 at 10:05 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Brian,
>
> On 1/5/24 17:21, Brian Braun wrote:
> > Hello Chirstopher,
> >
> > First of all: thanks a lot for your responses!
> >
> > On Wed, Jan 3, 2024 at 9:25 AM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Brian,
> >>
> >> On 12/30/23 15:42, Brian Braun wrote:
> >>> At the beginning, this was the problem: The OOM-killer (something that
> I
> >>> never knew existed) killing Tomcat unexpectedly and without any
> >>> explanation
> >>
> >> The explanation is always the same: some application requests memory
> >> from the kernel, which always grants the request(!). When the
> >> application tries to use that memory, the kernel scrambles to physically
> >> allocate the memory on-demand and, if all the memory is gone, it will
> >> pick a process and kill it.
>  >
> > Yes, that was happening to me until I set up the SWAP file and now at
> least
> > the Tomcat process is not being killed anymore.
>
> Swap can get you out of a bind like this, but it will ruin your
> performance. If you care more about stability (and believe me, it's a
> reasonable decision), then leave the swap on. But swap will kill (a)
> performance (b) SSD lifetime and (c) storage/transaction costs depending
> upon your environment. Besides, you either need the memory or you do
> not. It's rare to "sometimes" need the memory.
>
> >> Using a swap file is probably going to kill your performance. What
> >> happens if you make your heap smaller?
>  >
> > Yes, in fact the performance is suffering and that is why I don't
> consider
> > the swap file as a solution.
>
> :D
>
> > I have assigned to -Xmx both small amounts (as small as 300MB) and high
> > amounts (as high as 1GB) and the problem is still present (the Tomcat
> > process grows in memory usage up to 1.5GB combining real memory and swap
> > memory).
>
> Okay, that definitely indicates a problem that needs to be solved.
>
> I've seen things like native ZIP handling code leaking native memory,
> but I know that Tomcat does not leak like that. If you do anything in
> your application that might leave file handles open, it could be
> contributing to the problem.
>
> > As I have explained in another email recently, I think that neither heap
> > usage nor non-heap usage are the problem. I have been monitoring them and
> > their requirements have always stayed low enough, so I could leave the
> -Xms
> > parameter with about 300-400 MB and that would be enough.
>
> Well, between heap and non-heap, that's all the memory. There is no
> non-heap-non-non-heap memory to be counted. Technically stack space is
> the same as "native memory" but usually 

Re: Tomcat/Java starts using too much memory and not by the heap or non-heap memory

2024-02-15 Thread Brian Braun
Hello,

It has been a long time since I received the last suggestions to my issue
here on this support list. Since then I decided to stop asking for help and
to "do my homework". To read, to watch YouTube presentations, to spend time
on StackOverflow, etc. So I have spent a lot of time on this and I think I
have learned a lot which is nice.
This is what I have learned lately:

I definitely don't have a leak in my code (or in the libraries I am using,
as far as I understand). And my code is not creating a significant amount
of objects that would use too much memory.
The heap memory (the 3 G1s) and non-heap memory (3 CodeHeaps + compressed
class space + metaspace) together use just using a few hundred MBs and
their usage is steady and normal.
I discovered the JCMD command to perform the native memory tracking. When
running it, after 3-4 days since I started Tomcat, I found out that the
compiler was using hundreds of MB and that is exactly why the Tomcat
process starts abusing the memory! This is what I saw when executing "sudo
jcmd  VM.native_memory scale=MB":

Compiler (reserved=3D340MB, commited=3D340MB)
(arena=3D340MB #10)

All the other categories (Class, Thread, Code, GC, Internal, Symbol, etc)
look normal since they use a low amount of memory and they don't grow.

Then I discovered the Jemalloc tool (http://jemalloc.net) and its jeprof
tool, so I started launching Tomcat using it. Then, after 3-4 days after
Tomcat starts I was able to create some GIF images from the dumps that
Jemalloc creates. The GIF files show the problem: 75-90% of the memory is
being used by some weird activity in the compiler! It seems that something
called "The C2 compile/JIT compiler" starts doing something after 3-4 days,
and that creates the leak. Why after 3-4 days and not sooner? I don't know.
I am attaching the GIF in this email.

Does anybody know how to deal with this? I have been struggling with this
issue already for 3 months. At least now I know that this is a native
memory leak, but at this point I feel lost.

By the way, I'm running my website using Tomcat 9.0.58, Java
"11.0.21+9-post-Ubuntu-0ubuntu122.04", Ubuntu 22.04.03. And I am developing
using Eclipse and compiling my WAR file with a "Compiler compliance
level:11".

Thanks in advance!

Brian



On Mon, Jan 8, 2024 at 10:05 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Brian,
>
> On 1/5/24 17:21, Brian Braun wrote:
> > Hello Chirstopher,
> >
> > First of all: thanks a lot for your responses!
> >
> > On Wed, Jan 3, 2024 at 9:25 AM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> >> Brian,
> >>
> >> On 12/30/23 15:42, Brian Braun wrote:
> >>> At the beginning, this was the problem: The OOM-killer (something that
> I
> >>> never knew existed) killing Tomcat unexpectedly and without any
> >>> explanation
> >>
> >> The explanation is always the same: some application requests memory
> >> from the kernel, which always grants the request(!). When the
> >> application tries to use that memory, the kernel scrambles to physically
> >> allocate the memory on-demand and, if all the memory is gone, it will
> >> pick a process and kill it.
>  >
> > Yes, that was happening to me until I set up the SWAP file and now at
> least
> > the Tomcat process is not being killed anymore.
>
> Swap can get you out of a bind like this, but it will ruin your
> performance. If you care more about stability (and believe me, it's a
> reasonable decision), then leave the swap on. But swap will kill (a)
> performance (b) SSD lifetime and (c) storage/transaction costs depending
> upon your environment. Besides, you either need the memory or you do
> not. It's rare to "sometimes" need the memory.
>
> >> Using a swap file is probably going to kill your performance. What
> >> happens if you make your heap smaller?
>  >
> > Yes, in fact the performance is suffering and that is why I don't
> consider
> > the swap file as a solution.
>
> :D
>
> > I have assigned to -Xmx both small amounts (as small as 300MB) and high
> > amounts (as high as 1GB) and the problem is still present (the Tomcat
> > process grows in memory usage up to 1.5GB combining real memory and swap
> > memory).
>
> Okay, that definitely indicates a problem that needs to be solved.
>
> I've seen things like native ZIP handling code leaking native memory,
> but I know that Tomcat does not leak like that. If you do anything in
> your application that might leave file handles open, it could be
> contributing to the problem.
>
> > As I have explained in another email recently, I think that neither heap
> > usage nor non-heap usage are the problem. I have been monitoring them and
> > their requirements have always stayed low enough, so I could leave the
> -Xms
> > parameter with about 300-400 MB and that would be enough.
>
> Well, between heap and non-heap, that's all the memory. There is no
> non-heap-non-non-heap memory to be counted. Technically stack space is
> the same as "native memory" but 

Re: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-13 Thread Mark Thomas

On 09/02/2024 16:26, Rick Noel wrote:

Thank you so much Mark for working with me on this issue!
I am taking your recommendation to create a   webapps-javaee directory and 
place my Tomcat 9 running war file into
that dir so that Tomcat does the compile correctly.

Only problem is that now I cannot figure out what is the correct URL path to my 
servlet!

When I place the .war, the old way with the .war  being in  
webapps/transaction,my tomcat cat log says...

Deploying web application directory [C:\apache-tomcat-9.0.73\webapps\transaction
And I see my application at
C:\apache-tomcat-9.0.73\webapps\transaction\ROOT##0001

And I can hit my servlet via...

http://localhost:8588/XmlRpc


That is all very non-standard.

What I would expect to see is:

foo.war deployed to $CATALINA_BASE/webapps/foo.war and then accessed at 
http://localhost:port/foo


In server.xml what do you have configured for the Host's appBase ? Is it 
"webapps/transaction" ?


Mark




BUT when I place my .war in webapps-javaee\transaction the tomcat cat log 
says..

Deploying web application directory 
[C:\apache-tomcat-10.1.18\webapps-javaee\transaction\transaction

And I cannot hit either..

http://localhost:8588/XmlRpc
or
http://localhost:8588/transaction/XmlRpc


The creation of the 
C:\apache-tomcat-10.1.18\webapps-javaee\transaction\transaction  directory is 
baffling me
See attached file

I expect only to see the creation of a 
C:\apache-tomcat-10.1.18\webapps-javaee\transaction\ROOT##0001 directory.
That is where I believe my application to be

Here is how I have my context defined in server.xml..



Is my server.xml wrong?
When I place my .war in   webapps-javaee\transaction   dir?




-Original Message-
From: Mark Thomas 
Sent: Thursday, February 8, 2024 5:45 PM
To: users@tomcat.apache.org
Subject: Re: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

Confirmed this is user error. There is no bug in the migration tool.

Steps to demonstrate this:

- Create new, blank Eclipse dynamic web project
- Add provided servlet code
- Add required libraries
- Remove referenced to internal logging code
- Add web.xml with basic mapping to "/test"
- Export WAR file
- Deploy to Tomcat
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. That is fine.
It proves that the servlet was loaded which is all we care about at this point.

- Use migration tool to migrate WAR
- Deploy migrated WAR to Tomcat 10.1.x
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. Again, this is fine as 
it proves that the Servlet has been converted correctly and can be loaded by 
Tomcat 10.1.x.

Best guess, the Eclipse project isn't configured correctly to compile the web 
application for Tomcat 10.1.x.

At this point the simplest solution is likely to be:

- take the WAR file that works on Tomcat 9
- drop in webapps-javaee in Tomcat 10 and let Tomcat convert it
automatically

Mark


On 08/02/2024 20:28, Rick Noel wrote:

No I cannot compile from command line.

But I do not really care how eclipse compiles my class anyway.
All I know is that eclipse compiles the class without errors. Using
the jars I tell it to. (all the jars run through the migration tool) But Tomcat 
10 can not compile the class using those same migrated jar files.

And my class has no use of javax.server  classes in it.
All the javax.server classes are only in the third part jar files
which are supposed to have been converted to use  jakarta.server
classes

Is this not a bug with Tomcat migration tool?

Again here is my class that does not compile on Tomcat 10...
It has no reference to  javax.server


package com.radiovoodoo.xmlrpc;

import java.io.IOException;
import java.net.MalformedURLException; import java.net.URL;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest; import
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.Authenticati
onHandler; import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.XmlRpcServlet;

import com.radiovoodoo.util.Log;

/**
   * @(#)RVXmlRpcServlet.java
   *
   * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
   *
   * @author  Hank Zill 
   * @version 1.0
   *
   * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
   */

public class RVXmlRpcServlet
 extends XmlRpcServlet
{
 /**
  *  this init parameter defines the path to the property file from
  *  which to load the XML RPC handler mappings.
  *
  *  the path is relative to the CLASSPATH
  */
 public static final String RESOURCE_PATH = "property-file-path";

 protected XmlRpcHandlerMapping newXmlRpcHandlerMapping()
throws XmlRpcException
 {

Re: [ANN] Apache Tomcat Native 1.3.0 released

2024-02-13 Thread Mark Thomas

On 13/02/2024 10:21, Michael Osipov wrote:

On 2024/02/13 08:46:42 Mark Thomas wrote:

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

The key features of this release are:

- The minimum supported OpenSSL version is 1.1.1
- The minimum supported APR version in 1.6.3
- The windows binaries in this release have been built with OpenSSL
3.0.13

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


This link is wrong, it leads me to Tomcat Native 2.0.x.


Sorry. Copy/paste error. The correct link is:

https://tomcat.apache.org/native-1.3-doc/miscellaneous/changelog.html

Mark

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



Re: [ANN] Apache Tomcat Native 1.3.0 released

2024-02-13 Thread Michael Osipov
On 2024/02/13 08:46:42 Mark Thomas wrote:
> The Apache Tomcat team announces the immediate availability of Apache
> Tomcat Native 1.3.0 stable.
> 
> The key features of this release are:
> 
> - The minimum supported OpenSSL version is 1.1.1
> - The minimum supported APR version in 1.6.3
> - The windows binaries in this release have been built with OpenSSL
>3.0.13
> 
> Please refer to the change log for the complete list of changes:
> http://tomcat.apache.org/native-doc/miscellaneous/changelog.html

This link is wrong, it leads me to Tomcat Native 2.0.x.

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



[ANN] Apache Tomcat Native 1.3.0 released

2024-02-13 Thread Mark Thomas

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

The key features of this release are:

- The minimum supported OpenSSL version is 1.1.1
- The minimum supported APR version in 1.6.3
- The windows binaries in this release have been built with OpenSSL
  3.0.13

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



[ANN] Apache Tomcat Native 2.0.7 released

2024-02-13 Thread Mark Thomas

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

The key features of this release are:

- Align default pass phrase prompt with httpd on Windows
- The windows binaries in this release have been built with OpenSSL
  3.0.13

The 2.0.x branch is primarily intended for use with Tomcat 10.1.x or 
later but can be used with earlier versions as long as the APR/native 
connector is not used.


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 2.0.x provides an API for using OpenSSL 
for SSL networking with Apache Tomcat.


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



Re: Persistent Manager Implementation Question

2024-02-12 Thread Miguel Vidal
Yes both are pointing the same configuration because i was doing some
testing how it works all of this about session, i wasnt able to get it to
work in a new application just using spring boot , but i just did it on
friday. what i was missing it was use the session and not only a getter or
endpoint without any use of the session.
 it seems to get it to  work that you need to use the session, the
configuration is already working


   



jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
with this configuration my both application are working fine

and also i created in the new application how to test it :

@GetMapping("/create")
public String testSession(HttpSession session) {
// Add a session attribute
session.setAttribute("testAttribute", "testValue");

// Get the session ID
String sessionId = session.getId();

return "Session created with ID: " + sessionId + " and attribute added";
}

@GetMapping("/getse")
public String getSessionAttribute(HttpSession session) {
// Get the session ID

String sessionId = session.getId();

// Retrieve session attribute
String attributeValue = (String) session.getAttribute("testAttribute");

if (attributeValue != null) {
return "Session ID: " + sessionId + ", Attribute value: " +
attributeValue;
} else {
return "Session ID: " + sessionId + ", Attribute not found";
}
}

and also added a filter to validate to create it correctly

@Component
public class SessionValidationFilter extends OncePerRequestFilter {

protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain filterChain) throws
ServletException, IOException {
String requestURI = request.getRequestURI();

// Exclude the create-session endpoint from filtering
if (requestURI.equals("/demo/create")) {
filterChain.doFilter(request, response);
return;
}

HttpSession session = request.getSession(false); // Do not
create session if it doesn't exist

if (session != null && session.getId() != null) {
// Session is valid, proceed with the request
filterChain.doFilter(request, response);
} else {
// Session is invalid, return an error response
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
"Session expired or not authenticated");
}
}
}


El lun, 12 feb 2024 a las 9:18, Christopher Schultz (<
ch...@christopherschultz.net>) escribió:

> Miguel,
>
> On 2/8/24 15:49, Miguel Vidal wrote:
> > Im trying to configure correctly in 2 different applications : Persistent
> > Manager Implementation using a mysqldb as a datasource.
>
> Do you have both PersistentManager configurations pointing at the same
> database and same set of tables? I think it will be rare to have session
> id collisions, but configuring both applications to use the same storage
> may cause very difficult to discover bugs under high usage.
>
> It will also increase lock contention needlessly across the two
> applications.
>
> -chris
>
> > In one of them that is a legacy project i have some dependencies as
> >
> > 
> >  org.springframework
> >  spring-core
> >  ${spring.framework.version}
> > 
> >
> > 
> >  org.springframework
> >  spring-context
> >  ${spring.framework.version}
> > 
> >
> > and it is already doing the registry of the sessions in my bd.
> > but in the other app im using a spring boot with the same configuration.
> > I'm not able to see any registration of the sessions in my db. After the
> > deploy of my app in a tomcat server and hit any resource example
> > /test/resource im able to see the response correctly but i just want to
> > know if this  Persistent Manager Implementation is only for legacy apps?
> or
> > why is running in one and in the other is not.
> >
> > this is my xml for both
> >
> > 
> >  > reloadable="true" useHttpOnly="true"  cookies="${uses.cookies}" >
> >
> >   > className="org.apache.catalina.session.PersistentManager"
> > maxInactiveInterval="3600" debug="0" saveOnRestart="true"
> > maxActiveSessions="-1" minIdleSwap="1" maxIdleSwap="2"
> > maxIdleBackup="1" >
> >   > dataSourceName="jdbc/tomcat"
> > driverName="com.mysql.jdbc.Driver"
> > sessionAppCol="app_name"
> > sessionDataCol="session_data"
> > sessionIdCol="session_id"
> > sessionLastAccessedCol="last_access"
> > sessionMaxInactiveCol="max_inactive"
> > sessionTable="tomcat_sessions"
> > sessionValidCol="valid_session"
> >  />
> >  
> >
> >   >  name="jdbc/tomcat"
> >  

Re: [OT] Tomcat not syncing existing sessions on restart

2024-02-12 Thread Christopher Schultz

Manak,

On 2/12/24 10:33, Manak Bisht wrote:

Chris,

On Mon, 12 Feb 2024, 20:52 Christopher Schultz, <
ch...@christopherschultz.net> wrote:


I wouldn't refuse to configure, since anyone using
0.0.0.0 with /separate/ hosts wouldn't experience this problem.



I am using separate hosts (two docker containers on two different machines)
in my main deployment. I just reproduced the problem on the same host to
rule out network issues.


Thanks for the clarification. For some reason, I thought this was two 
Docker containers on the same host.


-chris

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



Re: [OT] Tomcat not syncing existing sessions on restart

2024-02-12 Thread Manak Bisht
Chris,

On Mon, 12 Feb 2024, 20:52 Christopher Schultz, <
ch...@christopherschultz.net> wrote:

> I wouldn't refuse to configure, since anyone using
> 0.0.0.0 with /separate/ hosts wouldn't experience this problem.


I am using separate hosts (two docker containers on two different machines)
in my main deployment. I just reproduced the problem on the same host to
rule out network issues.

Sincerely,
Manak Bisht


Re: Tomcat Instance unable to connect to DB with TCPS

2024-02-12 Thread Christopher Schultz

Michael,

On 2/8/24 21:54, Kebret, Michael wrote:

Tomcat version 9.0.83 running on Linux  redhat 7 java 11.0.20.

When changing the protocol from TCP to TCPS in Catalina.properties
and in server.xml we have attribute truststorePassword= (tested with
both cleartext and encrypted) password connection is refused to the
DB and get the below exceptions. However, when we add
-Djavax.net.ssl.trustStorePassword=cleartext to setenv.sh the
connection is made successfully. Wanted to see if anyone has faced
something similar or have any suggestions on how I can get TCPS
working without having to use -D option in setenv.sh >
java.sql.SQLException: Unable to start the Universal Connection Pool:
oracle.ucp.UniversalConnectionPoolException: Cannot get Connection
from Datasource: java.sql.SQLRecoverableException: IO Error: The
Network Adapter could not establish the connection
You probably do not want to set a JVM-wide default trust store password. 
Instead, you probably want to use your JDBC connection URL to pass the 
trust store location and password directly to the driver.


Something like

jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE?truststore=/etc/myapp/db.p12=changeit

Have a look at 
https://docs.oracle.com/cd/E13222_01/wls/docs81/jdbc_drivers/oracle.html#1066413 
for inspiration. I'm not sure if this is the driver you are using or not.


I don't see anything in there that applies. :(

Perhaps Oracle's driver really does require that you use JVM-wide trust 
store and password? Super-yuck.


-chris

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



Re: [OT] Tomcat not syncing existing sessions on restart

2024-02-12 Thread Christopher Schultz

Mark,

On 2/9/24 06:14, Mark Thomas wrote:
With the Receiver using address="0.0.0.0" I see the same issues you do. 
I'm not yet convinced that is a bug.


If this is known to essentially always not-work... should we log 
something at startup? I wouldn't refuse to configure, since anyone using 
0.0.0.0 with /separate/ hosts wouldn't experience this problem.


-chris

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



Re: Persistent Manager Implementation Question

2024-02-12 Thread Christopher Schultz

Miguel,

On 2/8/24 15:49, Miguel Vidal wrote:

Im trying to configure correctly in 2 different applications : Persistent
Manager Implementation using a mysqldb as a datasource.


Do you have both PersistentManager configurations pointing at the same 
database and same set of tables? I think it will be rare to have session 
id collisions, but configuring both applications to use the same storage 
may cause very difficult to discover bugs under high usage.


It will also increase lock contention needlessly across the two 
applications.


-chris


In one of them that is a legacy project i have some dependencies as


 org.springframework
 spring-core
 ${spring.framework.version}



 org.springframework
 spring-context
 ${spring.framework.version}


and it is already doing the registry of the sessions in my bd.
but in the other app im using a spring boot with the same configuration.
I'm not able to see any registration of the sessions in my db. After the
deploy of my app in a tomcat server and hit any resource example
/test/resource im able to see the response correctly but i just want to
know if this  Persistent Manager Implementation is only for legacy apps? or
why is running in one and in the other is not.

this is my xml for both




 
 
 

 
 jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
 org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
 org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"

these 2  are the guides where i learn the mayority how to do it
https://svn.apache.org/repos/asf/tomcat/archive/tc4.1.x/trunk/container/catalina/docs/JDBCStore-howto.html
https://gerrytan.wordpress.com/2013/08/21/tomcat-7-jdbc-session-persistence/

im going to attach the code that im trying to know why is not working.



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



RE: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-09 Thread Rick Noel
Thank you so much Mark for working with me on this issue!
I am taking your recommendation to create a   webapps-javaee directory and 
place my Tomcat 9 running war file into
that dir so that Tomcat does the compile correctly.

Only problem is that now I cannot figure out what is the correct URL path to my 
servlet!

When I place the .war, the old way with the .war  being in  
webapps/transaction,my tomcat cat log says...

Deploying web application directory [C:\apache-tomcat-9.0.73\webapps\transaction
And I see my application at 
C:\apache-tomcat-9.0.73\webapps\transaction\ROOT##0001

And I can hit my servlet via...

http://localhost:8588/XmlRpc

BUT when I place my .war in webapps-javaee\transaction the tomcat cat log 
says..

Deploying web application directory 
[C:\apache-tomcat-10.1.18\webapps-javaee\transaction\transaction

And I cannot hit either..

http://localhost:8588/XmlRpc 
or
http://localhost:8588/transaction/XmlRpc


The creation of the 
C:\apache-tomcat-10.1.18\webapps-javaee\transaction\transaction  directory is 
baffling me
See attached file

I expect only to see the creation of a 
C:\apache-tomcat-10.1.18\webapps-javaee\transaction\ROOT##0001 directory.
That is where I believe my application to be

Here is how I have my context defined in server.xml..



Is my server.xml wrong?
When I place my .war in   webapps-javaee\transaction   dir?




-Original Message-
From: Mark Thomas  
Sent: Thursday, February 8, 2024 5:45 PM
To: users@tomcat.apache.org
Subject: Re: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

Confirmed this is user error. There is no bug in the migration tool.

Steps to demonstrate this:

- Create new, blank Eclipse dynamic web project
- Add provided servlet code
- Add required libraries
- Remove referenced to internal logging code
- Add web.xml with basic mapping to "/test"
- Export WAR file
- Deploy to Tomcat
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. That is fine.
It proves that the servlet was loaded which is all we care about at this point.

- Use migration tool to migrate WAR
- Deploy migrated WAR to Tomcat 10.1.x
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. Again, this is fine as 
it proves that the Servlet has been converted correctly and can be loaded by 
Tomcat 10.1.x.

Best guess, the Eclipse project isn't configured correctly to compile the web 
application for Tomcat 10.1.x.

At this point the simplest solution is likely to be:

- take the WAR file that works on Tomcat 9
- drop in webapps-javaee in Tomcat 10 and let Tomcat convert it
   automatically

Mark


On 08/02/2024 20:28, Rick Noel wrote:
> No I cannot compile from command line.
>
> But I do not really care how eclipse compiles my class anyway.
> All I know is that eclipse compiles the class without errors. Using 
> the jars I tell it to. (all the jars run through the migration tool) But 
> Tomcat 10 can not compile the class using those same migrated jar files.
>
> And my class has no use of javax.server  classes in it.
> All the javax.server classes are only in the third part jar files 
> which are supposed to have been converted to use  jakarta.server 
> classes
>
> Is this not a bug with Tomcat migration tool?
>
> Again here is my class that does not compile on Tomcat 10...
> It has no reference to  javax.server
>
>
> package com.radiovoodoo.xmlrpc;
>
> import java.io.IOException;
> import java.net.MalformedURLException; import java.net.URL;
>
> import org.apache.xmlrpc.XmlRpcException;
> import org.apache.xmlrpc.XmlRpcRequest; import 
> org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.Authenticati
> onHandler; import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
> import org.apache.xmlrpc.server.PropertyHandlerMapping;
> import org.apache.xmlrpc.webserver.XmlRpcServlet;
>
> import com.radiovoodoo.util.Log;
>
> /**
>   * @(#)RVXmlRpcServlet.java
>   *
>   * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
>   *
>   * @author  Hank Zill 
>   * @version 1.0
>   *
>   * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
>   */
>
> public class RVXmlRpcServlet
> extends XmlRpcServlet
> {
> /**
>  *  this init parameter defines the path to the property file from
>  *  which to load the XML RPC handler mappings.
>  *
>  *  the path is relative to the CLASSPATH
>  */
> public static final String RESOURCE_PATH = "property-file-path";
>
> protected XmlRpcHandlerMapping newXmlRpcHandlerMapping()
>throws XmlRpcException
> {
>PropertyHandlerMapping mapping = null;
>
>/* String resourcePath = getInitParameter( RESOURCE_PATH );
>
>if ( resourcePath == null )
>{
>   throw new XmlRpcException( "No property file defined.  This 

Long lasting websocket sessions

2024-02-09 Thread Alex O'Ree
I've been experimenting with tomcat 9.x in seeing how long i can get a web
socket session to last. I'm currently struggling to get past 30 minutes or
so. Looking for guidance on how to best increase this or if this is a bad
idea.

Here's the current configuration and what i've tried thus far:

The server continuously streams messages the client, about 1 per second
The client periodically (every 30 seconds) sends a keep alive text message
back to the server
The server side endpoint sets the Session.setTimeout(0); according to the
docs, this should prevent timeouts
The server side WAR file/WEB-INF/web.xml had a session timeout defined at
15 minutes but i then removed it in order to increase the websocket
duration.

Despite all this, both the client and server log a session disconnect, but
i'm still not sure what the reasoning is. I'm still assuming it's some kind
of timeout mechanism.


R: Tomcat Instance unable to connect to DB with TCPS

2024-02-09 Thread Roberto Benedetti
Hello,
it seems you have changed the default Java trust store, so you also need to 
provide its password.

You should provide more info about your requirements:
- server authentication only or client authentication too (mTLS in Oracle 
documentation)?
- which version of ucp/ojdbc are you using (Oracle adds features over time)?

In my experience if you only need server authentication and you are using 
driver version 11.2 or later, the only configuration required is:
- change protocol and port in the URL or tnsnames.ora file
- add the certificate of root (issuer) CA to Java trust store

If you are using a Java version provided by RedHat then adding the certificate 
is simply as copying the certificate file to 
/usr/share/pki/ca-trust-source/anchors/ and run update-ca-trust [1].
If client authentication (mTLS) is required then you must prepare a wallet and 
add extra jars to your deployment [2].

Roberto

[1] 
https://access.redhat.com/documentation/it-it/red_hat_enterprise_linux/7/html/security_guide/sec-shared-system-certificates
[2] 
https://docs.oracle.com/en/database/oracle/oracle-database/19/jjdbc/client-side-security.html#GUID-2BD2F189-A58C-4A85-8524-CFD9BB9AC575

-Messaggio originale-
Da: Mark Thomas 
Inviato: venerdì 9 febbraio 2024 10:09
A: users@tomcat.apache.org
Oggetto: Re: Tomcat Instance unable to connect to DB with TCPS

  CAUTION - This e-mail originates outside of Dedalus. Be vigilant with 
content, links and attachments!

On 09/02/2024 02:54, Kebret, Michael wrote:
> Tomcat version 9.0.83 running on Linux  redhat 7 java 11.0.20.
>
> When changing the protocol from TCP to TCPS in Catalina.properties and in 
> server.xml we have attribute truststorePassword= (tested with both cleartext 
> and encrypted) password connection is refused to the DB and get the below 
> exceptions.

It isn't clear what configuration you are using. Please provide both the 
non-TLS and TLS configurations.

> However, when we add -Djavax.net.ssl.trustStorePassword=cleartext to
> setenv.sh the connection is made successfully. Wanted to see if anyone
> has faced something similar or have any suggestions on how I can get
> TCPS working without having to use -D option in setenv.sh

My reading of [1] is that the property name is 
"javax.net.ssl.trustStorePassword" whether it is set as a connection property 
or as a system property. You seem to be using a connection property of 
"truststorePassword" which is a Tomcat property for HTTPS connections.

Mark

[1] https://www.oracle.com/docs/tech/wp-oracle-jdbc-thin-ssl.pdf

-
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: Tomcat not syncing existing sessions on restart

2024-02-09 Thread Mark Thomas

On 09/02/2024 07:51, Manak Bisht wrote:

On Fri, Feb 9, 2024 at 3:25 AM Mark Thomas  wrote:


Same JRE?


  Yes, 8.0.402

Generally, I wouldn't use 0.0.0.0, I'd use a specific IP address. I'm

not sure how the clustering would behave with 0.0.0.0


Using 0.0.0.0 as the address for the receiver is going to cause 
problems. I see similar issues with 11.0.x as 8.5.x. I haven't dug too 
deeply into things as a) I am short of time and b) I'm not convinced 
this should/could work anyway.


What seems to happen is that the use of 0.0.0.0 confuses the cluster as 
to which node is which - I think because multiple nodes are using 
0.0.0.0. That causes the failure of the initial state synchronisation.



That's the problem really. Using the DNS name or IP address causes the
following error -


I am as sure as I can be that the issue you are seeing is environmental. 
I have configured my test cluster with:


- your cluster configuration with changes to host names and IP addresses
- Java 8.0.402
- Tomcat 8.5.x

With the Receiver using address="0.0.0.0" I see the same issues you do. 
I'm not yet convinced that is a bug.


With the Receiver using address="hostname" the cluster starts but 
doesn't work. Examining the logs shows that is because the host name 
resolves to a loopback address. I'd class that as behaving as expected. 
I coudl always change the host's config if I wanted the name to resolve 
to the public IP.


With the Receiver using address="ip-address" the cluster start and log 
messages show that cluster state is exchanged within a few milliseconds.


That leads me to conclude that the BindException you see is a 
configuration and/or envornmental issue although I don't see why your 
simple test works but clustering doesn't. Perhaps a conflict with 
something else in your Tomcat configuration?


Somethign to try is starting Tomcat with the Receiver using 0.0.0.0 and 
then using nestat to see which address/port combinations are being used.


Mark

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



Re: Tomcat Instance unable to connect to DB with TCPS

2024-02-09 Thread Mark Thomas

On 09/02/2024 02:54, Kebret, Michael wrote:

Tomcat version 9.0.83 running on Linux  redhat 7 java 11.0.20.

When changing the protocol from TCP to TCPS in Catalina.properties and in 
server.xml we have attribute truststorePassword= (tested with both cleartext 
and encrypted) password connection is refused to the DB and get the below 
exceptions.


It isn't clear what configuration you are using. Please provide both the 
non-TLS and TLS configurations.



However, when we add -Djavax.net.ssl.trustStorePassword=cleartext to setenv.sh 
the connection is made successfully. Wanted to see if anyone has faced 
something similar or have any suggestions on how I can get TCPS working without 
having to use -D option in setenv.sh


My reading of [1] is that the property name is 
"javax.net.ssl.trustStorePassword" whether it is set as a connection 
property or as a system property. You seem to be using a connection 
property of "truststorePassword" which is a Tomcat property for HTTPS 
connections.


Mark

[1] https://www.oracle.com/docs/tech/wp-oracle-jdbc-thin-ssl.pdf

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



Re: Tomcat not syncing existing sessions on restart

2024-02-08 Thread Manak Bisht
On Fri, Feb 9, 2024 at 3:25 AM Mark Thomas  wrote:

> Same JRE?
>
 Yes, 8.0.402

Generally, I wouldn't use 0.0.0.0, I'd use a specific IP address. I'm
> not sure how the clustering would behave with 0.0.0.0
>
That's the problem really. Using the DNS name or IP address causes the
following error -

09-Feb-2024 13:08:32.440 SEVERE [main]
org.apache.catalina.startup.Catalina.start The required Server component
failed to start so Tomcat is unable to start.
 org.apache.catalina.LifecycleException: Failed to start component
[StandardServer[8006]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
Caused by: org.apache.catalina.LifecycleException: Failed to start
component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:760)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start
component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:439)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: Failed to start
component [org.apache.catalina.ha.tcp.SimpleTcpCluster[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Caused by: org.apache.catalina.LifecycleException:
org.apache.catalina.tribes.ChannelException: java.net.BindException: Cannot
assign requested address; No faulty members identified.
at
org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:549)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 14 more
Caused by: org.apache.catalina.tribes.ChannelException:
java.net.BindException: Cannot assign requested address; No faulty members
identified.
at
org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:184)
at
org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:102)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:155)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:155)
at
org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor.start(StaticMembershipInterceptor.java:108)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:155)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:155)
at
org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor.start(TcpPingInterceptor.java:65)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:155)
at
org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:421)
at
org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:544)
... 15 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at
org.apache.catalina.tribes.transport.ReceiverBase.bind(ReceiverBase.java:184)
at
org.apache.catalina.tribes.transport.nio.NioReceiver.bind(NioReceiver.java:125)
at
org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:89)
at
org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:150)
... 25 more

The *host *attribute of the *member* element does not exhibit the same
problem.
The DNS/IP is also reachable via ping and telnet.
I even wrote a simple test to check this, and it works successfully -
java.net.InetAddress bind = java.net.InetAddress.getByName("tomcat");
System.out.println(bind); // Output: tomcat/ip

Sincerely,
Manak Bisht


Tomcat Instance unable to connect to DB with TCPS

2024-02-08 Thread Kebret, Michael
Tomcat version 9.0.83 running on Linux  redhat 7 java 11.0.20.

When changing the protocol from TCP to TCPS in Catalina.properties and in 
server.xml we have attribute truststorePassword= (tested with both cleartext 
and encrypted) password connection is refused to the DB and get the below 
exceptions. However, when we add -Djavax.net.ssl.trustStorePassword=cleartext 
to setenv.sh the connection is made successfully. Wanted to see if anyone has 
faced something similar or have any suggestions on how I can get TCPS working 
without having to use -D option in setenv.sh

java.sql.SQLException: Unable to start the Universal Connection Pool: 
oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from 
Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter 
could not establish
 the connection
at 
oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:456)
at 
oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:133)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:928)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1961)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.access$400(PoolDataSourceImpl.java:201)
at 
oracle.ucp.jdbc.PoolDataSourceImpl$31.build(PoolDataSourceImpl.java:4279)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1917)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1880)
at 
oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1865)
at 
com.wellsfargo.trust.SampleTrust.SampleTrust.doGet(SampleTrust.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at 
org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:129)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at 
org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:185)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670)
at 
org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:765)
at 
org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:355)
at 
org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:54)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at 
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
at 
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at 
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794)
at 
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection 
from Datasource: java.sql.SQLRecoverableException: IO Error: The Network 
Adapter could not establish the connection
at 
oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:336)
at 

Re: Getting provider/properties from jaspic-providers.xml to my ServerAuthModule

2024-02-08 Thread Mark Thomas

On 08/02/2024 14:37, Ryan Esch wrote:

I'm using Tomcat 9. I have a provider in jaspic-providers.xml:





I am not sure how to get these properties to my
ServerAuthModule. I have a ServletContextListener and can see that the
jaspic-providers.xml file is being processed if I call:
AuthConfigFactory factory = AuthConfigFactory.getFactory()

It looks like
  I need to get the properties from the factory before calling:
factory.registerConfigProvider(
        new SimpleAuthConfigProvider(props, factory),
        "HttpServlet", null,
      "test");

I can't figure out how to get the properties from the
provider in the xml. If I hardcode the properties before passing them
into registerConfigProvider, the ServerAuthModule functions correctly.
Thanks!


You shouldn't need to call factory.registerConfigProvider() at all. That 
should happen automatically.


Are you sure the appContext is correct. The context path for the ROOT 
web application is "" (the empty string), not "/".


That would make the appContext "Catalina/localhost ".

Note that means it will only be applied to the ROOT web application.

Mark

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



Re: Persistent Manager Implementation Question

2024-02-08 Thread Mark Thomas

Try turning on ALL logging for the org.apache.catalina.session package.

Mark


On 08/02/2024 20:49, Miguel Vidal wrote:

  demo4.zip

Hello,

Specifications
Windows 10
Tomcat 8.5
this is a configuration question .
the tomcat specification that works :
https://tomcat.apache.org/tomcat-8.0-doc/config/manager.html

Im trying to configure correctly in 2 different applications : Persistent
Manager Implementation using a mysqldb as a datasource.

In one of them that is a legacy project i have some dependencies as


 org.springframework
 spring-core
 ${spring.framework.version}



 org.springframework
 spring-context
 ${spring.framework.version}


and it is already doing the registry of the sessions in my bd.
but in the other app im using a spring boot with the same configuration.
I'm not able to see any registration of the sessions in my db. After the
deploy of my app in a tomcat server and hit any resource example
/test/resource im able to see the response correctly but i just want to
know if this  Persistent Manager Implementation is only for legacy apps? or
why is running in one and in the other is not.

this is my xml for both




 
 
 

 
 jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
 org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
 org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"

these 2  are the guides where i learn the mayority how to do it
https://svn.apache.org/repos/asf/tomcat/archive/tc4.1.x/trunk/container/catalina/docs/JDBCStore-howto.html
https://gerrytan.wordpress.com/2013/08/21/tomcat-7-jdbc-session-persistence/

im going to attach the code that im trying to know why is not working.



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



Re: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Mark Thomas

Confirmed this is user error. There is no bug in the migration tool.

Steps to demonstrate this:

- Create new, blank Eclipse dynamic web project
- Add provided servlet code
- Add required libraries
- Remove referenced to internal logging code
- Add web.xml with basic mapping to "/test"
- Export WAR file
- Deploy to Tomcat
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. That is fine. 
It proves that the servlet was loaded which is all we care about at this 
point.


- Use migration tool to migrate WAR
- Deploy migrated WAR to Tomcat 10.1.x
- Start Tomcat
- Request servlet

Servlet loads and then reports an exception during init. Again, this is 
fine as it proves that the Servlet has been converted correctly and can 
be loaded by Tomcat 10.1.x.


Best guess, the Eclipse project isn't configured correctly to compile 
the web application for Tomcat 10.1.x.


At this point the simplest solution is likely to be:

- take the WAR file that works on Tomcat 9
- drop in webapps-javaee in Tomcat 10 and let Tomcat convert it
  automatically

Mark


On 08/02/2024 20:28, Rick Noel wrote:

No I cannot compile from command line.

But I do not really care how eclipse compiles my class anyway.
All I know is that eclipse compiles the class without errors. Using the jars I 
tell it to. (all the jars run through the migration tool)
But Tomcat 10 can not compile the class using those same migrated jar files.

And my class has no use of javax.server  classes in it.
All the javax.server classes are only in the third part jar files which are 
supposed to have been converted to use  jakarta.server classes

Is this not a bug with Tomcat migration tool?

Again here is my class that does not compile on Tomcat 10...
It has no reference to  javax.server


package com.radiovoodoo.xmlrpc;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
import 
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.XmlRpcServlet;

import com.radiovoodoo.util.Log;

/**
  * @(#)RVXmlRpcServlet.java
  *
  * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
  *
  * @author  Hank Zill 
  * @version 1.0
  *
  * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
  */

public class RVXmlRpcServlet
extends XmlRpcServlet
{
/**
 *  this init parameter defines the path to the property file from
 *  which to load the XML RPC handler mappings.
 *
 *  the path is relative to the CLASSPATH
 */
public static final String RESOURCE_PATH = "property-file-path";

protected XmlRpcHandlerMapping newXmlRpcHandlerMapping()
   throws XmlRpcException
{
   PropertyHandlerMapping mapping = null;

   /* String resourcePath = getInitParameter( RESOURCE_PATH );
   
   if ( resourcePath == null )

   {
  throw new XmlRpcException( "No property file defined.  This servlet must have the 
init-param " + RESOURCE_PATH + " set." );
   } */
   String resourcePath = "somefile.properties";

   URL url = null;
  try {
url = getServletContext().getResource( resourcePath );
  } catch (MalformedURLException e1) {
throw new XmlRpcException( resourcePath + " " + e1 );
  }

   if (url == null)
   {
  throw new XmlRpcException("Failed to locate resource " + resourcePath 
);
   }
   try
   {
  mapping = newPropertyHandlerMapping(url);
   }
   catch (IOException e)
   {
  throw new XmlRpcException("Failed to load resource " + url + ": " + 
e.getMessage(), e);
   }

   if ( mapping == null )
  Log.debug( "HandlerMapping is null" );
   else
   {
  String[] methods = mapping.getListMethods();

  for ( int x = 0; x < methods.length; x++ )
  {
 Log.debug( "method: " + methods[x] );
  }
   }
   
   mapping.setAuthenticationHandler(new AuthenticationHandler() {

 //rick removed override annotaion so this class will compile on java 
1.5
//@Override
public boolean isAuthorized(XmlRpcRequest arg0) throws 
XmlRpcException {
return true;
}
   });

   return mapping;
}
}





Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Rob Sargent 
Sent: Thursday, February 8, 2024 1:54 PM
To: Tomcat Users List 
Subject: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from rsarg...@xmission.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]


On Feb 8, 2024, at 9:04 AM, Rick 

Re: Tomcat not syncing existing sessions on restart

2024-02-08 Thread Mark Thomas

On 07/02/2024 11:43, Manak Bisht wrote:

I think I have narrowed down the problem. For Tomcat 9 (v9.0.85), using
0.0.0.0 for the local member and receiver works fine. However, the same
does not work in Tomcat 8.5 (v8.5.98).


Same JRE?

Generally, I wouldn't use 0.0.0.0, I'd use a specific IP address. I'm 
not sure how the clustering would behave with 0.0.0.0


Mark




Sincerely,
Manak Bisht


On Fri, Feb 2, 2024 at 9:41 PM Mark Thomas  wrote:


On 31/01/2024 13:33, Manak Bisht wrote:

I tried tweaking all the settings that I could think of but I am unable

to

sync sessions on restart even on a stock Tomcat 8.5.98 installation using
your provided war. I am unable to identify whether this is actually a bug
or something wrong with my configuration (this is far more likely). Could
you please share your server.xml? Did you make any other changes?

Sincerely,
Manak Bisht


Here is the cluster configuration from the first node my test environment:







  




  

  

  



  

  
  












-
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



Persistent Manager Implementation Question

2024-02-08 Thread Miguel Vidal
 demo4.zip

Hello,

Specifications
Windows 10
Tomcat 8.5
this is a configuration question .
the tomcat specification that works :
https://tomcat.apache.org/tomcat-8.0-doc/config/manager.html

Im trying to configure correctly in 2 different applications : Persistent
Manager Implementation using a mysqldb as a datasource.

In one of them that is a legacy project i have some dependencies as


org.springframework
spring-core
${spring.framework.version}



org.springframework
spring-context
${spring.framework.version}


and it is already doing the registry of the sessions in my bd.
but in the other app im using a spring boot with the same configuration.
I'm not able to see any registration of the sessions in my db. After the
deploy of my app in a tomcat server and hit any resource example
/test/resource im able to see the response correctly but i just want to
know if this  Persistent Manager Implementation is only for legacy apps? or
why is running in one and in the other is not.

this is my xml for both









jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"

these 2  are the guides where i learn the mayority how to do it
https://svn.apache.org/repos/asf/tomcat/archive/tc4.1.x/trunk/container/catalina/docs/JDBCStore-howto.html
https://gerrytan.wordpress.com/2013/08/21/tomcat-7-jdbc-session-persistence/

im going to attach the code that im trying to know why is not working.


RE: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rick Noel
No I cannot compile from command line.

But I do not really care how eclipse compiles my class anyway.
All I know is that eclipse compiles the class without errors. Using the jars I 
tell it to. (all the jars run through the migration tool)
But Tomcat 10 can not compile the class using those same migrated jar files.

And my class has no use of javax.server  classes in it.
All the javax.server classes are only in the third part jar files which are 
supposed to have been converted to use  jakarta.server classes

Is this not a bug with Tomcat migration tool?

Again here is my class that does not compile on Tomcat 10...
It has no reference to  javax.server


package com.radiovoodoo.xmlrpc;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
import 
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.XmlRpcServlet;

import com.radiovoodoo.util.Log;

/**
 * @(#)RVXmlRpcServlet.java
 *
 * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
 *
 * @author  Hank Zill 
 * @version 1.0
 *
 * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
 */

public class RVXmlRpcServlet
   extends XmlRpcServlet
{
   /**
*  this init parameter defines the path to the property file from
*  which to load the XML RPC handler mappings.
*
*  the path is relative to the CLASSPATH  
*/
   public static final String RESOURCE_PATH = "property-file-path";

   protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() 
  throws XmlRpcException
   {
  PropertyHandlerMapping mapping = null;

  /* String resourcePath = getInitParameter( RESOURCE_PATH );
  
  if ( resourcePath == null )
  {
 throw new XmlRpcException( "No property file defined.  This servlet 
must have the init-param " + RESOURCE_PATH + " set." );
  } */
  String resourcePath = "somefile.properties";

  URL url = null;
  try {
url = getServletContext().getResource( resourcePath );
  } catch (MalformedURLException e1) {
throw new XmlRpcException( resourcePath + " " + e1 );
  }

  if (url == null) 
  {
 throw new XmlRpcException("Failed to locate resource " + resourcePath 
);
  }
  try 
  {
 mapping = newPropertyHandlerMapping(url);
  } 
  catch (IOException e) 
  {
 throw new XmlRpcException("Failed to load resource " + url + ": " + 
e.getMessage(), e);
  }

  if ( mapping == null )
 Log.debug( "HandlerMapping is null" );
  else
  {
 String[] methods = mapping.getListMethods();

 for ( int x = 0; x < methods.length; x++ )
 {
Log.debug( "method: " + methods[x] );
 }
  }
  
  mapping.setAuthenticationHandler(new AuthenticationHandler() {
//rick removed override annotaion so this class will compile on java 1.5
//@Override
public boolean isAuthorized(XmlRpcRequest arg0) throws 
XmlRpcException {
return true;
}
  });

  return mapping;
   }
}





Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Rob Sargent  
Sent: Thursday, February 8, 2024 1:54 PM
To: Tomcat Users List 
Subject: [EXT]Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from rsarg...@xmission.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

> On Feb 8, 2024, at 9:04 AM, Rick Noel  wrote:
>
> I built  my app in Eclipse  and the build path is set to use the migrated 
> jar.
> It compiles without error on Eclipse and using the migrated jar.  I 
> have that same migrated jar in the Tomcat lib But when tomcat 10 
> compiles it does not compile
>
> I have also used the migration tool on my .war that runs in Tomcat 9 and that 
> war still fails with same compile error.
>
> So to summarize. the migration tool fails to convert third 
> party jar xmlrpc-server3.1.3.jar And it also fails when I use it on my .war 
> ran through the migration tool.
>
>
> Rick Noel
> Systems Programmer | Westwood One
> rn...@westwoodone.com
>

Can you build from the command  line?  Who knows what eclipse does under the 
covers
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you know the sender and you are sure the 
content is safe. Please report the message using the Report Message feature in 
your email client 

Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rob Sargent



> On Feb 8, 2024, at 9:04 AM, Rick Noel  wrote:
> 
> I built  my app in Eclipse  and the build path is set to use the migrated 
> jar.
> It compiles without error on Eclipse and using the migrated jar.  I have that 
> same migrated jar in the Tomcat lib
> But when tomcat 10 compiles it does not compile
> 
> I have also used the migration tool on my .war that runs in Tomcat 9 and that 
> war still fails with same compile error.
> 
> So to summarize. the migration tool fails to convert third party jar 
> xmlrpc-server3.1.3.jar
> And it also fails when I use it on my .war ran through the migration tool.
> 
> 
> Rick Noel
> Systems Programmer | Westwood One
> rn...@westwoodone.com
> 

Can you build from the command  line?  Who knows what eclipse does under the 
covers 
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rick Noel
I built  my app in Eclipse  and the build path is set to use the migrated jar.
It compiles without error on Eclipse and using the migrated jar.  I have that 
same migrated jar in the Tomcat lib
But when tomcat 10 compiles it does not compile

I have also used the migration tool on my .war that runs in Tomcat 9 and that 
war still fails with same compile error.

So to summarize. the migration tool fails to convert third party jar 
xmlrpc-server3.1.3.jar
And it also fails when I use it on my .war ran through the migration tool.


Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Mark Thomas  
Sent: Thursday, February 8, 2024 9:48 AM
To: users@tomcat.apache.org
Subject: Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 08/02/2024 14:38, Rick Noel wrote:
> My code uses no javax.server  code other that what is in the third party jar.

Then you need to fix your build system that is compiling your code against the 
original xmlrpc-server3.1.3.jar rather than the migrated version.

> Is it not the third part jar that needs to stop using javax.server ?

No. It is the compiled form of your code that has the issue.

When you compile your class it retains a reference to the version of 
org.apache.xmlrpc.webserver.XmlRpcServlet that it was compiled against.
You can't just swap the xmlrpc-server3.1.3.jar at runtime. You have to use the 
migrated JAR at compile time as well.

Mark


>
> Where in my code does it use javax.server, other than from classes in package 
> org.apache.xmlrpc?
>
> package com.radiovoodoo.xmlrpc;
>
> import java.io.IOException;
> import java.net.MalformedURLException; import java.net.URL;
>
> import org.apache.xmlrpc.XmlRpcException;
> import org.apache.xmlrpc.XmlRpcRequest; import 
> org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.Authenticati
> onHandler; import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
> import org.apache.xmlrpc.server.PropertyHandlerMapping;
> import org.apache.xmlrpc.webserver.XmlRpcServlet;
>
> import com.radiovoodoo.util.Log;
>
> /**
>   * @(#)RVXmlRpcServlet.java
>   *
>   * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
>   *
>   * @author  Hank Zill 
>   * @version 1.0
>   *
>   * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
>   */
>
> public class RVXmlRpcServlet
> extends XmlRpcServlet
> {
> /**
>  *  this init parameter defines the path to the property file from
>  *  which to load the XML RPC handler mappings.
>  *
>  *  the path is relative to the CLASSPATH
>  */
> public static final String RESOURCE_PATH = "property-file-path";
>
> protected XmlRpcHandlerMapping newXmlRpcHandlerMapping()
>throws XmlRpcException
> {
>PropertyHandlerMapping mapping = null;
>
>/* String resourcePath = getInitParameter( RESOURCE_PATH );
>
>if ( resourcePath == null )
>{
>   throw new XmlRpcException( "No property file defined.  This servlet 
> must have the init-param " + RESOURCE_PATH + " set." );
>} */
>String resourcePath = "/WEB-INF/somefile";
>
>URL url = null;
> try {
>   url = getServletContext().getResource( resourcePath );
> } catch (MalformedURLException e1) {
>   throw new XmlRpcException( resourcePath + " " + e1 );
> }
>
>if (url == null)
>{
>   throw new XmlRpcException("Failed to locate resource " + 
> resourcePath );
>}
>try
>{
>   mapping = newPropertyHandlerMapping(url);
>}
>catch (IOException e)
>{
>   throw new XmlRpcException("Failed to load resource " + url + ": " + 
> e.getMessage(), e);
>}
>
>if ( mapping == null )
>   Log.debug( "HandlerMapping is null" );
>else
>{
>   String[] methods = mapping.getListMethods();
>
>   for ( int x = 0; x < methods.length; x++ )
>   {
>  Log.debug( "method: " + methods[x] );
>   }
>}
>
>mapping.setAuthenticationHandler(new AuthenticationHandler() {
>  //rick removed override annotaion so this class will compile on java 
> 1.5
>   //@Override
>   public boolean isAuthorized(XmlRpcRequest arg0) throws 
> XmlRpcException {
>   return true;
>   }
>});
>
>return mapping;
> }
> }
> Rick Noel
> Systems Programmer | Westwood One
> rn...@westwoodone.com
>
> -Original Message-
> From: Mark Thomas 
> Sent: Thursday, February 8, 2024 9:27 AM
> To: users@tomcat.apache.org
> Subject: Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure
>
> [You don't often get email from ma...@apache.org. Learn why this is 
> important at 

Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Mark Thomas

On 08/02/2024 14:38, Rick Noel wrote:

My code uses no javax.server  code other that what is in the third party jar.


Then you need to fix your build system that is compiling your code 
against the original xmlrpc-server3.1.3.jar rather than the migrated 
version.



Is it not the third part jar that needs to stop using javax.server ?


No. It is the compiled form of your code that has the issue.

When you compile your class it retains a reference to the version of 
org.apache.xmlrpc.webserver.XmlRpcServlet that it was compiled against. 
You can't just swap the xmlrpc-server3.1.3.jar at runtime. You have to 
use the migrated JAR at compile time as well.


Mark




Where in my code does it use javax.server, other than from classes in package 
org.apache.xmlrpc?

package com.radiovoodoo.xmlrpc;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
import 
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.XmlRpcServlet;

import com.radiovoodoo.util.Log;

/**
  * @(#)RVXmlRpcServlet.java
  *
  * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
  *
  * @author  Hank Zill 
  * @version 1.0
  *
  * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
  */

public class RVXmlRpcServlet
extends XmlRpcServlet
{
/**
 *  this init parameter defines the path to the property file from
 *  which to load the XML RPC handler mappings.
 *
 *  the path is relative to the CLASSPATH
 */
public static final String RESOURCE_PATH = "property-file-path";

protected XmlRpcHandlerMapping newXmlRpcHandlerMapping()
   throws XmlRpcException
{
   PropertyHandlerMapping mapping = null;

   /* String resourcePath = getInitParameter( RESOURCE_PATH );
   
   if ( resourcePath == null )

   {
  throw new XmlRpcException( "No property file defined.  This servlet must have the 
init-param " + RESOURCE_PATH + " set." );
   } */
   String resourcePath = "/WEB-INF/somefile";

   URL url = null;
  try {
url = getServletContext().getResource( resourcePath );
  } catch (MalformedURLException e1) {
throw new XmlRpcException( resourcePath + " " + e1 );
  }

   if (url == null)
   {
  throw new XmlRpcException("Failed to locate resource " + resourcePath 
);
   }
   try
   {
  mapping = newPropertyHandlerMapping(url);
   }
   catch (IOException e)
   {
  throw new XmlRpcException("Failed to load resource " + url + ": " + 
e.getMessage(), e);
   }

   if ( mapping == null )
  Log.debug( "HandlerMapping is null" );
   else
   {
  String[] methods = mapping.getListMethods();

  for ( int x = 0; x < methods.length; x++ )
  {
 Log.debug( "method: " + methods[x] );
  }
   }
   
   mapping.setAuthenticationHandler(new AuthenticationHandler() {

 //rick removed override annotaion so this class will compile on java 
1.5
//@Override
public boolean isAuthorized(XmlRpcRequest arg0) throws 
XmlRpcException {
return true;
}
   });

   return mapping;
}
}
Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Mark Thomas 
Sent: Thursday, February 8, 2024 9:27 AM
To: users@tomcat.apache.org
Subject: Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 08/02/2024 14:17, Rick Noel wrote:

My class is RVXmlRpcServlet and below is the compile error that
happens when I use the xmlrpc-server3.1.3.jar after that jar has been
run through  the migration tool jakartaee-migration-1.0.7

That same class throws NO compile error on Tomcat 9 using
xmlrpc-server3.1.3.jar

Here is the compile error


The bug is your code. You need up update RVXmlRpcServlet to use 
jakarta.servlet.Servlet rather than javax.servlet.Servlet

Ditto for any other Java EE classes you have referenced in your code.

If you want your application to work with Tomcat 9 and Tomcat 10 I suggest you:

- write it for Tomcat 9
- package it as a WAR file
- process the entire WAR file with the migration tool
- use original WAR file with Tomcat 9 and the migrated WAR file with
Tomcat 10+

Mark



06-Feb-2024 15:48:53.044 SEVERE [http-nio-8588-exec-1] 
org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for 
servlet [XmlRpcServlet]
   java.lang.ClassCastException: class 
com.radiovoodoo.xmlrpc.RVXmlRpcServlet cannot be cast to 

RE: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rick Noel
My code uses no javax.server  code other that what is in the third party jar.
Is it not the third part jar that needs to stop using javax.server ? 

Where in my code does it use javax.server, other than from classes in package 
org.apache.xmlrpc?

package com.radiovoodoo.xmlrpc;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
import 
org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;
import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
import org.apache.xmlrpc.server.PropertyHandlerMapping;
import org.apache.xmlrpc.webserver.XmlRpcServlet;

import com.radiovoodoo.util.Log;

/**
 * @(#)RVXmlRpcServlet.java
 *
 * new XmlRpcServlet, which extends the default Apache XmlRpcServlet
 *
 * @author  Hank Zill 
 * @version 1.0
 *
 * Copyright(c) 2005 RadioVoodoo, Inc. All Rights Reserved.
 */

public class RVXmlRpcServlet
   extends XmlRpcServlet
{
   /**
*  this init parameter defines the path to the property file from
*  which to load the XML RPC handler mappings.
*
*  the path is relative to the CLASSPATH  
*/
   public static final String RESOURCE_PATH = "property-file-path";

   protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() 
  throws XmlRpcException
   {
  PropertyHandlerMapping mapping = null;

  /* String resourcePath = getInitParameter( RESOURCE_PATH );
  
  if ( resourcePath == null )
  {
 throw new XmlRpcException( "No property file defined.  This servlet 
must have the init-param " + RESOURCE_PATH + " set." );
  } */
  String resourcePath = "/WEB-INF/somefile";

  URL url = null;
  try {
url = getServletContext().getResource( resourcePath );
  } catch (MalformedURLException e1) {
throw new XmlRpcException( resourcePath + " " + e1 );
  }

  if (url == null) 
  {
 throw new XmlRpcException("Failed to locate resource " + resourcePath 
);
  }
  try 
  {
 mapping = newPropertyHandlerMapping(url);
  } 
  catch (IOException e) 
  {
 throw new XmlRpcException("Failed to load resource " + url + ": " + 
e.getMessage(), e);
  }

  if ( mapping == null )
 Log.debug( "HandlerMapping is null" );
  else
  {
 String[] methods = mapping.getListMethods();

 for ( int x = 0; x < methods.length; x++ )
 {
Log.debug( "method: " + methods[x] );
 }
  }
  
  mapping.setAuthenticationHandler(new AuthenticationHandler() {
//rick removed override annotaion so this class will compile on java 1.5
//@Override
public boolean isAuthorized(XmlRpcRequest arg0) throws 
XmlRpcException {
return true;
}
  });

  return mapping;
   }
}
Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Mark Thomas  
Sent: Thursday, February 8, 2024 9:27 AM
To: users@tomcat.apache.org
Subject: Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 08/02/2024 14:17, Rick Noel wrote:
> My class is RVXmlRpcServlet and below is the compile error that 
> happens when I use the xmlrpc-server3.1.3.jar after that jar has been 
> run through  the migration tool jakartaee-migration-1.0.7
>
> That same class throws NO compile error on Tomcat 9 using 
> xmlrpc-server3.1.3.jar
>
> Here is the compile error

The bug is your code. You need up update RVXmlRpcServlet to use 
jakarta.servlet.Servlet rather than javax.servlet.Servlet

Ditto for any other Java EE classes you have referenced in your code.

If you want your application to work with Tomcat 9 and Tomcat 10 I suggest you:

- write it for Tomcat 9
- package it as a WAR file
- process the entire WAR file with the migration tool
- use original WAR file with Tomcat 9 and the migrated WAR file with
   Tomcat 10+

Mark

>
> 06-Feb-2024 15:48:53.044 SEVERE [http-nio-8588-exec-1] 
> org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for 
> servlet [XmlRpcServlet]
>   java.lang.ClassCastException: class 
> com.radiovoodoo.xmlrpc.RVXmlRpcServlet cannot be cast to class 
> jakarta.servlet.Servlet (com.radiovoodoo.xmlrpc.RVXmlRpcServlet is in unnamed 
> module of loader org.apache.catalina.loader.ParallelWebappClassLoader 
> @568750b7; jakarta.servlet.Servlet is in unnamed module of loader 
> java.net.URLClassLoader @18769467)
>   at 
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
>   at 
> org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:649)
>   at 
> 

Getting provider/properties from jaspic-providers.xml to my ServerAuthModule

2024-02-08 Thread Ryan Esch
I'm using Tomcat 9. I have a provider in jaspic-providers.xml:
                I am not sure how to get these properties to my 
ServerAuthModule. I have a ServletContextListener and can see that the 
jaspic-providers.xml file is being processed if I call:
AuthConfigFactory factory = AuthConfigFactory.getFactory();It looks like I need 
to get the properties from the factory before calling:
factory.registerConfigProvider(        new SimpleAuthConfigProvider(props, 
factory),        "HttpServlet", null,        "test");I can't figure out how to 
get the properties from the provider in the xml. If I hardcode the properties 
before passing them into registerConfigProvider, the ServerAuthModule functions 
correctly.
Thanks!


Re: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Mark Thomas

On 08/02/2024 14:17, Rick Noel wrote:

My class is RVXmlRpcServlet and below is the compile error that happens when I 
use the xmlrpc-server3.1.3.jar after that jar has been run through  the 
migration tool jakartaee-migration-1.0.7

That same class throws NO compile error on Tomcat 9 using xmlrpc-server3.1.3.jar

Here is the compile error


The bug is your code. You need up update RVXmlRpcServlet to use 
jakarta.servlet.Servlet rather than javax.servlet.Servlet


Ditto for any other Java EE classes you have referenced in your code.

If you want your application to work with Tomcat 9 and Tomcat 10 I 
suggest you:


- write it for Tomcat 9
- package it as a WAR file
- process the entire WAR file with the migration tool
- use original WAR file with Tomcat 9 and the migrated WAR file with
  Tomcat 10+

Mark



06-Feb-2024 15:48:53.044 SEVERE [http-nio-8588-exec-1] 
org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for 
servlet [XmlRpcServlet]
java.lang.ClassCastException: class 
com.radiovoodoo.xmlrpc.RVXmlRpcServlet cannot be cast to class 
jakarta.servlet.Servlet (com.radiovoodoo.xmlrpc.RVXmlRpcServlet is in unnamed 
module of loader org.apache.catalina.loader.ParallelWebappClassLoader 
@568750b7; jakarta.servlet.Servlet is in unnamed module of loader 
java.net.URLClassLoader @18769467)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:649)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:115)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
at 
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
at 
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at 
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
at 
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)


Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Mark Thomas 
Sent: Thursday, February 8, 2024 8:54 AM
To: users@tomcat.apache.org
Subject: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 08/02/2024 13:45, Rick Noel wrote:

Our application uses classes in this jar xmlrpc-server3.1.3.jar .(it is the 
latest version)

We are trying to migrate to Tomcat 10 but that  jar uses the   javax.server. 
package classes instead of the needed  jakarta.server. pacakage.


I have tried running this jar trough the latest Tomcat 10 migration
tool (jakartaee-migration-1.0.7) which is suppose to alter the jar to
make all classes use  jakarta.server.  classes

but the tool is not fully converting all the classes,  since I still get 
compile errors at run time.


Please provide details of the compilation errors that you see.


I think in addition to not using  javax.server.  the jar should use
this class

java.net.URI  instead of   java.net.URL


That seems ... unlikely.


anyone have ideas on how to make xmlrpc-server3.1.3.jar  tomcat 10 compliant?


I'd be surprised if the migration tool didn't process a JAR that old correctly.

Mark



BTW the jar in question has classes in this package
org.apache.xmlrpc.

Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com




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

CAUTION: This email originated from outside of the 

RE: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rick Noel
My class is RVXmlRpcServlet and below is the compile error that happens when I 
use the xmlrpc-server3.1.3.jar after that jar has been run through  the 
migration tool jakartaee-migration-1.0.7

That same class throws NO compile error on Tomcat 9 using xmlrpc-server3.1.3.jar

Here is the compile error

06-Feb-2024 15:48:53.044 SEVERE [http-nio-8588-exec-1] 
org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for 
servlet [XmlRpcServlet]
java.lang.ClassCastException: class 
com.radiovoodoo.xmlrpc.RVXmlRpcServlet cannot be cast to class 
jakarta.servlet.Servlet (com.radiovoodoo.xmlrpc.RVXmlRpcServlet is in unnamed 
module of loader org.apache.catalina.loader.ParallelWebappClassLoader 
@568750b7; jakarta.servlet.Servlet is in unnamed module of loader 
java.net.URLClassLoader @18769467)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:649)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:115)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:673)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
at 
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391)
at 
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at 
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744)
at 
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at 
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)


Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com

-Original Message-
From: Mark Thomas  
Sent: Thursday, February 8, 2024 8:54 AM
To: users@tomcat.apache.org
Subject: [EXT]Re: jakartaee-migration-1.0.7 migration tool failure

[You don't often get email from ma...@apache.org. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

On 08/02/2024 13:45, Rick Noel wrote:
> Our application uses classes in this jar xmlrpc-server3.1.3.jar .(it is 
> the latest version)
>
> We are trying to migrate to Tomcat 10 but that  jar uses the   javax.server. 
> package classes instead of the needed  jakarta.server. pacakage.
>
>
> I have tried running this jar trough the latest Tomcat 10 migration 
> tool (jakartaee-migration-1.0.7) which is suppose to alter the jar to 
> make all classes use  jakarta.server.  classes
>
> but the tool is not fully converting all the classes,  since I still get 
> compile errors at run time.

Please provide details of the compilation errors that you see.

> I think in addition to not using  javax.server.  the jar should use 
> this class
>
> java.net.URI  instead of   java.net.URL

That seems ... unlikely.

> anyone have ideas on how to make xmlrpc-server3.1.3.jar  tomcat 10 compliant?

I'd be surprised if the migration tool didn't process a JAR that old correctly.

Mark


> BTW the jar in question has classes in this package
> org.apache.xmlrpc.
>
> Rick Noel
> Systems Programmer | Westwood One
> rn...@westwoodone.com
>
>

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

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you know the sender and you are sure the 
content is safe. Please report the message using the Report Message feature in 
your email client if you believe the email is suspicious.


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



Re: jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Mark Thomas

On 08/02/2024 13:45, Rick Noel wrote:

Our application uses classes in this jar xmlrpc-server3.1.3.jar .(it is the 
latest version)

We are trying to migrate to Tomcat 10 but that  jar uses the   javax.server. 
package classes instead of the needed  jakarta.server. pacakage.


I have tried running this jar trough the latest Tomcat 10 migration tool 
(jakartaee-migration-1.0.7) which is suppose to alter the jar to make all 
classes use  jakarta.server.  classes

but the tool is not fully converting all the classes,  since I still get 
compile errors at run time.


Please provide details of the compilation errors that you see.


I think in addition to not using  javax.server.  the jar should use this class

java.net.URI  instead of   java.net.URL


That seems ... unlikely.


anyone have ideas on how to make xmlrpc-server3.1.3.jar  tomcat 10 compliant?


I'd be surprised if the migration tool didn't process a JAR that old 
correctly.


Mark



BTW the jar in question has classes in this package
org.apache.xmlrpc.

Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com




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



jakartaee-migration-1.0.7 migration tool failure

2024-02-08 Thread Rick Noel
Our application uses classes in this jar xmlrpc-server3.1.3.jar .(it is the 
latest version)

We are trying to migrate to Tomcat 10 but that  jar uses the   javax.server. 
package classes instead of the needed  jakarta.server. pacakage.


I have tried running this jar trough the latest Tomcat 10 migration tool 
(jakartaee-migration-1.0.7) which is suppose to alter the jar to make all 
classes use  jakarta.server.  classes

but the tool is not fully converting all the classes,  since I still get 
compile errors at run time.


I think in addition to not using  javax.server.  the jar should use this class

java.net.URI  instead of   java.net.URL


anyone have ideas on how to make xmlrpc-server3.1.3.jar  tomcat 10 compliant?

BTW the jar in question has classes in this package
org.apache.xmlrpc.

Rick Noel
Systems Programmer | Westwood One
rn...@westwoodone.com



<    4   5   6   7   8   9   10   11   12   13   >