You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Hector Fabio Meza <he...@smartools.com.co> on 2016/09/12 01:15:59 UTC
Dependent drop downs with objects
Hi,
I have succesfully implemented dependent drop down boxes using String
parameters and choicesXXX, but now I'm trying to do it with an object
and I'm getting an exception.
I have a class named domainapp.dom.smartae.consultas.ConsultaAtributo
which represents an attribute of a class the user can select. I have a
dependent drop down box that shows the ConsultaAtributo's present in the
attribute selected in the first drop down.
The thing is that when I change the value in the first select, I get the
following error, which appears to happen even before my choices1XYZ is
called:
_Caused by:
org.apache.isis.core.runtime.persistence.PojoRecreationException: Could
not recreate pojo for oid oid
[domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b{atributo=basicAttributes,
clase=domainapp.dom.smartae.strategy.AEExcercise}]_
_Caused by: org.apache.isis.core.commons.exceptions.IsisException: No
such class available:
[domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo_
I checked a bit of the source and it seems that Isis is looking for the
specification of my class in a cache, but is using className/!className
as a key, which seems odd to me, since I imagine the cache uses
className as the key.
I'm including the full stack trace at the end of this mail.
Thank you.
-------------------------------------------------------------------------------------------------------------------
19:45:01,577 [RequestCycleExtra qtp1002410023-17 WARN ] Handling
the following exception
org.apache.wicket.WicketRuntimeException: Method onRequest of interface
org.apache.wicket.behavior.IBehaviorListener targeted at
org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract$ScalarUpdatingBehavior@2d117328
on component [Select2Choice [Component id = autoComplete]] threw an
exception
at
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
at
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
at
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
at
org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.doFilter(IsisLogOnExceptionFilter.java:52)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
at
org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at
org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at
org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at
org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306)
at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
... 45 more
Caused by:
org.apache.isis.core.runtime.persistence.PojoRecreationException: Could
not recreate pojo for oid oid
[domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b{atributo=basicAttributes,
clase=domainapp.dom.smartae.strategy.AEExcercise}]
at
org.apache.isis.core.runtime.system.persistence.PersistenceSession.adapterFor(PersistenceSession.java:1581)
at
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type$2.recreateAdapter(ObjectAdapterMemento.java:126)
at
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento$Type.getAdapter(ObjectAdapterMemento.java:210)
at
org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.getObjectAdapter(ObjectAdapterMemento.java:327)
at
org.apache.isis.viewer.wicket.model.models.ScalarModelWithPending$Util$1.setObject(ScalarModelWithPending.java:83)
at
org.apache.isis.viewer.wicket.model.models.ScalarModelWithPending$Util$1.setObject(ScalarModelWithPending.java:45)
at
org.apache.wicket.Component.setDefaultModelObject(Component.java:3052)
at
org.apache.wicket.markup.html.form.FormComponent.setModelObject(FormComponent.java:1577)
at
org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1098)
at
org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior.onEvent(AjaxFormComponentUpdatingBehavior.java:150)
at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:146)
at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:641)
... 50 more
Caused by: org.apache.isis.core.commons.exceptions.IsisException: No
such class available:
[domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo
at
org.apache.isis.core.metamodel.specloader.SpecificationLoader.loadSpecification(SpecificationLoader.java:289)
at
org.apache.isis.core.metamodel.specloader.SpecificationLoader.lookupBySpecId(SpecificationLoader.java:515)
at
org.apache.isis.core.runtime.system.persistence.PersistenceSession.clsOf(PersistenceSession.java:990)
at
org.apache.isis.core.runtime.system.persistence.PersistenceSession.loadPojo(PersistenceSession.java:959)
at
org.apache.isis.core.runtime.system.persistence.PersistenceSession.recreatePojo(PersistenceSession.java:1633)
at
org.apache.isis.core.runtime.system.persistence.PersistenceSession.adapterFor(PersistenceSession.java:1576)
... 61 more
19:45:01,578 [RequestCycleExtra qtp1002410023-17 WARN ]
********************************
--
Hector Fabio Meza
R&D LEAD SMARTOOLS
(57) 300 2254455 [1]
Skype: hectorf.meza
www.smartools.com.co [2]
Links:
------
[1] tel:%2857%29%20300%206815404
[2] http://www.smartools.com.co/
Re: Dependent drop downs with objects
Posted by Hector Fabio Meza <he...@smartools.com.co>.
In this case, I needed to select and then persist, so nature=VIEW_MODEL
did the trick. Thanks a lot.
El 2016-09-12 03:43, Dan Haywood escribi�:
> Hi Hector,
>
> That OID "!domainapp.dom.smartae.consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b" is for a transient entity ... the "!" prefix is what determines it [1] (in which case a GUID is used as a temporary id).
>
> So, my guess is that you either need to ensure that the entities being returned are persisted, or to instead return view models [2] (eg annotate with either @ViewModel, @DomainObject(nature=VIEW_MODEL), or @XmlElement).
>
> Let us know how you get on.
>
> Cheers
> Dan
>
> [1] https://github.com/apache/isis/blob/3dffc2d96e240982d16131d57d34fc8f54d1292c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/OidMarshaller.java#L96 [1]
> [2] http://isis.apache.org/guides/ugbtb.html#_ugbtb_view-models [2]
--
Hector Fabio Meza
R&D LEAD SMARTOOLS
(57) 300 2254455 [3]
Skype: hectorf.meza
www.smartools.com.co [4]
Links:
------
[1]
https://github.com/apache/isis/blob/3dffc2d96e240982d16131d57d34fc8f54d1292c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/OidMarshaller.java#L96
[2] http://isis.apache.org/guides/ugbtb.html#_ugbtb_view-models
[3] tel:%2857%29%20300%206815404
[4] http://www.smartools.com.co/
Re: Dependent drop downs with objects
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Hector,
That OID
"!domainapp.dom.smartae.consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b"
is for a transient entity ... the "!" prefix is what determines it [1] (in
which case a GUID is used as a temporary id).
So, my guess is that you either need to ensure that the entities being
returned are persisted, or to instead return view models [2] (eg annotate
with either @ViewModel, @DomainObject(nature=VIEW_MODEL), or @XmlElement).
Let us know how you get on.
Cheers
Dan
[1]
https://github.com/apache/isis/blob/3dffc2d96e240982d16131d57d34fc8f54d1292c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/OidMarshaller.java#L96
[2] http://isis.apache.org/guides/ugbtb.html#_ugbtb_view-models
On 12 September 2016 at 02:15, Hector Fabio Meza <
hector.meza@smartools.com.co> wrote:
> Hi,
>
> I have succesfully implemented dependent drop down boxes using String
> parameters and choicesXXX, but now I'm trying to do it with an object and
> I'm getting an exception.
>
> I have a class named domainapp.dom.smartae.consultas.ConsultaAtributo
> which represents an attribute of a class the user can select. I have a
> dependent drop down box that shows the ConsultaAtributo's present in the
> attribute selected in the first drop down.
>
> The thing is that when I change the value in the first select, I get the
> following error, which appears to happen even before my choices1XYZ is
> called:
>
> *Caused by:
> org.apache.isis.core.runtime.persistence.PojoRecreationException: Could not
> recreate pojo for oid oid
> [domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b{atributo=basicAttributes,
> clase=domainapp.dom.smartae.strategy.AEExcercise}]*
>
> *Caused by: org.apache.isis.core.commons.exceptions.IsisException: No such
> class available:
> [domainapp.dom.smartae.consultas.ConsultaAtributo/!domainapp.dom.smartae.consultas.ConsultaAtributo*
>
> I checked a bit of the source and it seems that Isis is looking for the
> specification of my class in a cache, but is using className/!className as
> a key, which seems odd to me, since I imagine the cache uses className as
> the key.
>
> I'm including the full stack trace at the end of this mail.
>
> Thank you.
>
>
>
> ------------------------------------------------------------
> -------------------------------------------------------
>
> 19:45:01,577 [RequestCycleExtra qtp1002410023-17 WARN ] Handling the
> following exception
> org.apache.wicket.WicketRuntimeException: Method onRequest of interface
> org.apache.wicket.behavior.IBehaviorListener targeted at
> org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract$
> ScalarUpdatingBehavior@2d117328 on component [Select2Choice [Component id
> = autoComplete]] threw an exception
> at org.apache.wicket.RequestListenerInterface.internalInvoke(
> RequestListenerInterface.java:268)
> at org.apache.wicket.RequestListenerInterface.invoke(
> RequestListenerInterface.java:241)
> at org.apache.wicket.core.request.handler.
> ListenerInterfaceRequestHandler.invokeListener(
> ListenerInterfaceRequestHandler.java:250)
> at org.apache.wicket.core.request.handler.
> ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandle
> r.java:236)
> at org.apache.wicket.request.cycle.RequestCycle$
> HandlerExecutor.respond(RequestCycle.java:890)
> at org.apache.wicket.request.RequestHandlerStack.execute(
> RequestHandlerStack.java:64)
> at org.apache.wicket.request.cycle.RequestCycle.execute(
> RequestCycle.java:261)
> at org.apache.wicket.request.cycle.RequestCycle.
> processRequest(RequestCycle.java:218)
> at org.apache.wicket.request.cycle.RequestCycle.
> processRequestAndDetach(RequestCycle.java:289)
> at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(
> WicketFilter.java:259)
> at org.apache.wicket.protocol.http.WicketFilter.
> processRequest(WicketFilter.java:201)
> at org.apache.wicket.protocol.http.WicketFilter.doFilter(
> WicketFilter.java:282)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.
> doFilter(ServletHandler.java:1668)
> at org.apache.isis.core.webapp.diagnostics.IsisLogOnExceptionFilter.
> doFilter(IsisLogOnExceptionFilter.java:52)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.
> doFilter(ServletHandler.java:1668)
> at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(
> AbstractShiroFilter.java:449)
> at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(
> AbstractShiroFilter.java:365)
> at org.apache.shiro.subject.support.SubjectCallable.
> doCall(SubjectCallable.java:90)
> at org.apache.shiro.subject.support.SubjectCallable.call(
> SubjectCallable.java:83)
> at org.apache.shiro.subject.support.DelegatingSubject.
> execute(DelegatingSubject.java:383)
> at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(
> AbstractShiroFilter.java:362)
> at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(
> OncePerRequestFilter.java:125)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.
> doFilter(ServletHandler.java:1668)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(
> ServletHandler.java:581)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(
> ScopedHandler.java:143)
> at org.eclipse.jetty.security.SecurityHandler.handle(
> SecurityHandler.java:548)
> at org.eclipse.jetty.server.session.SessionHandler.
> doHandle(SessionHandler.java:226)
> at org.eclipse.jetty.server.handler.ContextHandler.
> doHandle(ContextHandler.java:1158)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(
> ServletHandler.java:511)
> at org.eclipse.jetty.server.session.SessionHandler.
> doScope(SessionHandler.java:185)
> at org.eclipse.jetty.server.handler.ContextHandler.
> doScope(ContextHandler.java:1090)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(
> ScopedHandler.java:141)
> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
> ContextHandlerCollection.java:213)
> at org.eclipse.jetty.server.handler.HandlerCollection.
> handle(HandlerCollection.java:109)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
> HandlerWrapper.java:119)
> at org.eclipse.jetty.server.Server.handle(Server.java:517)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306)
> at org.eclipse.jetty.server.HttpConnection.onFillable(
> HttpConnection.java:242)
> at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(
> AbstractConnection.java:261)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
> at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(
> SelectChannelEndPoint.java:75)
> at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.
> produceAndRun(ExecuteProduceConsume.java:213)
> at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(
> ExecuteProduceConsume.java:147)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
> QueuedThreadPool.java:654)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(
> QueuedThreadPool.java:572)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.wicket.RequestListenerInterface.internalInvoke(
> RequestListenerInterface.java:258)
> ... 45 more
> Caused by: org.apache.isis.core.runtime.persistence.PojoRecreationException:
> Could not recreate pojo for oid oid [domainapp.dom.smartae.
> consultas.ConsultaAtributo/!domainapp.dom.smartae.
> consultas.ConsultaAtributo:11f35f3b-1255-4105-ab36-3a40febe637b{atributo=basicAttributes,
> clase=domainapp.dom.smartae.strategy.AEExcercise}]
> at org.apache.isis.core.runtime.system.persistence.
> PersistenceSession.adapterFor(PersistenceSession.java:1581)
> at org.apache.isis.viewer.wicket.model.mementos.
> ObjectAdapterMemento$Type$2.recreateAdapter(ObjectAdapterMemento.java:126)
> at org.apache.isis.viewer.wicket.model.mementos.
> ObjectAdapterMemento$Type.getAdapter(ObjectAdapterMemento.java:210)
> at org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento.
> getObjectAdapter(ObjectAdapterMemento.java:327)
> at org.apache.isis.viewer.wicket.model.models.
> ScalarModelWithPending$Util$1.setObject(ScalarModelWithPending.java:83)
> at org.apache.isis.viewer.wicket.model.models.
> ScalarModelWithPending$Util$1.setObject(ScalarModelWithPending.java:45)
> at org.apache.wicket.Component.setDefaultModelObject(
> Component.java:3052)
> at org.apache.wicket.markup.html.form.FormComponent.
> setModelObject(FormComponent.java:1577)
> at org.apache.wicket.markup.html.form.FormComponent.
> updateModel(FormComponent.java:1098)
> at org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehav
> ior.onEvent(AjaxFormComponentUpdatingBehavior.java:150)
> at org.apache.wicket.ajax.AjaxEventBehavior.respond(
> AjaxEventBehavior.java:146)
> at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(
> AbstractDefaultAjaxBehavior.java:641)
> ... 50 more
> Caused by: org.apache.isis.core.commons.exceptions.IsisException: No such
> class available: [domainapp.dom.smartae.consultas.ConsultaAtributo/!
> domainapp.dom.smartae.consultas.ConsultaAtributo
> at org.apache.isis.core.metamodel.specloader.SpecificationLoader.
> loadSpecification(SpecificationLoader.java:289)
> at org.apache.isis.core.metamodel.specloader.SpecificationLoader.
> lookupBySpecId(SpecificationLoader.java:515)
> at org.apache.isis.core.runtime.system.persistence.
> PersistenceSession.clsOf(PersistenceSession.java:990)
> at org.apache.isis.core.runtime.system.persistence.
> PersistenceSession.loadPojo(PersistenceSession.java:959)
> at org.apache.isis.core.runtime.system.persistence.PersistenceSession.
> recreatePojo(PersistenceSession.java:1633)
> at org.apache.isis.core.runtime.system.persistence.
> PersistenceSession.adapterFor(PersistenceSession.java:1576)
> ... 61 more
> 19:45:01,578 [RequestCycleExtra qtp1002410023-17 WARN ]
> ********************************
>
>
> --
>
> *Hector Fabio Meza*
> *R&D Lead smartools*
> (57) 300 2254455 <%2857%29%20300%206815404>
> Skype: hectorf.meza
> www.smartools.com.co
>
>