Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Startup class in WAS

 
AbhiRaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to have some sort startup class which would be executed when the server starts up. How can this be achieved? How can I specify the startup class in the administrative console
Any help will be appreciated.
Abhi
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of WebSphere are you using? The answer depends on that...
Kyle
 
Jun Hong
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To some extent, IBM makes WAS 4.0 startup class useless. Say, the new custom service doesn't support JNDI service. In the bank, I am working for, some people developed a ejb framework for WAS 3.5. This framework works as part of container, because it is started by start up class. However, the current startup class doesn't work with this framework which uses JNDI service. Also, there is some classpath problem. If this framework load some classes, my ejb cannot see them. Weird. So be careful with startup class.
Go to info center and there is a chapter for Custom Service. That is about the startup class, if you are using 4.0. I cannot rember the name of the interface. I think there is a method defined in the interface called initilize. Also, another method is called terminate or something.
[ January 31, 2002: Message edited by: Jun Hong ]
 
j krishnan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can specify the tag in the Web.xml for the corresponding class to start when the server starts.
<load-on-startup> 1 <load-on-startup>
 
j krishnan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can specify the tag in the Web.xml for the corresponding class to start when the server starts.
load-on-startup 1 load-on-startup
 
AbhiRaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle,
I am working on IBM Websphere Enterprise edition 4.0. I need to load quite a lot of data during the start up.
Abhi
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, now what do you mean by "load a lot of data". Are you talking about Singletons? Are you writing a Servlet/JSP application or an EJB application?
Kyle
 
AbhiRaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle,
 
AbhiRaj
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle,
I wanted to load a quite a lot of master data from the database, when the server starts. We are following a typical MVC architechure. I need to write a startup class which will load this master data which would be available for populating the master data as required on the screen.
I hope things are clear..
Abhi
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I understand now. Well, since you will probably want to use Connection poools, and maybe even EJB's to do this, I would suggest that you handle this kind of thing in the init() method of your front controller servlet. Just make sure that your web.xml file has that servlet marked as "load on startup", as noted above. That is probably the best way to handle it.
Also as noted above the other method of startup execution available in WebSphere has problems in that it runs BEFORE the EJB container and other things are initialized.
Kyle
[ February 02, 2002: Message edited by: Kyle Brown ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic