• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to load a class file during startup

 
slagy maggie
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a java class that i want to run during the weblogic startup,how do i do this.to be more specific, each time i start the server, i need this class to run so that it reads off the database(and stores info in the form of cache). How do i do this
where do i specify in the container that it should run this class
thanks
rupa
 
Tim Holloway
Bartender
Posts: 18414
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You define a Weblogic Startup class. This is a class invoked at WLS startup time, just like you want. You define it as a regular class implementing the interface weblogic.common.T3StartupDef.
There's also some config info to tell WLS to invoke the class at startup and to supply the parameters to your startup() method.
For details, check out the online WebLogic docs at http://www.weblogic.com - you may have to dig, but it's clearly explained in there somewhere, because I found it and used it myself several months back.
[This message has been edited by Tim Holloway (edited August 02, 2001).]
 
vipul makwana
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Slagy,
Which version of weblogic you are using?? is it 5.x?? Let me know.
Vipul.
 
Shan Karawita
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi slagy ,
I think my experience of configuring the startup classes in weblogic (ver 6.0) would help you.I have done the exact thing for one of my project ( I have defined a startup classes to make connection pools for two lagacy systems & it works fine ).I will tell you the steps that I followed during my configuration & deployment....

(1) First I have created the .jar (xxxxxx.jar)file including
all the class files (including the package structure ,
startup classes & including EJB's).


2) Then I created the ejbc file ,

java weblogic.ejbc � [xxxxxx.jar] � [yyyyyy.jar]



3) Then I deployed the yyyyyy.jar file in the weblogic ,
(simply copied the yyyyyy.jar file into \bea\wlserver6.0
\config\mydomain\applications directory)


4) You have to specify the class path to this directory & to
my yyyyyy.jar file in startWebLogic.cmd file.
(\bea\wlserver6.0\config\mydomain\startWebLogic.cmd)


5) Then start the weblogic server.


6) Then in the browser you have to get the console,
(http://[your server's Ip]:7001/console)


7) From the left hand side , click on the tree..
Deployments --> Startup & Shutdown


8) Then from the right Window click,

Create a new Startup Class...



9) In configuration tab , you should enter the name to your
startup class in the first text field, in the second text
field enter the path to your startup class ,
Ex . MyPackage.MyStartup (This should be inthe yyyyyy.jar
file) and keep the third field blank if you don't have any
arguments to be specify.Then click Create Button


10) Then select the Targets tab .Then you can see another
tab pane including Servers and Clusters.In
the Servers tab select your server (Ex : myserver) & put it
in the Choosen window by clicking the Arrow & press
Apply.

Now you are ready to re-start the server & see the
beauty of you startup classes working....
Hope this will help you,
Shan.












[This message has been edited by Shan Karawita (edited August 04, 2001).]
[This message has been edited by Shan Karawita (edited August 04, 2001).]
[This message has been edited by Shan Karawita (edited August 04, 2001).]
[This message has been edited by Shan Karawita (edited August 04, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!