My application is referring some 3rd party jars. If i am keeping them in TOMCAT/shared/lib then my application is working fine.
Is there any way to refer these jars without putting them in server specific location. Server is shared by multiple applications and not all the applications need these jars
and moreover i will not have access to server folders on production.
I believe TOMCAT/shared/lib is where those jars are supposed to go. That's in contrast to TOMCAT/common/lib, which is for jars needed by the app server itself. However, you have a couple of other choices. If your multiple applications are all part of a single ear, you can put them in the ear's lib directory. If you're deploying as individual wars though, then you'd have to put them in every war's lib.
Note, however, that the shared/lib directory no longer exists in Tomcat 6 and 7. It has been replaced by a single lib directory. And Tomcat 5.x is old enough you should seriously consider upgrading.
Although I don't think it's explicitly stated, there is an implicit assumption that J2EE webapps should be self-contained - part of the "write once, run anywhere" concept. Sharing a library between apps, or worse yet, sharing memory between apps, is a questionable practice. It raises the cost of maintenance to the apps, since it's a lot easier (=cheaper) to debug issues in one app as opposed to a bunch of interacting apps. And it might make it difficult to scale the apps to some other platform such as JBoss or WebSphere. Or, for that matter, to cluster Tomcat, since each instance of a cluster resides in a separate VM with a separate memory space not sharable with other instances.
Effectively, when you put a library in the Tomcat lib (or shared/lib) directory, it becomes part of the server classpath. So all resources in that library must be thread-safe or results will be unpredictable. Which is part of the higher costs I mentioned.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.