The application flow is:
jsp -->servlet --->processor class -->session bean-->DAO -->database.
The application server is oracle 9ias
when two or more users access the application (same menu item) at the same time it gives nullpointer exception for all the users except one.Only one user is able to see the next screen.
In the processor class we are setting the values in the session..but in the servlet when we try to print the session values in the servlet it is printing null for the users except for one ..
-
Session variables becoming null (11 messages)
- Posted by: Rashmi Venugopal
- Posted on: July 15 2004 03:10 EDT
Threaded Messages (11)
- Session variables becoming null by Senthil Chinnaiyan on July 15 2004 07:23 EDT
- Not clustered by Rashmi Venugopal on July 15 2004 08:24 EDT
-
Not clustered by Senthil Chinnaiyan on July 15 2004 10:53 EDT
-
Non clustered by Rashmi Venugopal on July 16 2004 02:36 EDT
-
Session variables becoming null by Mohit Gupta on July 16 2004 03:41 EDT
-
Session variables becoming null by Rashmi Venugopal on July 16 2004 04:09 EDT
- Session variables becoming null by Senthil Chinnaiyan on July 16 2004 06:19 EDT
-
Session variables becoming null by Mohit Gupta on July 16 2004 09:33 EDT
-
Session variables becoming null by Rashmi Venugopal on July 19 2004 06:07 EDT
-
Session variables becoming null by Mohit Gupta on July 19 2004 08:31 EDT
- Session variables becoming null by Rashmi Venugopal on July 19 2004 08:37 EDT
-
Session variables becoming null by Mohit Gupta on July 19 2004 08:31 EDT
-
Session variables becoming null by Rashmi Venugopal on July 19 2004 06:07 EDT
-
Session variables becoming null by Rashmi Venugopal on July 16 2004 04:09 EDT
-
Session variables becoming null by Mohit Gupta on July 16 2004 03:41 EDT
-
Non clustered by Rashmi Venugopal on July 16 2004 02:36 EDT
-
Not clustered by Senthil Chinnaiyan on July 15 2004 10:53 EDT
- Not clustered by Rashmi Venugopal on July 15 2004 08:24 EDT
-
Session variables becoming null[ Go to top ]
- Posted by: Senthil Chinnaiyan
- Posted on: July 15 2004 07:23 EDT
- in response to Rashmi Venugopal
Is it in a clustered environment?
Senthil. -
Not clustered[ Go to top ]
- Posted by: Rashmi Venugopal
- Posted on: July 15 2004 08:24 EDT
- in response to Senthil Chinnaiyan
No.Its not in clustered environment. -
Not clustered[ Go to top ]
- Posted by: Senthil Chinnaiyan
- Posted on: July 15 2004 10:53 EDT
- in response to Rashmi Venugopal
I think you can use listeners like HttpSessionListener to find out when the session is destroyed. Check your code if you change the inactive anywhere.
Senthil. -
Non clustered[ Go to top ]
- Posted by: Rashmi Venugopal
- Posted on: July 16 2004 02:36 EDT
- in response to Senthil Chinnaiyan
We implemented the above said Listener and we found that no session is invalidated in between and only sessionCreated() is invoked.
Could u suggest something else?
Or,is it the problem with the container itself?
Please help us............. -
Session variables becoming null[ Go to top ]
- Posted by: Mohit Gupta
- Posted on: July 16 2004 03:41 EDT
- in response to Rashmi Venugopal
Hi Rashmi,
Just to verify you are not declaring any variables at class level in your servlet apart from HttpSession object or Servlet Context object.Whatever processing or intialization you are doing must be in the servlet methods.
for more clarity can you send me the code snippet of servlet and processor
Cheers,
Mohit -
Session variables becoming null[ Go to top ]
- Posted by: Rashmi Venugopal
- Posted on: July 16 2004 04:09 EDT
- in response to Mohit Gupta
Based on the request from JSP,the servlet parses the Mapping.xml(contains mapping b/n the request string ,processor class and the destination JSP) and invokes the process method in the respective Processor class(thro' reflection)
In the Processor class,session beans are invoked for accessing the DAO to perform the db operations.
This is the flow of the application.
And to clarify ur doubt,we don't have any class level variables in the servlet.
If this does'nt gives u the clear picture,let me know and i'll send the code snippet.
Rashmi -
Session variables becoming null[ Go to top ]
- Posted by: Senthil Chinnaiyan
- Posted on: July 16 2004 06:19 EDT
- in response to Rashmi Venugopal
Can you try SingleThreadedModel interface?, anyway it is depricated in J2ee1.4
Senthil. -
Session variables becoming null[ Go to top ]
- Posted by: Mohit Gupta
- Posted on: July 16 2004 09:33 EDT
- in response to Rashmi Venugopal
Actually i also faced the same problem in our project but it get resolved when i remove all the class level variables . i have to see ur servlet and processor code where u r storing session variables and retriving.
As what Senthil suggest u can try a SingleThreadModel but u have to take a care lot about synchronization issues.
-Mohit -
Session variables becoming null[ Go to top ]
- Posted by: Rashmi Venugopal
- Posted on: July 19 2004 06:07 EDT
- in response to Mohit Gupta
Hi Mohit,
In all our processor classes,the HttpSesion object is at the class level.i.e,instance variable.Is that causing these problems?
If so,please tell me what is the workaround for this .
Reply needed urgently -
Session variables becoming null[ Go to top ]
- Posted by: Mohit Gupta
- Posted on: July 19 2004 08:31 EDT
- in response to Rashmi Venugopal
Just a sample of what i am doing:
public class Gateway extends HttpServlet
{
HttpSession session;
ServletContext scCtx;
public Gateway() {
scCtx = null;
}
//The init method takes care of all the initialization, and it made in such a way that, the inital class laoding time is high, but one the class is loaded the performance is max
public void init(ServletConfig servletconfig)throws ServletException {
//Calling the init of the super class
super.init(servletconfig);
//Getting the servelet context
scCtx = servletconfig.getServletContext();
System.out.println("Gateway Initialization");
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
session = request.getSession(true);
// call request processor class
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doGet(request, response);
}
}
Just try this and let me know.
-Mohit -
Session variables becoming null[ Go to top ]
- Posted by: Rashmi Venugopal
- Posted on: July 19 2004 08:37 EDT
- in response to Mohit Gupta
I think ,I got the solution.I found that the super class of the processor class genre had a set of static declarations for all the child processor classes and a static initializer which initialized these.
I removed the static declarations for these and made them instance variables
And fortunately,the application is able to handle 4 concurrent users and hope to take many such users,without a hitch.
And ,I am thankful for all ur suggestions.