• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NullPointerException while using ERPersistentSessionStorage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NullPointerException while using ERPersistentSessionStorage


  • Subject: Re: NullPointerException while using ERPersistentSessionStorage
  • From: Christoph Wick <email@hidden>
  • Date: Mon, 29 Jul 2013 20:12:29 +0200

Dear Ramsey,

thx for your helpful suggestions. I followed them and many bugs disappeared.

But at the end, there are still some showstoppers of type "The Fun™" - see stacktrace below.

It happens, if I'm trying to save something back into the DB. It seems that deserialization of the persistent session always fails, if the session has to deal with one of my PMSUsers objects. My model is basically

	PMSUser.school() -> PMSSchool, PMSScholl.students() -> PMSUser

I don't thinks, that this is a model toooo complicated. But I'm not sure. I am afraid that fixing this is beyond my WO knowledge. But if there are any hints I would try to dig into that.

C.U.CW
--

Christoph Wick - Diplom Informatiker, Managing Director
i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany

T +49 2 28 28 62 97 93
M +49 1 51 22 65 78 90
F +49 2 28 28 62 97 99
M email@hidden
W www.i4innovation.de

Geschäftsführer: Thomas Heep, Christoph Wick
Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: DE276502600



Jul 29 20:06:16 PMS[65432] WARN  er.persistentsessionstorage.model.ERSessionInfo  - Failed to deserialize session
NullPointerException
  at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer.setObjectForIndex(_EOMutableKnownKeyDictionary.java:499)
  at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_GenericRecordBinding.setValueInObject(_EOMutableKnownKeyDictionary.java:594)
  at er.extensions.eof.ERXGenericRecord$TouchingBinding.setValueInObject(ERXGenericRecord.java:220)
  at com.webobjects.eocontrol.EOCustomObject.takeStoredValueForKey(EOCustomObject.java:998)
  at er.extensions.eof.ERXGenericRecord.takeStoredValueForKey(ERXGenericRecord.java:1261)
  at de.i4innovation.bwinfpms.eo.PMSGenericRecord.takeStoredValueForKey(PMSGenericRecord.java:64)
  at com.webobjects.eocontrol.EOEditingContext._mergeValueForKey(EOEditingContext.java:663)
  at com.webobjects.eocontrol.EOEditingContext._mergeObjectWithChanges(EOEditingContext.java:3457)
  at com.webobjects.eocontrol.EOEditingContext.readObject(EOEditingContext.java:5367)
     ... skipped 4 stack elements
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
  at java.io.ObjectInputStream.access$300(ObjectInputStream.java:205)
  at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2126)
  at java.io.ObjectInputStream.readFields(ObjectInputStream.java:537)
  at com.webobjects.eocontrol.EOCustomObject.readObject(EOCustomObject.java:1132)
     ... skipped 3 stack elements
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
  at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1685)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1341)
  at java.io.ObjectInputStream.access$300(ObjectInputStream.java:205)
  at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2126)
  at java.io.ObjectInputStream.readFields(ObjectInputStream.java:537)
  at com.webobjects.foundation.NSDictionary.readObject(NSDictionary.java:599)
     ... skipped 3 stack elements
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
  at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
  at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:498)
  at com.webobjects.appserver.WOSession.readObject(WOSession.java:538)
     ... skipped 4 stack elements
  at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
  at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
  at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
  at er.persistentsessionstorage.model.ERSessionInfo.sessionFromArchivedData(ERSessionInfo.java:86)
  at er.persistentsessionstorage.model.ERSessionInfo.session(ERSessionInfo.java:51)
  at er.persistentsessionstorage.ERPersistentSessionStore.restoreSessionWithID(ERPersistentSessionStore.java:32)
  at com.webobjects.appserver.WOSessionStore.checkOutSessionWithID(WOSessionStore.java:182)
  at com.webobjects.appserver.WOApplication.restoreSessionWithID(WOApplication.java:1913)
  at er.extensions.appserver.ERXApplication.restoreSessionWithID(ERXApplication.java:2403)
  at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:260)
  at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302)
  at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:378)
  ... skipped 6 stack elements





On 29.07.2013, at 18:30, Ramsey Gurley <email@hidden> wrote:

> This is the result of some general bugginess in EOCustomObject and EOGenericRecord classes. Their serialization is intertwined in such a way as to cause null pointer exceptions.
>
> When you add the persistent session storage framework to your build path, make sure the framework is at the very top of your classpath just under ERExtensions. If it is listed below the EOControl framework, it will not work properly. It might work long enough to appear to be working properly, but you'll definitely get the NPEs at some point :-)
>
> If you still get NPEs after correctly ordering your build path, you may find there is still some bugginess in those two classes. I fixed them so that they work in all the cases I use them, but I have bumped into a couple of cases where the NPE rears its ugly head. Usually I just slightly change the way I'm doing something and it will disappear. For instance, in this case, you may try storing your user in your session.objectStore instead of on an iVar.
>
> If you hit a real blocker, or just feel like working on it, those two classes may still need a couple of tweaks to make serialization of EOs bulletproof. By the time I got to reimplementing them for persistent sessions, I was becoming bored with it :-) Fixing serialization bugs is The Fun™
>
> Ramsey
>
> On Jul 29, 2013, at 5:57 AM, Christoph Wick wrote:
>
>> Hi List,
>>
>> I was trying to use ERPersistentSessionStorage (looks otherwise very promising, thx Ramsey).
>>
>> I'm getting a silly NullPointerException (stacktrace below) in an application that was working perfectly before without using ERPersistantSessionStorage. I have no idea how to debug this to get more information.
>>
>> The problem may come from storing an EO object called PMSUser in the session (basically a user object with name, login, passwd ... PMS=prefix for the project's classes). The code is:
>>
>> public class Session extends ERXSession {
>>
>> 	private PMSUser currentUser = null;
>>
>> 	public PMSUser currentUser() {
>> 		return currentUser;
>> 	}
>>
>> 	public void setCurrentUser(PMSUser currentUser) {
>> 		this.currentUser = currentUser;
>> 	}
>> 	...
>> }
>>
>> The page where the error occurs is the one where the user can change his/her personal data using a form like
>>
>> 	<wo:form>
>> 		<wo:textfield id="inputGivenName" value = "$session.currentUser.firstName" />
>> 		...
>> 		<wo:submitButton action="$saveAction" value="save" />
>> 	</wo:form>
>>
>> but NOT AFTER saving, but directly before rendering the page with the form.
>>
>> Any ideas? Thanks in advance,
>> C.U.CW
>> --
>>
>> Christoph Wick - Diplom Informatiker, Managing Director
>> i4innovation GmbH, Professor-Neu-Allee 39, 53225 Bonn, Germany
>>
>> T +49 2 28 28 62 97 93
>> M +49 1 51 22 65 78 90
>> F +49 2 28 28 62 97 99
>> M email@hidden
>> W www.i4innovation.de
>>
>> Geschäftsführer: Thomas Heep, Christoph Wick
>> Sitz der Gesellschaft: Bonn | Amtsgericht Bonn HRB 18548 | USt-IdNr.: DE276502600
>>
>>
>> Jul 29 14:41:01 PMS[65432] WARN  NSLog  - <er.extensions.appserver.ERXComponentRequestHandler>: Exception occurred while handling request:
>> java.lang.NullPointerException
>> [2013-7-29 14:41:1 MESZ] <WorkerThread0> java.lang.NullPointerException
>> 	at com.webobjects.eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:834)
>> 	at er.extensions.eof.ERXGenericRecord.willReadRelationship(ERXGenericRecord.java:380)
>> 	at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_LazyGenericRecordBinding.valueInObject(_EOMutableKnownKeyDictionary.java:614)
>> 	at er.extensions.eof.ERXGenericRecord$TouchingBinding.valueInObject(ERXGenericRecord.java:209)
>> 	at com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:990)
>> 	at com.webobjects.eocontrol.EOEditingContext._valuesForObject(EOEditingContext.java:790)
>> 	at com.webobjects.eocontrol.EOCustomObject.writeObject(EOCustomObject.java:1125)
>> 	at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
>> 	at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
>> 	at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
>> 	at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
>> 	at com.webobjects.foundation.NSDictionary.writeObject(NSDictionary.java:594)
>> 	at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
>> 	at com.webobjects.appserver.WOComponent.writeObject(WOComponent.java:314)
>> 	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
>> 	at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
>> 	at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
>> 	at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
>> 	at com.webobjects.foundation.NSDictionary.writeObject(NSDictionary.java:594)
>> 	at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
>> 	at com.webobjects.appserver.WOComponent.writeObject(WOComponent.java:314)
>> 	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
>> 	at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:161)
>> 	at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1687)
>> 	at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:478)
>> 	at com.webobjects.foundation.NSDictionary.writeObject(NSDictionary.java:594)
>> 	at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:601)
>> 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
>> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
>> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
>> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
>> 	at er.persistentsessionstorage.model.ERSessionInfo.archiveDataFromSession(ERSessionInfo.java:61)
>> 	at er.persistentsessionstorage.ERPersistentSessionStore.saveSessionForContext(ERPersistentSessionStore.java:46)
>> 	at com.webobjects.appserver.WOSessionStore.checkInSessionForContext(WOSessionStore.java:234)
>> 	at com.webobjects.appserver.WOApplication.saveSessionForContext(WOApplication.java:1892)
>> 	at er.extensions.appserver.ERXApplication.saveSessionForContext(ERXApplication.java:2381)
>> 	at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:273)
>> 	at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302)
>> 	at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:378)
>> 	at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
>> 	at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:2109)
>> 	at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:2074)
>> 	at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
>> 	at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
>> 	at java.lang.Thread.run(Thread.java:722)
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >NullPointerException while using ERPersistentSessionStorage (From: Christoph Wick <email@hidden>)
 >Re: NullPointerException while using ERPersistentSessionStorage (From: Ramsey Gurley <email@hidden>)

  • Prev by Date: Re: ERDListPageRepetition Question
  • Next by Date: Re: ERDListPageRepetition Question
  • Previous by thread: Re: NullPointerException while using ERPersistentSessionStorage
  • Next by thread: createPrototypeCache NullPointerException
  • Index(es):
    • Date
    • Thread