wood burning stoves 2.0*
The moose likes Websphere and the fly likes Loading Properties into WAS on Startup 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 » Products » Websphere
Bookmark "Loading Properties into WAS on Startup" Watch "Loading Properties into WAS on Startup" New topic

Loading Properties into WAS on Startup

Dean Tomlinson

Joined: Feb 28, 2001
Posts: 8
Does anyone know how to specify a startup class in IBM webSphere, I want to get a class to load when the app server starts that will read property values from a properties file, and put these into static data members.
I know you can do this in weblogic, has anyone done the same in websphere ?
cheers, dean
Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
Do you want to preload a generic class or a servlet?
I am not sure how to preload a generic class but I do know how to preload a servlet.
If you have your servlet defined in Websphere Admin console then there is "Load at startup" option on the advanced tab. If you are using the auto-invoker servlet (created by the Create Application Wizard) then you need an xml servlet configuration file in your servlet folder (file extension ends with .servlet). You will find the details about the configuration file in the infocenter documentation. You could also copy an existing one from some of the sample servlets.
Good Luck,
Ravindra Guravannavar

Joined: May 28, 2001
Posts: 1
Even I am looking for the same - how to specify a startup class in WebSphere. In my case the startup class could be any generic class not necessarily a Servlet, though any restriction to implement a WebSphere specific interface is acceptable. In WebLogic we can do this through the weblogic.properties file.
Harish SK

Joined: Jun 01, 2001
Posts: 20
I too need a startup class to get instantiated at startup and an interface method to be called. The method called acts as a server doing something periodically.
I am wondering if I can do the same in a servlet init() but not comfortable with the idea of a servlet init() going into a loop.
daman sidhu
Ranch Hand

Joined: Aug 19, 2000
Posts: 184
One option you have is that make an object of that class in a servlet classes init() and load that servlet on startup,
I did this for a class i had running which needed to do some periodic checks and this worked pretty fine, other wise better option is to use a scheduler which is there in Win NT as well as UNIX.
kirupakaran jayaraman

Joined: Jun 01, 2001
Posts: 6
hai guys,
Very interesting ques,
but still i have doubt in the syntax how u will specify in the weblogic.properties file,
Where this kind of stuff will be required in real time application
Lambent systems

regards<BR>kirupakaran<BR>Lambent systems<BR>chennai
daman sidhu
Ranch Hand

Joined: Aug 19, 2000
Posts: 184
Ill tell u a place where a schduler needed to load a class at startup, we had made an reverse auction site, in that we had the facility that the user could specify the start date of the auction, so there needed to be a class that should do these checks from the database regarding the date and time to start the auction and enable the start flag.
Balbir Singh
Ranch Hand

Joined: Jun 01, 2001
Posts: 79
On Solaris this can be done by writing a shell script which makes a call to the java program which loads the specific classes. This shell script is called in startupServer.sh, so whenever the server is started, a call is made to the other shell script which does the job required.
Thanks and Regards
Balbir Singh

Thanks and Regards<br />Balbir Singh<br />Sun Certified Java Programmer<br />IBM Certified Administrator for WebSphere4.0
I agree. Here's the link: http://aspose.com/file-tools
subject: Loading Properties into WAS on Startup
Similar Threads
WAS 3.5.3 Local OS Security
how to make a servlet to run at startup of the application
properties file editing
IBM WebSphere
load on startup tag