Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

Servlet init getting called twice sometimes in oc4j - interesting

I am using oc4j 9.0.2 and deployed some servlets. When I tracked the execution trace of the all the servlets in my application, I found the following scenario in my log.

4/22/04 9:04 PM: Warning: Error reading transaction-log file (/C:/oc4j/j2ee/home/persistence/transaction.state) for recovery: premature end of file4/22/04 9:04 PM:
4/22/04 9:04 PM: Forced or abrupt (crash etc) server shutdown detected, starting recovery process...4/22/04 9:04 PM:
4/22/04 9:04 PM: Recovery completed, 0 connections committed and 0 rolled back...4/22/04 9:04 PM:
4/23/04 12:02 AM: qtMainServ init started4/23/04 12:02 AM:
4/23/04 12:02 AM: In getProperties4/23/04 12:02 AM:
4/23/04 12:02 AM: INITIAL_CONTEXT ... is null4/23/04 12:02 AM:
4/23/04 12:02 AM: initial context factory: com.evermind.server.rmi.RMIInitialContextFactory4/23/04 12:02 AM:
4/23/04 12:02 AM: qtMainServ init completed4/23/04 12:02 AM:
4/23/04 12:02 AM: qInspServ init started4/23/04 12:02 AM:
4/23/04 12:02 AM: In getProperties4/23/04 12:02 AM:
4/23/04 12:02 AM: qInspServ init completed4/23/04 12:02 AM:
4/23/04 1:17 AM: qtMainServ init started4/23/04 1:17 AM:
4/23/04 1:17 AM: In getProperties4/23/04 1:17 AM:
4/23/04 1:17 AM: qtMainServ init completed4/23/04 1:17 AM:
4/23/04 5:41 AM: qtReportServ init started4/23/04 5:41 AM:
4/23/04 5:41 AM: In getProperties4/23/04 5:41 AM:
4/23/04 5:41 AM: qtReportServ init completed4/23/04 5:41 AM:
4/23/04 6:38 AM: qAdminServ init started4/23/04 6:38 AM:
4/23/04 6:38 AM: In getProperties4/23/04 6:38 AM:
4/23/04 6:38 AM: qAdminServ init completed4/23/04 6:38 AM:

AT 12:02AM qtMainServ init started and completed. Again at 1:17AM qtMainServ init was executed. This is not happening always. Didn't understand why this is happend. Any reason behind this?

regds
-raju
0
svgkraju
Asked:
svgkraju
  • 2
  • 2
1 Solution
 
svgkrajuAuthor Commented:
I didn't find relevant information for my question in those links.
0
 
vzilkaCommented:
Basically, the application server can choose to load several instances of the same servlet, so for each instance, the init method will run.
This seems like the case with your application.
0
 
svgkrajuAuthor Commented:
Why several instances of a servlet required? Any reason behind this? Under which circumstances a servlet creates a new instance? In my application I need only one instance of each servlet.
0
 
vzilkaCommented:
The servlet container is the judge. Probably because of synchronization issues under load.
I don't know of any way to stop this behavior.

Why do you need only one nstance? Perhaps you should try to move some of the code into a singleton.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now