Search code examples
javaweblogicjdeveloperweblogic12c

Invoke a java main class when weblogic server starts


I have a java class has a main method. I want this main method to be executed whenever I start the WebLogic server.

Also I would like to have this class exit safely if I stop the WebLogic server.

I am not sure how to deploy this simple java application to WebLogic server or there is a way to configure the WebLogic server to call a jar file. What is the best way to do this? Thank you.


Solution

  • You can configure WLS to call a specific Java class on startup and/or shutdown via the admin console. The class must be on the WLS class path, so making modifications to that class involves a rolling node restart (and the ability to put the file on the class path startup scripts, of course).