Solved

Servlet init getting called twice sometimes in oc4j - interesting

Posted on 2004-04-26
7
424 Views
Last Modified: 2010-03-17
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
Comment
Question by:svgkraju
  • 2
  • 2
7 Comments
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10949738
0
 

Author Comment

by:svgkraju
ID: 10949912
I didn't find relevant information for my question in those links.
0
 
LVL 9

Expert Comment

by:vzilka
ID: 10978167
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
 

Author Comment

by:svgkraju
ID: 10983646
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
 
LVL 9

Accepted Solution

by:
vzilka earned 30 total points
ID: 10983664
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now