File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes Startup class in WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Startup class in WAS" Watch "Startup class in WAS" New topic
Author

Startup class in WAS

AbhiRaj
Greenhorn

Joined: Jan 25, 2002
Posts: 4
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
What version of WebSphere are you using? The answer depends on that...
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Jun Hong
Ranch Hand

Joined: Sep 05, 2001
Posts: 181
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 ]

Jun Hong<br />SCJP, SCJD, SCWCD, SCEA<br />IBM Certified Systems Expert(V4.0)
j krishnan
Greenhorn

Joined: Jul 20, 2001
Posts: 27
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

Joined: Jul 20, 2001
Posts: 27
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

Joined: Jan 25, 2002
Posts: 4
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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

Joined: Jan 25, 2002
Posts: 4
Kyle,
AbhiRaj
Greenhorn

Joined: Jan 25, 2002
Posts: 4
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Startup class in WAS