This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "global object" Watch "global object" New topic
Author

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?

thx
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 860
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.


http://www.jamonapi.com/ - 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"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: global object
 
Similar Threads
Passing around java object
JNDI , Tomcat
Global Resources
WS-AT: Across multiple servers in same cell, Across different platforms
Custom JNDI factory in Websphere