isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: Unable to re-create a view model
Date Mon, 09 Feb 2015 15:10:48 GMT
Yes, this stack trace seems to confirm my earlier guess... on rehydration
this bookmark is converted to an oid and then being (incorrectly) given to
the JDO object store.

However, looking at the code it seems that PojoRecreatorForDataNucleus is
going down the wrong branch for the referenced view model.  There's a check
there (oid.isViewModel()) that presumably is returning false when it ought
to be returning true.

Perhaps you could put a breakpoint there to debug... the code looks right
to me (albeit the error message is not at all helpful).

Dan




On 9 February 2015 at 14:58, GESCONSULTOR - Óscar Bou <
o.bou@gesconsultor.com> wrote:

> In fact, more details about it.
>
> Seems to be failing while processing the internal ViewModel property:
>
> *com.tellmegen.app.myresults.inheritedconditions.UserInheritedConditionViewModel:PD94b
> --> being the ViewModel to be represented
>
> KIVM:PD94bWwgdmV ... .--> Being "KIVM" the object type of a ViewModel.
> There's one property of that type on the UserInheritedConditionViewModel.
>
> See stacktrace:
>
>
> Caused by:
> org.apache.isis.core.metamodel.spec.feature.ObjectMember$AuthorizationException:
> Not authorized or no such object
> at org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(
> EntityPage.java:111)
> at org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(
> EntityPage.java:71)
> at org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(
> EntityPage.java:67)
> ... 44 more
> Caused by:
> org.apache.isis.core.runtime.persistence.PojoRecreationException: Could
> not recreate pojo for oid oid
> *com.tellmegen.app.myresults.inheritedconditions.UserInheritedConditionViewModel:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PGtpdElucHV0RWxlbWVudFZpZXdNb2RlbC5ib29rbWFyaz5LSVZNOlBEOTRiV3dnZG1WeWMybHZiajBpTVM0d0lpQmxibU52WkdsdVp6MGlWVlJHTFRnaVB6NEtQRzFsYldWdWRHOC1QR3RwZEM1aWIyOXJiV0Z5YXo1TFNWUmZPa3hmTVR3dmEybDBMbUp2YjJ0dFlYSnJQanhwYm5CMWRFVnNaVzFsYm5RdVltOXZhMjFoY21zLVNVNUlSVkpKVkVWRVgwTlBUa1JKVkVsUFRqcE1YekUwTXp3dmFXNXdkWFJGYkdWdFpXNTBMbUp2YjJ0dFlYSnJQand2YldWdFpXNTBiejQ9PC9raXRJbnB1dEVsZW1lbnRWaWV3TW9kZWwuYm9va21hcms-PG5hbWU-RW5mZXJtZWRhZCBkZSBDYW5hdmFuPC9uYW1lPjwvbWVtZW50bz4=
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(
> AdapterManagerDefault.java:320)
> at
> org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type$2.recreateAdapter(
> ObjectAdapterMemento.java:112)
> at
> org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type.getAdapter(
> ObjectAdapterMemento.java:183)
> at
> org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.getObjectAdapter(
> ObjectAdapterMemento.java:280)
> at org.apache.isis.viewer.wicket.model.models.EntityModel.load(
> EntityModel.java:330)
> at org.apache.isis.viewer.wicket.model.models.EntityModel.load(
> EntityModel.java:345)
> at org.apache.isis.viewer.wicket.model.models.EntityModel.load(
> EntityModel.java:1)
> at org.apache.wicket.model.LoadableDetachableModel.getObject(
> LoadableDetachableModel.java:124)
> at org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(
> EntityPage.java:105)
> ... 46 more
> Caused by:
> org.apache.isis.core.runtime.persistence.PojoRecreationException: Could
> not recreate pojo for oid oid
> KIVM:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PGtpdC5ib29rbWFyaz5LSVRfOkxfMTwva2l0LmJvb2ttYXJrPjxpbnB1dEVsZW1lbnQuYm9va21hcms-SU5IRVJJVEVEX0NPTkRJVElPTjpMXzE0MzwvaW5wdXRFbGVtZW50LmJvb2ttYXJrPjwvbWVtZW50bz4=
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(
> AdapterManagerDefault.java:320)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(
> AdapterManagerDefault.java:305)
> at
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.adapterFor(
> DomainObjectContainerResolve.java:104)
> at
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.lookup(
> DomainObjectContainerResolve.java:55)
> at
> org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.lookup(
> RuntimeContextFromSession.java:211)
> at
> org.apache.isis.core.metamodel.services.bookmarks.BookmarkServiceDefault.lookup(
> BookmarkServiceDefault.java:59)
> at
> org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacetDeclarativeAbstract.initialize(
> RecreatableObjectFacetDeclarativeAbstract.java:89)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorDefault.recreatePojo(
> PojoRecreatorDefault.java:49)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(
> PojoRecreatorForDataNucleus.java:34)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(
> PojoRecreatorUnified.java:38)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(
> AdapterManagerDefault.java:317)
> ... 54 more
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of
> range: -1
> at java.lang.String.substring(String.java:1911)
> at
> org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer.toJdoObjectId(
> JdoObjectIdSerializer.java:112)
> at
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadPojo(
> DataNucleusObjectStore.java:410)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(
> PojoRecreatorForDataNucleus.java:36)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(
> PojoRecreatorUnified.java:38)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(
> AdapterManagerDefault.java:317)
>
>
>
>
>
> El 9/2/2015, a las 15:48, GESCONSULTOR - Óscar Bou <o.bou@gesconsultor.com>
> escribió:
>
> Hi all.
>
> One of the properties is another View Model.
>
>
>
> El 9/2/2015, a las 15:40, Martin Grigorov <mgrigorov@apache.org> escribió:
>
> On Mon, Feb 9, 2015 at 4:35 PM, Dan Haywood <dan@haywood-associates.co.uk>
> wrote:
>
> My guess, then, is that the @ViewModel isn't handling references to other
> view models.  I suspect that anything that isn't a simple value (int,
> string, date etc) is being processed as an entity, and a bookmark is being
> created for it.  But on rehydration this bookmark is converted to an oid
> and then being (incorrectly) given to the JDO object store.
>
>
> This is correct!
> I've seen in the stacktrace a code that looks up: propertyId + ".bookmark".
>
>
>
> If I'm right, hopefully is fixable.  Feel free to take a look in the
> ViewModelFacet implementations, see what you can make of it.
>
> The workaround is for the view model object to explicitly implement
> ViewModel, and return a memento; ie handle the viewmodel -> viewmodel
> reference manually.
>
> HTH
> Dan
>
>
> On 9 February 2015 at 14:30, Martin Grigorov <mgrigorov@apache.org> wrote:
>
> Hi Dan,
>
> The commit was a minor optimization.
> The problem is still there.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Feb 9, 2015 at 4:20 PM, Dan Haywood <
>
> dan@haywood-associates.co.uk>
>
> wrote:
>
> Hi Martin,
>
> I saw a commit from you on JdoObjectIdSerializer following on from this
> mail, so did you sort out the issue (or do I need to take a look
>
> tonight?)
>
>
> Cheers
> Dan
>
>
> On 9 February 2015 at 08:17, Martin Grigorov <mgrigorov@apache.org>
>
> wrote:
>
>
> Hi,
>
> What could be the reason a ViewModel cannot be recreated with the
>
> exception
>
> below ?
> Looking
> at
>
>
>
>
> org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer#toJdoObjectId()
>
> it tries to find '_' separator and use the string before it to decide
>
> what
>
> class to load (byte, int, UUID, ...).
>
> In my case the ViewModel extends from an abstract ViewModel. The
>
> parent
>
> one
>
> is annotated with @ViewModel and the child one with
>
> @DomainObject(nature
>
> =
>
> Nature.VIEW_MODEL).
> I've tried different combinations with the annotations but it always
>
> leads
>
> to this exception.
>
> Caused by:
> org.apache.isis.core.runtime.persistence.PojoRecreationException:
>
> Could
>
> not
>
> recreate pojo for oid oid
>
>
>
>
>
> KIVM:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PGtpdC5ib29rbWFyaz5LSVRfOkxfMTwva2l0LmJvb2ttYXJrPjxpbnB1dEVsZW1lbnQuYm9va21hcms-SU5IRVJJVEVEX0NPTkRJVElPTjpMXzE0MzwvaW5wdXRFbGVtZW50LmJvb2ttYXJrPjwvbWVtZW50bz4=
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:320)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:305)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.adapterFor(DomainObjectContainerResolve.java:104)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve.lookup(DomainObjectContainerResolve.java:55)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.lookup(RuntimeContextFromSession.java:211)
>
> at
>
>
>
>
>
> org.apache.isis.core.metamodel.services.bookmarks.BookmarkServiceDefault.lookup(BookmarkServiceDefault.java:59)
>
> at
>
>
>
>
>
> org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacetDeclarativeAbstract.initialize(RecreatableObjectFacetDeclarativeAbstract.java:89)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorDefault.recreatePojo(PojoRecreatorDefault.java:49)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(PojoRecreatorForDataNucleus.java:34)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(PojoRecreatorUnified.java:38)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:317)
>
> ... 54 more
> Caused by: java.lang.StringIndexOutOfBoundsException: String index
>
> out
>
> of
>
> range: -1
> at java.lang.String.substring(String.java:1958)
> at
>
>
>
>
>
> org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer.toJdoObjectId(JdoObjectIdSerializer.java:112)
>
> at
>
>
>
>
>
> org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore.loadPojo(DataNucleusObjectStore.java:410)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorForDataNucleus.recreatePojo(PojoRecreatorForDataNucleus.java:36)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified.recreatePojo(PojoRecreatorUnified.java:38)
>
> at
>
>
>
>
>
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:317)
>
> ... 64 more
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
>
>
>
>
> Óscar Bou Bou
> Responsable de Producto
> Auditor Jefe de Certificación ISO 27001 en BSI
> CISA, CRISC, APMG ISO 20000, ITIL-F
>
> <contactenos.html.gif>   902 900 231 / 620 267 520
> <Pasted Graphic 1.tiff>   http://www.twitter.com/oscarbou
>
> <gesdatos-software.gif>   http://es.linkedin.com/in/oscarbou
>
> <blog.png>   http://www.GesConsultor.com <http://www.gesconsultor.com/>
>
> <gesconsultor_logo_blue_email.png>
>
>
> Este mensaje y los ficheros anexos son confidenciales. Los mismos
> contienen información reservada que no puede ser difundida. Si usted ha
> recibido este correo por error, tenga la amabilidad de eliminarlo de su
> sistema y avisar al remitente mediante reenvío a su dirección electrónica;
> no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
> Su dirección de correo electrónico junto a sus datos personales constan en
> un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de
> mantener el contacto con Ud. Si quiere saber de qué información disponemos
> de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un
> escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente
> dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo -
> 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia).
> Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos
> adjuntos no contengan virus informáticos, y en caso que los tuvieran
> eliminarlos.
>
>
>
>
>
>
>
> *Óscar Bou Bou*
> Responsable de Producto
> Auditor Jefe de Certificación ISO 27001 en BSI
> CISA, CRISC, APMG ISO 20000, ITIL-F
>
>    902 900 231 / 620 267 520
>    http://www.twitter.com/oscarbou
>
>    http://es.linkedin.com/in/oscarbou
>
>    http://www.GesConsultor.com <http://www.gesconsultor.com/>
>
>
>
> Este mensaje y los ficheros anexos son confidenciales. Los mismos
> contienen información reservada que no puede ser difundida. Si usted ha
> recibido este correo por error, tenga la amabilidad de eliminarlo de su
> sistema y avisar al remitente mediante reenvío a su dirección electrónica;
> no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
> Su dirección de correo electrónico junto a sus datos personales constan en
> un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de
> mantener el contacto con Ud. Si quiere saber de qué información disponemos
> de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un
> escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente
> dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo -
> 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia).
> Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos
> adjuntos no contengan virus informáticos, y en caso que los tuvieran
> eliminarlos.
>
>
>
>
>
>

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message