You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Doug Lochart <dl...@gmail.com> on 2005/10/27 17:26:04 UTC

Why is this happening ??? recorder locked

Since I have not heard anything I assume its a trivial issue ... maybe
it is but its NOT a double click issue which the archives are full of.
This exception happens when the page is being activated for the FIRST
time.  PLEASE read this kindly offer me some direction.  As always we
are under
the gun.  -- thanks

All,

I have looked through all of the archives and most issues related to
this exception
revolve around a Form Submission or a double click. My issue is different
and I am perplexed.  The Exception happens during the initial rendering phase

I have a page that has a List passed to it from another page before being
activated.  The page being activated is very simple. It has a ListEdit
component to
iterate over a collection.  I turned on tapestry debugging to see if I
could get any more info but i did
not. The exception is happening during the initial rendering of the page.
I don't even get to see the page before the exception occurs.

I load my ListEditMap in the pageBeginRender() method as in the
publisher example

public void pageBeginRender(final PageEvent event)
{
  if ( getFeeScheduleListMap() == null ) {
    ListEditMap map = new ListEditMap();
    Iterator ii = getFeeScheduleList().iterator();
    while ( ii.hasNext()) {
      FeeSchedule fee = (FeeSchedule)ii.next();
      map.add( new Long( fee.getFeeScheduleID() ), fee );
    }
  }
    setFeeScheduleListMap( map );
}

My synchronize method looks like this:

public void synchronizeFeeSchedules(IRequestCycle cycle) {
  ListEditMap map = getFeeScheduleListMap();
  FeeSchedule feeSchedule = (FeeSchedule) map.getValue();

  if (feeSchedule == null) {
    _logger.debug("fee schedule is null");
    IValidationDelegate delegate =
    (IValidationDelegate)getBeans().getBean("delegate");
    delegate.record("Out Of Date Request.",null);
    throw new PageRedirectException(this);
  }
  setFeeSchedule( feeSchedule );
}

Can someone please shed some light on what is happening? I am really not too
sure on the whole page recorder side of things.

Thanks

Doug



--
What profits a man if he gains the whole world yet loses his soul?

Re: Why is this happening ??? recorder locked

Posted by Oleg Batrashev <og...@gmail.com>.
> I guess I am still unclear as to the lifecycle of a persistent vs non
> persistent property. Could you help me understand
> the lifecycle of a NON Persistent property? Assume the page has a form.

I would say that its lifecycle is request, ie at the end of each HTTP
request page is inserted back to page pool and all properties are
cleared to their default values (usualy null). So, at the beginning of
another request (possibly from another user), page is taken from the
pool with all non-persistent properties cleared.

Non persistent properties HELP you to rewind and render your page, ie
you may initialize them with values from database at start of request
or inside request, then use them in bindings to other components'
parameters.

Eg your "feeSchedule" gets new value upon every start of ListEdit
iteration and you may use it inside ListEdit. You MAY also use it
outside ListEdit, but in such cases it usualy has meaningless value -
either null or last value of the ListEdit iteration.

Persistent properties behave almost the same way, except they are
initialized at the beginning of request from HTTP session and stored
back at the end. To be precise, they are stored back NOT at the end of
request, but at the end of 'active' phase of request. That is when you
have done all changes to database, business or session state and ready
to generate and send answer to the client (render your page). Tapestry
prohibits you to change any persistent (ie HTTP session) state inside
that render phase, because its meant to generate and send answer back
to client, not to do any actions that affect application state. (I
suppose its tapestry feature to avoid bugs).

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Why is this happening ??? recorder locked

Posted by Doug Lochart <dl...@gmail.com>.
No there is no reason ... it was a cut-n-paste situation and I did not
realize that it would have that effect. Now I see.
I guess I am still unclear as to the lifecycle of a persistent vs non
persistent property. Could you help me understand
the lifecycle of a NON Persistent property? Assume the page has a form.

thanks

doug

