wood burning stoves 2.0*
The moose likes Websphere and the fly likes Error during saving session into database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Error during saving session into database" Watch "Error during saving session into database" New topic
Author

Error during saving session into database

veejay
Greenhorn

Joined: Feb 01, 2002
Posts: 11
Hello,
I have a sporadic appearing error when i try to save the session manually into the database.
The saving is necessery because I use it to make loadbalancing.
I get following error:
[02.02.04 16:50:19:054 CET] 4c3ed5d SessionContex X BackedHashtableMR: a problem storing application data changes to the
database
java.lang.NullPointerException
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionData.getCreationTime(DatabaseSessionData.java:
84)
at com.ibm.servlet.personalization.sessiontracking.SessionData.writeExternal(SessionData.java:654)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at java.util.Hashtable.writeObject(Hashtable.java(Compiled Code))
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at com.ibm.servlet.personalization.sessiontracking.SessionData.writeExternal(SessionData.java:652)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java(Compiled Code))
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
at com.ibm.servlet.personalization.sessiontracking.BackedHashtableMR.handlePropertyHits(BackedHashtableMR.java(C
ompiled Code))
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.ejbStore(BackedHashtable.java:2455)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.storeSession(BackedHashtable.java:2272)
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.put(BackedHashtable.java:2958)
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionContext.sync(DatabaseSessionContext.java:112)
at com.ibm.servlet.personalization.sessiontracking.SessionData.sync(SessionData.java:270)
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionData.sync(DatabaseSessionData.java:1068)
at de.hella.ojb.controller.AdminCMDController.checkLoginAndShowPage(AdminCMDController.java:173)
at java.lang.reflect.Method.invoke(Native Method)
at de.brockhaus.framework.scd.ServletCMD.execute(ServletCMD.java:110)
at de.brockhaus.framework.scd.ServletCMDDispatcher.doGet(ServletCMDDispatcher.java:164)
at de.brockhaus.framework.scd.ServletCMDDispatcher.doPost(ServletCMDDispatcher.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:626)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:360)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:775)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:701)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:478)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:234)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:138)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:77)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104)
at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:212)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEve
ntSource.java:353)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.j
ava:220)
at com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248)
at java.lang.Thread.run(Thread.java:481)
I use AIX WebSphere 3.5.4 and AIX DB2 7.2
I would be very greatful if anyone can help me
Greetings
Vijaya
Graeme Brown
Ranch Hand

Joined: Oct 13, 2000
Posts: 193
The normal way to do this would be by using Websphere's in-built facilities. Why are you having to hard code your own way of doing this?
It looks likely that you are getting synchronization problems with Websphere trying to do it's own thing.
veejay
Greenhorn

Joined: Feb 01, 2002
Posts: 11
Originally posted by Graeme Brown:
The normal way to do this would be by using Websphere's in-built facilities. Why are you having to hard code your own way of doing this?
It looks likely that you are getting synchronization problems with Websphere trying to do it's own thing.

yes i know but the automatic session saving doesnt work for my case.
it saves the session AFTER the service method but in may happen that the servers switch BEFORE that and the session values are useless.
thats why i need a manual hard coded saving procedure.
the automatic saving has been switched off.
Vijaya
Graeme Brown
Ranch Hand

Joined: Oct 13, 2000
Posts: 193
To assist my understanding of what you are trying to do:
Service methods are usually short lived, how long may yours take to execute?
You seem to be saying that a client may make a request on server B before the service method on server A has completed, and that they have to share the same HttpSession object.
Therefore instances of the HttpSession object must exist on both servers at the same time, and they must have their data synchronized.
Is this correct?
[ February 04, 2002: Message edited by: Graeme Brown ]
veejay
Greenhorn

Joined: Feb 01, 2002
Posts: 11
yes, in general you are right.
i cant exactly explain when the service methods ends and when the server is switching from server A to B but a test-application showed that in my case the automatic saving is not working and server B accesses the old data from the saved session because server A still didnt save the session.
thats why i need a manual saving and this is (sometimes) causing the problem which is shown above.
Greetings
Vijaya
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Now I'm confused -- normally WebSphere's session affinity should keep your sessions from switching machines like this. What version of WebSphere are you using, and how are you doing the load balancing (e.g through the WebSphere plugin, or what?)
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
veejay
Greenhorn

Joined: Feb 01, 2002
Posts: 11
i use websphere 3.5.4 on 2 AIX machines.
the loadballancing is made by a network dispatcher which is spreading the requests from A to B, etc.
Greetings
Vijaya
Graeme Brown
Ranch Hand

Joined: Oct 13, 2000
Posts: 193
Vijaya
What method are you using for session identification (e.g. cookies or URL rewriting)?
Also can you clarify if you are hand coding the session persistence because you have a design need to do so, or because you have this problem.
Can you tell us some more about what you are doing in the service method? I am still concerned that your problem may be because of the length of time taken to execute.

Kyle
Can you tell us if WAS has any record locking mechanism during the service method, if not, does this explain why server B is picking up the old data?
veejay
Greenhorn

Joined: Feb 01, 2002
Posts: 11
Hello again,
last days i got a Patch from IBM (PQ50400) which should solve the problem with the session and installed it.
Since that time i get a following error, when i try to save the session:
java.io.InvalidClassException: com.ibm.servlet.personalization.sessiontracking.DatabaseSessionData; Local c
lass not compatible: stream classdesc serialVersionUID=7883348593589443682 local class serialVersionUID=-8905712921709884585
at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java(Compiled Code))
at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java(Compiled Code))
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at java.io.ObjectInputStream.readObject(ObjectInputStream.java(Compiled Code))
at com.ibm.servlet.personalization.sessiontracking.BackedHashtable.getValue(BackedHashtable.java:1615)
at com.ibm.servlet.personalization.sessiontracking.DatabaseSessionData.getValue(DatabaseSessionData.java:647)
at de.brockhaus.framework.scd.ServletCMDDispatcher.registerSelfInSession(ServletCMDDispatcher.java:545)
at de.brockhaus.framework.scd.ServletCMDDispatcher.doGet(ServletCMDDispatcher.java:112)
at de.brockhaus.framework.scd.ServletCMDDispatcher.doPost(ServletCMDDispatcher.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:626)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:360)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:775)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:701)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:478)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:234)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:138)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:77)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104)
at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:212)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEventSource.java:353)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.java:220)
at com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248)
at java.lang.Thread.run(Thread.java:481)

anyone has an idea what it means ???
Greetings
Vjaya
[ February 08, 2002: Message edited by: vijayr ]
ram k
Greenhorn

Joined: Feb 06, 2002
Posts: 3
Are you using IBM extension
"com.ibm.websphere.servlet.session.IBMSession" for manual session update.If so, all of your other servlets must use the manual update only.
This might cause your problem but I am not sure.
Or
Use Websphere built-in support and disable cache to avoid getting old data.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error during saving session into database
 
Similar Threads
Strange error
UTF data for mat exception
Session Management in Websphere 3.5
Error in EJBCreate
Upload error