You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2012/10/31 04:14:04 UTC

quarky page injection... late allocation

Hi Folks,

I am rendering my gallery widget and everything looks great... 
I got 

firstpage prevpage link link link nextPage lastPage

which would look like

|<  <  1  2  3  >  >|

obj   obj   obj   obj
obj   obj   obj   obj
obj   obj   obj   obj

so I decide to click link 1 in order to render that page and its objects to be rendered in the gallery

In my Gallery.JAVA component I got


    @InjectPage("Home")
    private Home homePage;

and on my link handler I got

    public Object onIndividualPage(int pageNum)
    {
        logger.info("In onPage : ");

        cursor = ((pageNum-1) * itemsPerPage);
        return homePage;
    }

But when I break at the cursor statement... homePage is null

One wuold think that the injection wuold have already occurred... right ?

on subsequent attempted link clicks... subsequent breakpoints into the link handler do show that homePage is allocated data

So i am stumped...

It seems at first pass thru the InjectPage is late ?

Anyone got any ideas how I can shake this out ?
Thanks

kcolassi@live.com
 

 		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
I added this to web.xml

 <context-param>

  <param-name>tapestry.production-mode</param-name>

  <param-value>false</param-value>

 </context-param>

and has had no effect... parameter value of collectionType is still null
 		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
Thanks for trying Lance... I am trying to trace the runtime...

I did add         configuration.add(SymbolConstants.PRODUCTION_MODE, "false");

but it has had no effect

I got no clue as to why... but in my component/widget Gallery.JAVA

Gallery.JAVA
    @Parameter(required = true)
    private Class collectionType;

    @SetupRender
    public void setupRender()
    {
        try
        {
            collection = loadCollection(collectionType);
        } catch (Exception e)
        {
            logger.error("error loading data on collection gallery");
        }
    }

collectionType is a type class ... specifically Coach.class for example... which is the KIND of objects I am displaying in my gallery for test

collectionTyoe is also a parameter into my widget coming in from my 

Home.JAVA

    <t:form t:id="galleryForm" id="galleryForm" clientValidation="true" >
        <t:errors/>
        <t:Gallery t:id="galleryWidget" id="galleryWidget"
            collectionType="coachClass"
            itemsPerPage="itemsPerPage"
            tableColumns="tableColumns"
            cursor="cursor"
            />
    </t:form>

whereby coachClass is just a hack for testing

    public Class getCoachClass()
    {
        return Coach.class;
    }


but in Gallery.JAVA SetupRender collectionType parameter is showing as null in debugger. 
I would think that at this point in time it should have some value?
I am hoping I dont have to add all kinds of null checks... and seeking some graceful elegant runtime whereby 'it just works'
?


 		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
Thanks Howard... that just fixed my gallery... and 'it just works' now...   : )     fun

I made cursor and collectionType persistent using @Persist

Everything works now... all my auto paging buttons and links from beginning of resultset to end.

I never do anything unless I really need to... so persisting those parameters didnt dawn on me... but what I saw in the debugger threw me.

I figured persisting them couldnt hurt either.
Not sure what to say about what i saw in the debugger. I am wondering if that comes with the turf... or how it would work if I didn't persist those parameters.

Anyway, thanks and have a nice weekend. I will clean this up and publish for public use. Its a nice gallery.

Ken

Home.tml
    <t:form t:id="galleryForm" id="galleryForm" clientValidation="true" >
        <t:errors/>
        
        <t:Gallery t:id="galleryWidget" id="galleryWidget"
            collectionType="coachClass"
            itemsPerPage="itemsPerPage"
            tableColumns="tableColumns"
            cursor="cursor"
            />

    </t:form>
 



From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: quarky page injection... late allocation
Date: Tue, 30 Oct 2012 23:14:04 -0400





Hi Folks,

I am rendering my gallery widget and everything looks great... 
I got 

firstpage prevpage link link link nextPage lastPage

which would look like

|<  <  1  2  3  >  >|

obj   obj   obj   obj
obj   obj   obj   obj
obj   obj   obj   obj

so I decide to click link 1 in order to render that page and its objects to be rendered in the gallery

In my Gallery.JAVA component I got


    @InjectPage("Home")
    private Home homePage;

and on my link handler I got

    public Object onIndividualPage(int pageNum)
    {
        logger.info("In onPage : ");

        cursor = ((pageNum-1) * itemsPerPage);
        return homePage;
    }

But when I break at the cursor statement... homePage is null

One wuold think that the injection wuold have already occurred... right ?

on subsequent attempted link clicks... subsequent breakpoints into the link handler do show that homePage is allocated data

So i am stumped...

It seems at first pass thru the InjectPage is late ?

Anyone got any ideas how I can shake this out ?
Thanks

kcolassi@live.com
 

 		 	   		   		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
I also set this guy in the IDE jvm within eclipse under windows/preferences/java/Installed JRE's...

-Dtapestry.production-mode=false


and receiving same behavior

Here is my environment of it means anything... but thanks

Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
Maven home: C:\DEVTOOLS\apache-maven-3.0.3
Java version: 1.6.0_32, vendor: Sun Microsystems Inc.
Java home: C:\DEVTOOLS\sun\jdk1.6.0_32\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
...
 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.2 (development mode)


2012-10-31 09:04:01.120:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
 		 	   		  

Re: quarky page injection... late allocation

Posted by Lance Java <la...@googlemail.com>.
Tapestry transforms page / component classes so that at runtime, the values
are written/read from a thread local map and the fields are no longer used.