On 10/27/05, Oleg Batrashev <og...@gmail.com> wrote:
>
> Hi,
>
> Your problem is that property "feeSchedule" must NOT be persistent.
> "feeSchedule" is like iteration variable inside ListEdit component. So
> its being updated from your "synchronizeFeeSchedules" method on every
> iteration of ListEdit during render phase. But no persistent property
> may be updated after pageBeginRender of render phase.
>
> Generally, you do not need to do every variable persistent, only a few
> ones. What you did is made variable 'i' (ie feeSchedule in your case)
> in 'for(int i=0; ... )' persistent. Is there any reason for this?
>
> Oleg
>
> On 10/27/05, Doug Lochart <dl...@gmail.com> wrote:
> > Ron ... thanks for helping.
> >
> > I am using Tapestry 3.0.3 --- we have no time to take the tapestry 4
> plunge
> > I thought I was doing lazy initialization in pageBeginRender() if this
> is
> > not what you mean please explain what/where you
> > you are talking about. All properties being used are persistent.
> >
> > As I stated in the email this is the first time the page is being loaded
> and
> > I never get to see it. all I see is the stacktrace
> > Also, I am not using the Detach event could you explain that as well.
> >
> > <property-specification name="feeSchedule" type="
> > com.capecomputing.mensana.domain.FeeSchedule" persistent="yes"/>
>
> > <component id="feeScheduleListEditMap" type="ListEdit">
> > <binding name="source" expression="feeScheduleListMap.keys"/>
> > <binding name="value" expression="feeScheduleListMap.key"/>
> > <binding name="listener" expression="listeners.synchronizeFeeSchedules
> "/>
> > <static-binding name="element" value="tr"/>
> > </component>
> >
> > <component id="inputFeeAmount" type="MoneyFieldComponent">
> > <binding name="moneyField" expression="feeSchedule.amountAsString"/>
> > </component>
> >
> > </page-specification>
> >
> >
> > Here is the stack trace:
> >
> > Page recorder for page ModifyFeeSchedules is locked after a commit(),
> but
> > received a change to property feeSchedule of component
> > ModifyFeeSchedules. Stack
> > Trace:
> >
> > - org.apache.tapestry.record.PageRecorder.observeChange(
> > PageRecorder.java:119)
> > - org.apache.tapestry.Tapestry.fireObservedChange(Tapestry.java:1339)
> > - org.apache.tapestry.AbstractComponent.fireObservedChange(
> > AbstractComponent.java:304)
> > -
> >
> com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules$Enhance_24.setFeeSchedule
> (ModifyFeeSchedules$Enhance_24.java)
> >
> > -
> >
> com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules.synchronizeFeeSchedules
> > (ModifyFeeSchedules.java:174)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
What profits a man if he gains the whole world yet loses his soul?

Re: Why is this happening ??? recorder locked

Posted by Oleg Batrashev <og...@gmail.com>.
Hi,

Your problem is that property "feeSchedule" must NOT be persistent.
"feeSchedule" is like iteration variable inside ListEdit component. So
its being updated from your "synchronizeFeeSchedules" method on every
iteration of ListEdit during render phase. But no persistent property
may be updated after pageBeginRender of render phase.

Generally, you do not need to do every variable persistent, only a few
ones. What you did is made variable 'i' (ie feeSchedule in your case)
in 'for(int i=0; ... )' persistent. Is there any reason for this?

Oleg

On 10/27/05, Doug Lochart <dl...@gmail.com> wrote:
> Ron ... thanks for helping.
>
> I am using Tapestry 3.0.3 --- we have no time to take the tapestry 4 plunge
> I thought I was doing lazy initialization in pageBeginRender() if this is
> not what you mean please explain what/where you
> you are talking about. All properties being used are persistent.
>
> As I stated in the email this is the first time the page is being loaded and
> I never get to see it. all I see is the stacktrace
> Also, I am not using the Detach event could you explain that as well.
>
> <property-specification name="feeSchedule" type="
> com.capecomputing.mensana.domain.FeeSchedule" persistent="yes"/>

