- If you have control over the server where you want to install this webapp you can replace the core jars with yours.
- Additionally you can prepend the jars in the startup of the app server.
Update:
As for the second part, you'll need to modify the startup file of the application server it self.
I don't have an installation at hand but lets suppose in the dir $YOUR_APPSERV/bin there are a bunch of scripts ( either .cmd or .sh files )
Some of them start the app server , some other help to configure it.
You need to modify one of those in such a way the command line look like this:
(assume a windows installation)
java -Xbootclasspath/p:c:\cutomjars\myJar.jar;customjars\myOtherJar.jar ..................... // the rest of the normal command line.
-bootclasspath/p prepends the jars to the app classpath
-bootclasspath/a appends the jars to the app claspath
This option let you override any class in the JVM with those specified in the jars, so you can even substitute java.lang.String if you want to.
That's one approach. Unfortunately -Xbootclasspath is an option for Sun JVM ( that is JRockit does not have it, nor the IBM's VM what ever his name is )
There was another option where you declare a folder where all the extensions are. Plus, there is an ext directory in the jre.
Take a deep dive into your application server bin directory and find out what each script is used for, I'm pretty sure you'll make it through.
Here's a more formal explanation of this topic: http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html
I hope it helps.
BTW, I use to do this years ago, to substitue the CORBA package with a veeeery old version. So this works for sure.