Re: reload vs restart

2021-02-27 Thread Rob Sargent

Chris,
Thank you, yet again.

On 2/26/21 9:31 PM, Christopher Schultz wrote:

Rob,

On 2/26/21 16:47, Rob Sargent wrote:
Given a single webapp, what's the difference between server restart 
and webapp reload in terms of current open sessions?


That depends upon a few things.

If you do not have session-persistence enabled, then you will lose all 
your sessions in either case.


If you do have session-persistence enabled, then reloading your 
application will allow requests arriving for that application during 
the restart to be accepted and wait for the application to become 
available. If, instead, you restart your server (which means 
stopping/starting the JVM, or at least stopping/starting all of the 
Connectors in an embedded scenario), then there will be a period of 
time where clients might receive any number of errors such as 
"connection refused", etc.


I have not, far as I know, enabled session-persistence yet "persistent 
sessions" are sought on starting the JVM so perhaps that's the default mode.
My worry is that I have some rather lengthy data transfers (streamed 
from client to TC) and losing one of those would be a week's worth of 
m5.4xlarge down the drain (unless and until I get the interim/fall-back 
file save working on s3).  So I'm wondering how circumspect I have to be 
on this front.  The only change to the running webapp would be a new db 
resource in the context.xml and a ref to it in the web.xml.   This harks 
back to my "wildly successful" scenario wherein a second customer shows 
up while the first is still running.  Worst comes, I can simply delay 
adding the new customer for a week. (Code changes to the webapp proper 
would be done "between jobs". They get there own database.)


If you are going embedded (which it sounds like you are from other 
recent posts), are you also using a load-balancer and some kind of 
clustering, management, etc? If so, you should be able to configure 
your reverse-proxy/lb to ensure that Tomcat is actually available 
before proxying requests to that node, or failing-over to another node.


If you want true high-availability, you will either want a shared 
session-store (e.g. db, memcached, etc.) or clustering (using Tomcat's 
clustering) in which case restart versus reload doesn't matter much.


No HA, no load balancing in play - not millions of hits, ever.  In it's 
previous incarnation the system used pg-bouncer for connection pooling 
but I think I can live with the TC built-in.


Cheers,
rjs



Re: NoClassDefFoundError on ServletContextAttributeListner

2021-02-27 Thread Blake McBride
Thanks, I will check it out.

On Fri, Feb 26, 2021 at 10:26 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Blake,
>
> On 2/26/21 14:55, Blake McBride wrote:
> > I have a web app that has been running fine for many years.  I tried
> > upgrading to Tomcat 10.0.2 and I am getting the following error:
> >
> > Feb 26, 2021 1:48:26 PM org.apache.catalina.core.StandardContext
> > listenerStart
> > SEVERE: Error configuring application listener of class
> > [com.sun.xml.ws.transport.http.servlet.WSServletContextListener]
> > java.lang.NoClassDefFoundError:
> > javax/servlet/ServletContextAttributeListener
> > at java.lang.ClassLoader.defineClass1(Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
> > at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> > [...]
> >
> > Without changing anything, this app works fine with Tomcat:
> >
> > 9.0.43
> > 8.5.63
> > 8.0.27
> >
> > But I get the above error with Tomcat 10.0.2 only.
> >
> > Sure appreciate any help.
>
> Did you read the Migration Guide? Tomcat 10 is built with and requires
> the use of all the Jakarta EE package names. javax.servlet is dead. Long
> live jakarta.servlet!
>
> http://tomcat.apache.org/migration-10.html#Specification_APIs
>
> You might want to have a look at the migration tool:
> https://tomcat.apache.org/download-migration.cgi
>
> Not a huge amount of documentation about it, so you'll have to piece
> things together yourself.
>
> Hope that helps,
> -chris
>