Overriding application server behaviour for loading jsp-api and servlet-api jars in a packaged web application

I have a project built and packaged with a specific version of jsp-apiand servlet-api jar files. Now I want these jars to be loaded when deploying the web project on any application server for example tomcat, WAS, Weblogic etc.

The behaviour I have seen on tomcat is that it gives messages that the packaged version of these apis are not loaded along with an offending class.

Is there any way I could override these server settings or behaviour?

My concern is that letting the default behaviour of a server may allow different behaviour on different servers or even on different versions of same app server.


  1. If you have control over the server where you want to install this webapp you can replace the core jars with yours.
  2. Additionally you can prepend the jars in the startup of the app server.


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.

Need Your Help

Why does my ActionFilterAttribute's not execute before a post with ajax requisition?

jquery ajax asp.net-mvc-4 entity-framework-5 action

I have trying use an overriding OnActionExecute on my controller for insert other values in model received from post using jQuery.post, but it happens that on this case the OnActionExecute is not c...

Could not resize the activity indicator in iOS 5.0?

iphone objective-c ios cocoa-touch

In my Universal app, in iPAd part I am resizing the activity indicator...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.