It's not a secret anymore!*
The moose likes BEA/Weblogic and the fly likes StartUp class in Weblogic 10.3 Application Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "StartUp class in Weblogic 10.3 Application Server" Watch "StartUp class in Weblogic 10.3 Application Server" New topic
Author

StartUp class in Weblogic 10.3 Application Server

Gagan Tiwari
Ranch Hand

Joined: Jun 10, 2008
Posts: 71
Hi All
We have a J2EE Application deployed on Weblogic 8.1 SP5 and we used the following option for
startup class.

1. Created an XML File called weblogic-application.xml
2. The contents are as follows

<weblogic-application>
<startup>
<startup-class>NAME OF STARTUP CLASS</startup-class>
<startup-uri>startup.jar</startup-uri>
</startup>
<shutdown>
<shutdown-class>NAME OF SHUTDOWN CLASS</shutdown-class>
<shutdown-uri>startup.jar</shutdown-uri>
</shutdown>
</weblogic-application>
3. Now these classes were called when the application was deployed or undeployed.

However when migrated to Weblogic 10.3 Application server the same is not working.
Kindly suggest if this way is depricated in the new version of the Application server
and what is the way to implement this in the newer version.

Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

The interface that is used for the startup / shutdown classes are deprecated. I cannot remember the new interface and configuration, but it is well documented.

This is a good chance to use a ServletContextListener instead of a weblogic startup class. That way your logic is less dependent on weblogic interfaces and is loosely coupled. It is highly unlikely the ServletContextListener will change. The same cannot be said for the weblogic startup class behaviour


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Gagan Tiwari
Ranch Hand

Joined: Jun 10, 2008
Posts: 71
Many thanks for the reply
I have incorporated the Application Life Cycle Events approach in which we have to write a listener which implements the ApplicationLifecycleListener and then write the startup and shutdown class and placed the STARTING Code inside the main method of the Startup class and the removal code in the shutdown class.

The result is as per expectation, but the issue is coming in clustered environment.
We have 2 servers and if we stop server one then the server 2 is not at all able to get the details, as I suppose as soon as server1 was stopped the resources were freed up. Kindly suggest
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

We have 2 servers and if we stop server one then the server 2 is not at all able to get the details, as I suppose as soon as server1 was stopped the resources were freed up. Kindly suggest


I am not sure what you mean by this. When you stop server one, it frees up some resources and when you stop server 2 it tries to free the same resources ?

ApplicationLifecycleListener


Ah yes that rings a bell
Gagan Tiwari
Ranch Hand

Joined: Jun 10, 2008
Posts: 71
Let me just elaborate a bit more on this.

I am starting a Thread which is listening to the Queue (MQ) for getting the messages and processing the same.

so we start the thread in startup and stop the same in shutdown class.

Now in clustered environment we have two servers running and say when ONE goes down, its triggers the stopping of thread and hence even though server 2 is running the messages are not being processed.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Is the JMS queue also clustered or does it run in server one alone ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: StartUp class in Weblogic 10.3 Application Server
 
Similar Threads
authentication in jboss
Web application clustering
Increasing WebLogic Startup Time
problem in deploying a web application war
Startup problem in oracle 9ias (Custom Startup class)