> <component id="feeScheduleListEditMap" type="ListEdit">
> <binding name="source" expression="feeScheduleListMap.keys"/>
> <binding name="value" expression="feeScheduleListMap.key"/>
> <binding name="listener" expression="listeners.synchronizeFeeSchedules"/>
> <static-binding name="element" value="tr"/>
> </component>
>
> <component id="inputFeeAmount" type="MoneyFieldComponent">
> <binding name="moneyField" expression="feeSchedule.amountAsString"/>
> </component>
>
> </page-specification>
>
>
> Here is the stack trace:
>
>  Page recorder for page ModifyFeeSchedules is locked after a commit(), but
> received a change to property feeSchedule of component
> ModifyFeeSchedules.  Stack
> Trace:
>
>    - org.apache.tapestry.record.PageRecorder.observeChange(
>    PageRecorder.java:119)
>    - org.apache.tapestry.Tapestry.fireObservedChange(Tapestry.java:1339)
>    - org.apache.tapestry.AbstractComponent.fireObservedChange(
>    AbstractComponent.java:304)
>    -
>    com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules$Enhance_24.setFeeSchedule(ModifyFeeSchedules$Enhance_24.java)
>
>    -
>    com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules.synchronizeFeeSchedules
>    (ModifyFeeSchedules.java:174)

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Why is this happening ??? recorder locked

Posted by Doug Lochart <dl...@gmail.com>.
Ron ... thanks for helping.

I am using Tapestry 3.0.3 --- we have no time to take the tapestry 4 plunge
I thought I was doing lazy initialization in pageBeginRender() if this is
not what you mean please explain what/where you
you are talking about. All properties being used are persistent.

As I stated in the email this is the first time the page is being loaded and
I never get to see it. all I see is the stacktrace
Also, I am not using the Detach event could you explain that as well.

Here is the page file:

<?xml version="1.0"?>

<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification class="
com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules">

<property-specification name="testGroupList" type="java.util.List"
persistent="yes"/>
<property-specification name="feeScheduleList" type="java.util.List"
persistent="yes"/>
<property-specification name="feeSchedule" type="
com.capecomputing.mensana.domain.FeeSchedule" persistent="yes"/>
<property-specification name="client" type="
com.capecomputing.mensana.domain.Client" persistent="yes"/>
<property-specification name="feeScheduleListMap" type="
org.apache.tapestry.form.ListEditMap" persistent="yes"/>
<property-specification name="action" type="java.lang.String"
persistent="yes"/>

<bean name="delegate" class="
com.capecomputing.mensana.webportal.application.ClaimantSetupDelegate"
lifecycle="request"/>

<!-- Validators -->


<bean name="required" class="org.apache.tapestry.valid.StringValidator"
lifecycle="page">
<set-property name="required" expression="true"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>

<!-- end Validator-->

<component id="feeScheduleListEditMap" type="ListEdit">
<binding name="source" expression="feeScheduleListMap.keys"/>
<binding name="value" expression="feeScheduleListMap.key"/>
<binding name="listener" expression="listeners.synchronizeFeeSchedules"/>
<static-binding name="element" value="tr"/>
</component>

<component id="inputFeeAmount" type="MoneyFieldComponent">
<binding name="moneyField" expression="feeSchedule.amountAsString"/>
</component>

</page-specification>


Here is the stack trace:

 Page recorder for page ModifyFeeSchedules is locked after a commit(), but
