[GEOS-5985] Tomcat with APR can result in full JVM crashes

It seems fine to me, but the change has the potential to affect every single OGC request.
I'd like to commit on trunk and then backport on 2.4.x, since apparently the APR runtime is installed by default on Windows.