It's not a secret anymore!
The moose likes Servlets and the fly likes global object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "global object" Watch "global object" New topic

global object

Neil Goldsmith
Ranch Hand

Joined: Nov 02, 2001
Posts: 34
All of our servlets need to obtain a global object via a JNDI lookup and pass it data. The global object then sends a command over a socket connection to a legacy system, gets back a response and sends it back to the servlet. The global object starts up and goes down along with the appserver ( or servlet container) This should work on both Tomcat and Websphere. I've noticed WS is much more restrictive with objects running within the app server, no multiple threading, no sockets, whereas I can do all of that within Tomcat by simply creating a Global JNDI resource defined in server.xml.

I'd like to come up with a general solution that works for both Tomcat and WS. Am I missing something within WS that might allow me to do this? Is there a better solution that will work for both TC and WS?

steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 862
A static variable will be able to be accessed as long as the jvm is up. If you loaded the jar/class of this variable in the server classpath it would be available to all applications within the server. - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Just mad idea to create a fake servlet which context can be accessed from all others.

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
I agree. Here's the link:
subject: global object
It's not a secret anymore!