received a change to property feeSchedule of component
ModifyFeeSchedules.  Stack
Trace:

   - org.apache.tapestry.record.PageRecorder.observeChange(
   PageRecorder.java:119)
   - org.apache.tapestry.Tapestry.fireObservedChange(Tapestry.java:1339)
   - org.apache.tapestry.AbstractComponent.fireObservedChange(
   AbstractComponent.java:304)
   -
   com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules$Enhance_24.setFeeSchedule(ModifyFeeSchedules$Enhance_24.java)

   -
   com.capecomputing.mensana.webportal.pages.ModifyFeeSchedules.synchronizeFeeSchedules
   (ModifyFeeSchedules.java:174)
   - sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   - sun.reflect.NativeMethodAccessorImpl.invoke(
   NativeMethodAccessorImpl.java:39)
   - sun.reflect.DelegatingMethodAccessorImpl.invoke(
   DelegatingMethodAccessorImpl.java:25)
   - java.lang.reflect.Method.invoke(Method.java:324)
   - org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(
   ListenerMap.java:257)
   - org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)

   - org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(
   ListenerMap.java:97)
   -
   org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered
   (ListenerMap.java:102)
   - org.apache.tapestry.form.ListEdit.renderComponent(ListEdit.java:106)

   - org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)

   - org.apache.tapestry.AbstractComponent.renderBody(
   AbstractComponent.java:624)
   -
   com.capecomputing.mensana.webportal.components.SingleSubmitForm.renderComponent
   (SingleSubmitForm.java:363)
   - org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)

   - org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)

   - org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)

   - org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:300)
   - org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:368)

   - org.apache.tapestry.engine.AbstractEngine.renderResponse(
   AbstractEngine.java:749)
   - org.apache.tapestry.engine.DirectService.service(DirectService.java:174)

   - org.apache.tapestry.engine.AbstractEngine.service(
   AbstractEngine.java:889)
   - org.apache.tapestry.ApplicationServlet.doService(
   ApplicationServlet.java:198)
   -
   com.capecomputing.mensana.webportal.application.MensanaApplicationServlet.doService
   (MensanaApplicationServlet.java:107)
   - org.apache.tapestry.ApplicationServlet.doPost(
   ApplicationServlet.java:327)
   - javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   - javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
   ApplicationFilterChain.java:237)
   - org.apache.catalina.core.ApplicationFilterChain.doFilter(
   ApplicationFilterChain.java:157)
   - org.apache.catalina.core.StandardWrapperValve.invoke(
   StandardWrapperValve.java:214)
   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:104)
   - org.apache.catalina.core.StandardPipeline.invoke(
   StandardPipeline.java:520)
   - org.apache.catalina.core.StandardContextValve.invokeInternal(
   StandardContextValve.java:198)
   - org.apache.catalina.core.StandardContextValve.invoke(
   StandardContextValve.java:152)
   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:104)
   - org.apache.catalina.core.StandardPipeline.invoke(
   StandardPipeline.java:520)
   - org.apache.catalina.core.StandardHostValve.invoke(
   StandardHostValve.java:137)
   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:104)
   - org.apache.catalina.valves.ErrorReportValve.invoke(
   ErrorReportValve.java:118)
   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:102)
   - org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)

   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:102)
   - org.apache.catalina.core.StandardPipeline.invoke(
   StandardPipeline.java:520)
   - org.apache.catalina.core.StandardEngineValve.invoke(
   StandardEngineValve.java:109)
   - org.apache.catalina.core.StandardValveContext.invokeNext(
   StandardValveContext.java:104)
   - org.apache.catalina.core.StandardPipeline.invoke(
   StandardPipeline.java:520)
   - org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

   - org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

   - org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)

   - org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
   - org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
   - org.apache.jk.common.ChannelSocket.processConnection(
   ChannelSocket.java:675)
   - org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
   - org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
   ThreadPool.java:683)
   - java.lang.Thread.run(Thread.java:534)



Thanks again




On 10/27/05, Ron Piterman <rp...@gmx.net> wrote:
>
> Are you using tapestry 3 or 4 ?
>
> try changin the initialization to a lazy one:
>
> private Map x;
> public Map getX() {
> if (x == null)
> x = createX();
> return x;
> }
>
> you have to set x to null on the detach event.
>
> plus: please sent the page and exception stack trace
>
> Cheers,
> Ron
>
>
>
> ציטוט Doug Lochart:
> > Since I have not heard anything I assume its a trivial issue ... maybe
> > it is but its NOT a double click issue which the archives are full of.
> > This exception happens when the page is being activated for the FIRST
> > time. PLEASE read this kindly offer me some direction. As always we
> > are under
> > the gun. -- thanks
> >
> > All,
> >
> > I have looked through all of the archives and most issues related to
> > this exception
> > revolve around a Form Submission or a double click. My issue is
> different
> > and I am perplexed. The Exception happens during the initial rendering
> phase
> >
> > I have a page that has a List passed to it from another page before
> being
> > activated. The page being activated is very simple. It has a ListEdit
> > component to
> > iterate over a collection. I turned on tapestry debugging to see if I
> > could get any more info but i did
> > not. The exception is happening during the initial rendering of the
> page.
> > I don't even get to see the page before the exception occurs.
> >
> > I load my ListEditMap in the pageBeginRender() method as in the
> > publisher example
> >
> > public void pageBeginRender(final PageEvent event)
> > {
> > if ( getFeeScheduleListMap() == null ) {
> > ListEditMap map = new ListEditMap();
> > Iterator ii = getFeeScheduleList().iterator();
> > while ( ii.hasNext()) {
> > FeeSchedule fee = (FeeSchedule)ii.next();
> > map.add( new Long( fee.getFeeScheduleID() ), fee );
> > }
> > }
> > setFeeScheduleListMap( map );
> > }
> >
> > My synchronize method looks like this:
> >
> > public void synchronizeFeeSchedules(IRequestCycle cycle) {
> > ListEditMap map = getFeeScheduleListMap();
> > FeeSchedule feeSchedule = (FeeSchedule) map.getValue();
> >
> > if (feeSchedule == null) {
> > _logger.debug("fee schedule is null");
> > IValidationDelegate delegate =
> > (IValidationDelegate)getBeans().getBean("delegate");
> > delegate.record("Out Of Date Request.",null);
> > throw new PageRedirectException(this);
> > }
> > setFeeSchedule( feeSchedule );
> > }
> >
> > Can someone please shed some light on what is happening? I am really not
> too
> > sure on the whole page recorder side of things.
> >
> > Thanks
> >
> > Doug
> >
> >
> >
> > --
> > What profits a man if he gains the whole world yet loses his soul?
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
What profits a man if he gains the whole world yet loses his soul?

Re: Why is this happening ??? recorder locked

Posted by Ron Piterman <rp...@gmx.net>.
Are you using tapestry 3 or 4 ?

try changin the initialization to a lazy one:

private Map x;
public Map getX() {
   if (x == null)
     x = createX();
   return x;
}

you have to set x to null on the detach event.

plus: please sent the page and exception stack trace

Cheers,
Ron



ציטוט Doug Lochart:
> Since I have not heard anything I assume its a trivial issue ... maybe
> it is but its NOT a double click issue which the archives are full of.
> This exception happens when the page is being activated for the FIRST
> time.  PLEASE read this kindly offer me some direction.  As always we
> are under
> the gun.  -- thanks
> 
> All,
> 
> I have looked through all of the archives and most issues related to
> this exception
> revolve around a Form Submission or a double click. My issue is different
> and I am perplexed.  The Exception happens during the initial rendering phase
> 
> I have a page that has a List passed to it from another page before being
> activated.  The page being activated is very simple. It has a ListEdit
> component to
> iterate over a collection.  I turned on tapestry debugging to see if I
> could get any more info but i did
> not. The exception is happening during the initial rendering of the page.
> I don't even get to see the page before the exception occurs.
> 
> I load my ListEditMap in the pageBeginRender() method as in the
> publisher example
> 
> public void pageBeginRender(final PageEvent event)
> {
>   if ( getFeeScheduleListMap() == null ) {
>     ListEditMap map = new ListEditMap();
>     Iterator ii = getFeeScheduleList().iterator();
>     while ( ii.hasNext()) {
>       FeeSchedule fee = (FeeSchedule)ii.next();
>       map.add( new Long( fee.getFeeScheduleID() ), fee );
>     }
>   }
>     setFeeScheduleListMap( map );
> }
> 
> My synchronize method looks like this:
> 
> public void synchronizeFeeSchedules(IRequestCycle cycle) {
>   ListEditMap map = getFeeScheduleListMap();
>   FeeSchedule feeSchedule = (FeeSchedule) map.getValue();
> 
>   if (feeSchedule == null) {
>     _logger.debug("fee schedule is null");
>     IValidationDelegate delegate =
>     (IValidationDelegate)getBeans().getBean("delegate");
>     delegate.record("Out Of Date Request.",null);
>     throw new PageRedirectException(this);
>   }
>   setFeeSchedule( feeSchedule );
> }
> 
> Can someone please shed some light on what is happening? I am really not too
> sure on the whole page recorder side of things.
> 
> Thanks
> 
> Doug
> 
> 
> 
> --
> What profits a man if he gains the whole world yet loses his soul?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org