jQuery in Action, 3rd edition
The moose likes BEA/Weblogic and the fly likes Startup Servlet in weblogic clustered environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Startup Servlet in weblogic clustered environment" Watch "Startup Servlet in weblogic clustered environment" New topic

Startup Servlet in weblogic clustered environment

Prem Kashyap
Ranch Hand

Joined: Oct 10, 2006
Posts: 52
I have a startup servlet which creates a new thread to read a file and create some instance with the values fetched from the file.
The WAR file is deployed in weblogic clustered environment. I mean one weblogic server but having 2 cluster. So basically its only one machine and one server. but it is clustered.
So the issue is that there are 2 clusters. And both the clusters are creating the thread and making new instance with same values from the file.
So i am having duplicate instances.

Is there any way I can stop the 2nd cluster from creating the thread if first cluster has created the thread?

How about having one config parameter in web.xml say for example: createThread and set its value to false when one of the cluster creates the thread.

Any suggestion will help...

Prem Kashyap
SCJP 1.4
damien malone
Ranch Hand

Joined: May 06, 2003
Posts: 35
because they are running in sperate JVM's static variables wont work. Also updating environment variables wont work as they are local to each server.

Because both servers are on the one machine you could think about a quick and dirty solution of using a .lok file

i.e. on startup look for a file called something like createthread.lok

if file exists do nothing, if doesnt exist create empty file called that, run your code and delete the file at the end of the process.
I agree. Here's the link: http://aspose.com/file-tools
subject: Startup Servlet in weblogic clustered environment
It's not a secret anymore!