In development mode, tapestry mirrors these values to the fields to make
your life easier when debugging. I'm guessing that you are debugging a
tapestry app running in production mode. Try switching to development to
benefit from easier debugging and also live class reloading.

http://tapestry.apache.org/configuration.html#Configuration-tapestry.productionmode



--
View this message in context: http://tapestry.1045711.n5.nabble.com/quarky-page-injection-late-allocation-tp5717448p5717453.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
My pom is also set, found an execution mode variable but still no effect,
the app runs... well in the beginning it hiccups not doign exactly what I want

just trying to have my way with this debugger...... but not yet

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.26</version>
                <configuration>
                    <contextPath>/</contextPath>
                    <!-- Log to the console. -->
                    <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
                        <!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug
                             that prevents the requestLog from being set. -->
                        <append>true</append>
                    </requestLog>
                    <systemProperties>
                        <systemProperty>
                            <name>tapestry.execution-mode</name>
                            <value>DevelopmentMode</value>
                        </systemProperty>                    
                        <systemProperty>
                            <name>tapestry.compress-whitespace</name>
                            <value>false</value>
                        </systemProperty>
                        <systemProperty>
                            <name>tapestry.production-mode</name>
                            <value>false</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>

 		 	   		  

Re: quarky page injection... late allocation

Posted by Howard Lewis Ship <hl...@gmail.com>.
The fields are null because the values are often stored elsewhere;
this is part of the logic that allows a single page instance to be
actively shared across threads.

Its much more likely that your application is at fault. For example,
that "cursor" parameter may be bound to a property that is non-null
when the page renders, but is then null when the associated link is
clicked. The field that the parameter is ultimately bound to should be
persisted in the session, or on the client (using either page
activation context, or the event's context).

On Thu, Nov 1, 2012 at 9:52 PM, Ken in Nashua <kc...@live.com> wrote:
>
> Just another byproduct of things that occur and run amuck within the app at runtime
>
> An unexpected application exception has occurred.Parameter 'cursor' of component Home:gallerywidget is bound to null. This parameter is not allowed to be null.
>
>
>
> I guess I need to review all the code and see whats taking this down and start pulling it apart to try ans flush it out.
> not a fun bug... but I will be happy to find it
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
Just another byproduct of things that occur and run amuck within the app at runtime

An unexpected application exception has occurred.Parameter 'cursor' of component Home:gallerywidget is bound to null. This parameter is not allowed to be null.



I guess I need to review all the code and see whats taking this down and start pulling it apart to try ans flush it out.
not a fun bug... but I will be happy to find it

 		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
Well i have set all -Dtapestry.production-mode=true (beit true or false) in my eclipse debug configurations, pom.xml's, AppModule.JAVA and web.xml.

The only place that I set this that actually had an effect on how the webapp runs PROD MODE
Application 'app' (version 1.0-SNAPSHOT-1351774079811) startup time: 330 ms to build IoC Registry, 3,082 ms overall.

 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.2


2012-11-02 00:35:39.725:INFO::Started SelectChannelConnector@0.0.0.0:8080

or DEV MODE

Application 'app' (version 1.0-SNAPSHOT-1351774079811) startup time: 370 ms to build IoC Registry, 3,283 ms overall.

 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.2 (development mode)


2012-11-02 00:42:04.796:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server

and actually telling me what mode it is running in is 

is by setting the default VM Arguments within my eclipse preferences, java, installed jre's definition with -Dtapestry.production-mode=false

But I am seeing the same behavior... parameters (tapestry component parameters and actualy java method parameters) are intermittently null... but mysteriously appear valid when I step into the next method... but the app progressively gets worse as it runs... clicking event handlers and everything starts becoming null 

I dont believe this is a prod/dev runtime mode issue.

But would welcome any more suggestions as how to flush this out beyond beginning to take the app apart.

Thanks
Ken 

 		 	   		   		 	   		  

RE: quarky page injection... late allocation

Posted by Ken in Nashua <kc...@live.com>.
Due to hurricane and outage for past two days...

I am operating my hotspot app (virtual router) on my droid III for my internet connection.

So it's a bit slow... like alot

But is it possible there could be a race condition? I am wondering if the page injection process is contending with the link handler in separate threads... that would be a scary thought.

Well i am not sure what to make of it...

It seems my first pass thru layout and after right at when I click the link... I am seeing a null parameter which messes up initialization which is indicating something isnt right first pass thru and even after clicking the link... 

I have to relook at the way things are setup and why they are unravelled.

kcolassi@live.com
 



From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: quarky page injection... late allocation
Date: Tue, 30 Oct 2012 23:14:04 -0400





Hi Folks,

I am rendering my gallery widget and everything looks great... 
I got 

firstpage prevpage link link link nextPage lastPage

which would look like

|<  <  1  2  3  >  >|

obj   obj   obj   obj
obj   obj   obj   obj
obj   obj   obj   obj

so I decide to click link 1 in order to render that page and its objects to be rendered in the gallery

In my Gallery.JAVA component I got


    @InjectPage("Home")
    private Home homePage;

and on my link handler I got

    public Object onIndividualPage(int pageNum)
    {
        logger.info("In onPage : ");

        cursor = ((pageNum-1) * itemsPerPage);
        return homePage;
    }

But when I break at the cursor statement... homePage is null

One wuold think that the injection wuold have already occurred... right ?

on subsequent attempted link clicks... subsequent breakpoints into the link handler do show that homePage is allocated data

So i am stumped...

It seems at first pass thru the InjectPage is late ?

Anyone got any ideas how I can shake this out ?
Thanks

kcolassi@live.com