This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading Properties into WAS on Startup

 
Dean Tomlinson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
Joe
 
Ravindra Guravannavar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
regards,
Ravi
 
Harish SK
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Cheers,
Daman
 
kirupakaran jayaraman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
regards
------------------
regards
kirupakaran
Lambent systems
chennai
 
daman sidhu
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Daman
------------------
SE
PCS
India
 
Balbir Singh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic