Re: strange NPE, really making me nervous
On Fri, 12 Oct 2012 01:01:36 -0300, Ken in Nashua kcola...@live.com wrote: Here is Home.JAVA snippet public class Home { /** * Component */ @Property private Class collectiontype; @Property private Integer itemsPerPage = new Integer(50); Don't initialize fields in their declarations. Use some event handler method instead. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: strange NPE, really making me nervous
i commented out the whole contents of the handler... and it ran ok... so it has to do with the variable itemsPerPage hoping it will thresh out tomorrow... or today have to get some sleep... ciao
Re: strange NPE, really making me nervous
On Fri, Oct 12, 2012 at 6:29 AM, Robert Zeigler robert.zeig...@roxanemy.com wrote: Since itemsPerPage is a property of a page, the @Parameter bit won't work. That is not true. @Property just adds get and setter, and @Parameter can be a property. Tapestry standard components often have parameters that are also properties. Best regards, Cezary
Re: strange NPE, really making me nervous
Hi, Have you really confirmed that collection is not null? E.g. by actually debugging that code or putting a logging statement? I strongly believe it is null, because you set it only on SetupRender event, and rendering events when page is not rendered. Cezary
Re: strange NPE, really making me nervous
On Oct 12, 2012, at 10/126:33 AM , Cezary Biernacki wrote: On Fri, Oct 12, 2012 at 6:29 AM, Robert Zeigler robert.zeig...@roxanemy.com wrote: Since itemsPerPage is a property of a page, the @Parameter bit won't work. That is not true. @Property just adds get and setter, and @Parameter can be a property. Tapestry standard components often have parameters that are also properties. It is true. The relevant noun in my original statement is page, not property. @Parameter is for components, not pages. @Parameter makes no sense for pages. Cheers, Robert - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: strange NPE, really making me nervous
Ah, OK. Missed that. However by judging source code from other emails, it is clear that @Parameter for itemsPerPage was used in 'Galery' component, not on Home.java. But I guess it is to be confused by incomplete examples. Best regards, Cezary On Fri, Oct 12, 2012 at 2:42 PM, Robert Zeigler robert.zeig...@roxanemy.com wrote: On Oct 12, 2012, at 10/126:33 AM , Cezary Biernacki wrote: On Fri, Oct 12, 2012 at 6:29 AM, Robert Zeigler robert.zeig...@roxanemy.com wrote: Since itemsPerPage is a property of a page, the @Parameter bit won't work. That is not true. @Property just adds get and setter, and @Parameter can be a property. Tapestry standard components often have parameters that are also properties. It is true. The relevant noun in my original statement is page, not property. @Parameter is for components, not pages. @Parameter makes no sense for pages. Cheers, Robert - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: strange NPE, really making me nervous
Thanks Cezary, collection is an allocated collection housing a single hibernate entity. my login page comes up i get authenticated it launches the Home.ml and Layout.tml and my Gallery.tml gets rendered for the very first time I can see the hibernate entity on the screen... the photo is rendered as a single element in the Gallery. Then I begin to operate the auto-paging buttons and thats when the fun starts. So trust me... i have stepped thru the code and looking at a hibernate entity inside my collection. This has something to do with that variable itemsPerPage and the event being triggered when it is accessed maybe some multi-threaded thing with events? Not sure... I would like to get my arms around it today. Thats why i felt scared about this one... i modeled everything seems ok... but its happening. Thanks
RE: strange NPE, really making me nervous
NB. When you fire an event on a component, the component rendering lifecycle is NOT fired. Anything configured in setupRender() and beginRender() etc will be null (unless using @Persist). Only your @Parameter values will be populated. You may need to have a common method that you call in setupRender() and your component event(s). -- View this message in context: http://tapestry.1045711.n5.nabble.com/strange-NPE-really-making-me-nervous-tp5716818p5716849.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: strange NPE, really making me nervous
On Fri, Oct 12, 2012 at 4:01 PM, Ken in Nashua kcola...@live.com wrote: Thanks Cezary, collection is an allocated collection housing a single hibernate entity. my login page comes up i get authenticated it launches the Home.ml and Layout.tml and my Gallery.tml gets rendered for the very first time I can see the hibernate entity on the screen... the photo is rendered as a single element in the Gallery. It does not matter. You are confusing things. The fact that collections is not null at some moment, does not prove that is not null at another. I really suspect it is null during onLastPage event. Only rendering runs setupRender() which is only way tp set any value to collections field, but your exception happens during event handling. Cezary
Re: strange NPE, really making me nervous
It does not matter that you it is loaded in setupRender(). Rending events happen only during page rendering. Your exception happens during a separate HTTP request for event handling (see request URL in your logs). Such events do not trigger page rendering in Tapestry 5. So setupRender() is not executed in this case. And because collections is not '@Persisted' on each request is initialised to default value, which is null. Probably you would move code from setupRender() to onActivate(), so it will be executed for every request concerning this page. Cezary On Fri, Oct 12, 2012 at 4:48 PM, Ken in Nashua kcola...@live.com wrote: Guys, I appreciate the help... is it possible collection is getting clobbered in between somewhere the event ? I mean I walked thru debugger and logged a statement too and saw with my eyes that collection is loaded and allocated and established in @SetupRender public void setupRender() { itemsPerPage = new Integer(50); try { collection = loadCollection(collectionType); } catch (Exception e) { logger.error(error loading data on collection gallery); } } so the initialization of my collection variable seems to be happening fine and i actually see the entity rendered within the gallery... it runs and comes up and is displayed. I didnt think that persisting this variable was needed beyond it being operated as a property on Home.tml (the page) and a parameter in Gallery.tml (the component)... so i think i modeled it properly. I would hate to think Integer is the issue... but changing that doesnt seem to shake anything out. But I am starting to think that integer is getting clobbered somewhere in the @Property space and tripping up the @Property eFrastructure maybe I need the @Persist ? I will give it a shot but I am just looking for some reason here for this... maybe I need to stop using Integer ? I have downloadSources=true in my maven but unable to step thru all of the core code Thanks if you have any ideas on how to shake this out
RE: strange NPE, really making me nervous
Well i got rid of Integer usage with this variable itemsPerPage within the page and component as well as any initializations and modeled initialization in the setuprender Gallery.JAVA @SetupRender public void setupRender() { itemsPerPage = 50; try { collection = loadCollection(collectionType); } catch (Exception e) { logger.error(error loading data on collection gallery); } } and the NPE still occurs I added @Persist to the page Home.JAVA @Persist @Property private int itemsPerPage; and the NPE still occurs any event centric referencing of this variable induces an NPE ? Any help is appreciated. :(
RE: strange NPE, really making me nervous
if it means anything here is the last stack trace... but it looks the same 127.0.0.1 - - [12/Oct/2012:15:17:56 +] GET /tynamo/blob/adminlayout/1/header HTTP/1.1 200 223753 http://localhost:8080/Home; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 [INFO] components.Gallery In onLastPage : [ERROR] ioc.Registry org.apache.tapestry5.runtime.ComponentEventException [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'lastpage' on Home:gallerywidget [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry5.ioc.internal.OperationException org.apache.tapestry5.ioc.internal.OperationException [at classpath:org/tynamo/examples/hibernatesecurity/pages/Home.tml, line 36] at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1121) at org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1047) at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:81) at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42) at $ComponentEventRequestHandler_9f4c46947b24.handle(Unknown Source) at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) at $ComponentEventRequestHandler_9f4c46947b24.handle(Unknown Source) at org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) at $ComponentEventRequestHandler_9f4c46947b24.handle(Unknown Source) at org.apache.tapestry5.services.TapestryModule$40.handle(TapestryModule.java:2456) at $ComponentEventRequestHandler_9f4c46947b24.handle(Unknown Source) at $ComponentEventRequestHandler_9f4c46947a77.handle(Unknown Source) at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) at $ComponentRequestHandler_9f4c46947a79.handleComponentEvent(Unknown Source) at org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:42) at $ComponentRequestFilter_9f4c46947a76.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_9f4c46947a79.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_9f4c46947a5f.handleComponentEvent(Unknown Source) at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46) at $Dispatcher_9f4c46947a63.dispatch(Unknown Source) at $Dispatcher_9f4c46947a5c.dispatch(Unknown Source) at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302) at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) at $RequestHandler_9f4c46947a5d.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902) at $RequestHandler_9f4c46947a5d.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892) at $RequestHandler_9f4c46947a5d.service(Unknown Source) at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) at $RequestHandler_9f4c46947a5d.service(Unknown Source) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119) at $RequestHandler_9f4c46947a5d.service(Unknown Source) at $RequestHandler_9f4c46947a24.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253) at org.tynamo.security.services.impl.SecurityConfiguration$2.call(SecurityConfiguration.java:106) at org.tynamo.security.services.impl.SecurityConfiguration$2.call(SecurityConfiguration.java:104) at
RE: strange NPE, really making me nervous
As Cezary said, there are two requests involved in this exception. 1. Request to draw the page initially 2. Request to fire the lastPage event Tapestry does NOT maintain state between Request 1 and Request 2 (unless you explicitly tell it to via @Persist). In this case, you should not use @Persist. You will need to setup your render variables for both requests. -- View this message in context: http://tapestry.1045711.n5.nabble.com/strange-NPE-really-making-me-nervous-tp5716818p5716861.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: strange NPE, really making me nervous
Are you saying... that... I maintain a collection on a single initial rendering... I get away with it by loading my collection in setuprender... this works fine and I can see my hibernate entity on my display after the gallery is rendered. On a subsequent event (lastPage)... your claim is that any reference to my collection variable will produce an NPE. I stepped thru the debugger and collection looks legit... probably because it hasnt been garbage collected yet. So what did I do? I instrumented the firstPage event handler (which seems to work) and I put the reference collection.size() in it ... and boom... that looks legit in debugger but the NPE happens anyway. So the collection is null theory I will buy on the basis that it hasnt been garbage collected yet. SOLUTION ? @Persist Gallery.JAVA @Persist @Property private Collection collection; Ok I ran this thru debugger and its fine. I am a happy tap'r... thanks guys didnt think i would get flanked by the garbage collector - cheers Ken
RE: strange NPE, really making me nervous
hm...I am not sure what you are looking at with the debug, but the pointer to the collection should be null regardless of the objects actual state (whether or not it has been garbage collected). It is as everyone has described to you, once page is rendered everything is set to null and when you hit the event it tries to access the null value witch in return throws an NPE. The proof for this is that Persist works, as its job is to save the state of what ever it is annotated with it so when you hit the event it will be still present. cheers -- View this message in context: http://tapestry.1045711.n5.nabble.com/strange-NPE-really-making-me-nervous-tp5716818p5716863.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: strange NPE, really making me nervous
yeah... the pointer to the collection wasnt null... it looked like a legitimate allocated collection with a hiberate entity in it. But as soon as i attempted to reference the collection in the event handler... boom... NPE a numega type bounds checker would flush something like this out by flooding free'd memory or erasing free'd memory with 0's as it gets released. in this case the GC was a little late in erasing what was released across the request cycle enough to give me the jeebies... but glad everything is fine now. thanks alot guys for your generosity its nice to know everything is good :)
Re: strange NPE, really making me nervous
Java's garbage collector never sets any normal reference to null. It is a fundamental property of JVM. This sentence 'in this case the GC was a little late in erasing what was released across the request cycle' is not true. Your problem was not related to the garbage collector at all. 'collection' was set to null, because Tapestry always set component's fields to their default values for every separate request. See http://tapestry.apache.org/component-classes.html. '@Persist' might cause your component to work, but I believe it can easily create more problems for you in the longer term, if you don't actually understand how it works and why it solves this problem. Whether an object pointed earlier by 'collection' become garbage or not, and whether garbage was collected by GC or not, it is irrelevant. You mention Numega bound checker, so I guess that you used C or C++. Java's memory management is different than C/C++, and many assumptions based on C/C++ experiences would be wrong with Java. You must also understand that Tapestry applies many changes to page and component classes in runtime, so they don't work exactly as normal Java objects would work. Best regards, Cezary On Fri, Oct 12, 2012 at 8:14 PM, Ken in Nashua kcola...@live.com wrote: yeah... the pointer to the collection wasnt null... it looked like a legitimate allocated collection with a hiberate entity in it. But as soon as i attempted to reference the collection in the event handler... boom... NPE a numega type bounds checker would flush something like this out by flooding free'd memory or erasing free'd memory with 0's as it gets released. in this case the GC was a little late in erasing what was released across the request cycle enough to give me the jeebies... but glad everything is fine now. thanks alot guys for your generosity its nice to know everything is good :)
RE: strange NPE, really making me nervous
Thanks Cezary... all good points to note. Sometimes I just like blabbin... Have a great weekend !
Re: strange NPE, really making me nervous
Hi, are you sure that 'collection' is not null? Best regards, Cezary On Fri, Oct 12, 2012 at 5:27 AM, Ken in Nashua kcola...@live.com wrote: Folks, I am scratching my head about this code which generally was ok in T4... things seem fine but when i enter this handler BOOM My usage of the Math.min(...) hasnt changed... the NPE occurs faithfully on the call to Math.min(...)... even after I tried to change the type of itemsPerPage from Integer to int here is my isolated thing... @Property @Parameter(required = false, cache = false) private int itemsPerPage = 50; and I operate in my eventhandler @Component(parameters = { event=lastPage }) private EventLink lastPage; public void onLastPage() { logger.info(In onLastPage : ); int minimum = Math.min(itemsPerPage, collection.size()); cursor = (collection.size() - minimum); } Now I use to have itemsPerPage declared as Integer... and in T4 type coercing would occur and it ran fine. I am getting an NPE though... and changing this to int doesnt help. I thought I would show you the stack trace... maybe someone can spot something. This one is really stumping me and I am blue in the face. thanks for checking this out funny thing... my onFirstPage handler works fine... no NPE when i step thru that @Component(parameters = { event=firstPage }) private EventLink firstPage; public void onFirstPage() { logger.info(In onFirstPage : ); cursor = 0; } see NPE stack trace below
RE: strange NPE, really making me nervous
Here is Home.JAVA snippet public class Home { /** * Component */ @Property private Class collectiontype; @Property private Integer itemsPerPage = new Integer(50); I am trying to figure out why there is a NPE with this itemsPerPage its just a property in Home.*** its a property and parameter in Gallery.*** the type is Integer and the handler is crashing on NPE when i attempt any operation on this itemsPerPage still trying to shake this out
RE: strange NPE, really making me nervous
thanks czar yeah collestion is absolutely size = 1 and has a hibernate entity in it In my Gallery.JAVA I tried the following... removed @Property on itemsPerPage and added public Integer getItemsPerPage() { return itemsPerPage; } and invoked it directly instead of attempting to reference itemsPerPage still produces NPE :(
Re: strange NPE, really making me nervous
You are giving us incomplete examples, so we can only guess. However my suspicion is that your declaration of default value itemsPerPage is bad. Tapestry 5 does not like initialisation of private fields in components and pages. Try: @Parameter(value=50, required = false, cache = false) private int itemsPerPage; If it does not help, send minimal but complete example of failing code (i.e. Java source + TML). Best regards, Cezary On Fri, Oct 12, 2012 at 6:05 AM, Ken in Nashua kcola...@live.com wrote: thanks czar yeah collestion is absolutely size = 1 and has a hibernate entity in it In my Gallery.JAVA I tried the following... removed @Property on itemsPerPage and added public Integer getItemsPerPage() { return itemsPerPage; } and invoked it directly instead of attempting to reference itemsPerPage still produces NPE :(
Re: strange NPE, really making me nervous
Since itemsPerPage is a property of a page, the @Parameter bit won't work. Instead, try: @Property private int itemsPerPage void setupRender() { itemsPerPage=50; } Robert On Oct 11, 2012, at 10/:25 PM , Cezary Biernacki wrote: You are giving us incomplete examples, so we can only guess. However my suspicion is that your declaration of default value itemsPerPage is bad. Tapestry 5 does not like initialisation of private fields in components and pages. Try: @Parameter(value=50, required = false, cache = false) private int itemsPerPage; If it does not help, send minimal but complete example of failing code (i.e. Java source + TML). Best regards, Cezary On Fri, Oct 12, 2012 at 6:05 AM, Ken in Nashua kcola...@live.com wrote: thanks czar yeah collestion is absolutely size = 1 and has a hibernate entity in it In my Gallery.JAVA I tried the following... removed @Property on itemsPerPage and added public Integer getItemsPerPage() { return itemsPerPage; } and invoked it directly instead of attempting to reference itemsPerPage still produces NPE :( - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: strange NPE, really making me nervous
thanks Cezary... I will try that right now... and if it fails code listings will be better submitted. be right back
RE: strange NPE, really making me nervous
yeah... it didnt work @Property @Parameter(value=50, required = false, cache = false) private Integer itemsPerPage; I kept the integer type because in theory I shouldn't have to change it. I can post the code in a bit... let me take another pass here... 127.0.0.1 - - [12/Oct/2012:04:40:14 +] GET /assets/1.0-SNAPSHOT-1350016757119/tynamo-0.3.0/themes/tapestryskin/breadcrumbs.jpg HTTP/1.1 200 349 http://localhost:8080/assets/1.0-SNAPSHOT-1350016757119/tynamo-0.3.0/themes/tapestryskin/layout-nav.css; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 127.0.0.1 - - [12/Oct/2012:04:40:14 +] GET /assets/1.0-SNAPSHOT-1350016757119/tynamo-0.3.0/themes/tapestryskin/h5.jpg HTTP/1.1 200 357 http://localhost:8080/assets/1.0-SNAPSHOT-1350016757119/tynamo-0.3.0/themes/tapestryskin/layout-nav.css; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 127.0.0.1 - - [12/Oct/2012:04:40:14 +] GET /tynamo/blob/adminlayout/1/header HTTP/1.1 200 223753 http://localhost:8080/Home; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 [INFO] components.Gallery In onLastPage : [ERROR] ioc.Registry org.apache.tapestry5.runtime.ComponentEventException [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'lastpage' on Home:gallerywidget [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry5.ioc.internal.OperationException org.apache.tapestry5.ioc.internal.OperationException [at context:Home.tml, line 36] at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1121) at org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1047) at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:81) at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42) at $ComponentEventRequestHandler_7cc3a688a155.handle(Unknown Source) at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) at $ComponentEventRequestHandler_7cc3a688a155.handle(Unknown Source) at org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) at $ComponentEventRequestHandler_7cc3a688a155.handle(Unknown Source) at org.apache.tapestry5.services.TapestryModule$40.handle(TapestryModule.java:2456) at $ComponentEventRequestHandler_7cc3a688a155.handle(Unknown Source) at $ComponentEventRequestHandler_7cc3a688a0a7.handle(Unknown Source) at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) at $ComponentRequestHandler_7cc3a688a0a9.handleComponentEvent(Unknown Source) at org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:42) at $ComponentRequestFilter_7cc3a688a0a6.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_7cc3a688a0a9.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_7cc3a688a08f.handleComponentEvent(Unknown Source) at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46) at $Dispatcher_7cc3a688a093.dispatch(Unknown Source) at $Dispatcher_7cc3a688a08c.dispatch(Unknown Source) at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302) at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) at $RequestHandler_7cc3a688a08d.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902) at $RequestHandler_7cc3a688a08d.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892) at $RequestHandler_7cc3a688a08d.service(Unknown Source) at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) at $RequestHandler_7cc3a688a08d.service(Unknown Source) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) at
RE: strange NPE, really making me nervous
Thanks Bob... i will try your solution... hold on
RE: strange NPE, really making me nervous
Thanks for tryin guys... the initialization attempts had no effect 127.0.0.1 - - [12/Oct/2012:04:45:35 +] GET /assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/themes/tapestryskin/breadcrumbs.jpg HTTP/1.1 200 349 http://localhost:8080/assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/themes/tapestryskin/layout-nav.css; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 127.0.0.1 - - [12/Oct/2012:04:45:35 +] GET /assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/themes/tapestryskin/h5.jpg HTTP/1.1 200 357 http://localhost:8080/assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/themes/tapestryskin/layout-nav.css; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 127.0.0.1 - - [12/Oct/2012:04:45:35 +] GET /tynamo/blob/adminlayout/1/header HTTP/1.1 200 223753 http://localhost:8080/Home; Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 [INFO] components.Gallery In onLastPage : [ERROR] ioc.Registry org.apache.tapestry5.runtime.ComponentEventException [ERROR] ioc.Registry Operations trace: [ERROR] ioc.Registry [ 1] Triggering event 'lastpage' on Home:gallerywidget [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry5.ioc.internal.OperationException org.apache.tapestry5.ioc.internal.OperationException [at context:Home.tml, line 36] at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1121) at org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146) at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1047) at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:81) at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42) at $ComponentEventRequestHandler_7d0eeb5e1829.handle(Unknown Source) at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) at $ComponentEventRequestHandler_7d0eeb5e1829.handle(Unknown Source) at org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) at $ComponentEventRequestHandler_7d0eeb5e1829.handle(Unknown Source) at org.apache.tapestry5.services.TapestryModule$40.handle(TapestryModule.java:2456) at $ComponentEventRequestHandler_7d0eeb5e1829.handle(Unknown Source) at $ComponentEventRequestHandler_7d0eeb5e177b.handle(Unknown Source) at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) at $ComponentRequestHandler_7d0eeb5e177d.handleComponentEvent(Unknown Source) at org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:42) at $ComponentRequestFilter_7d0eeb5e177a.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_7d0eeb5e177d.handleComponentEvent(Unknown Source) at $ComponentRequestHandler_7d0eeb5e1763.handleComponentEvent(Unknown Source) at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46) at $Dispatcher_7d0eeb5e1767.dispatch(Unknown Source) at $Dispatcher_7d0eeb5e1760.dispatch(Unknown Source) at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302) at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) at $RequestHandler_7d0eeb5e1761.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902) at $RequestHandler_7d0eeb5e1761.service(Unknown Source) at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892) at $RequestHandler_7d0eeb5e1761.service(Unknown Source) at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) at $RequestHandler_7d0eeb5e1761.service(Unknown Source) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) at
RE: strange NPE, really making me nervous
Here is my HOME template and java t:layout title=literal:Tynamo! xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; xmlns:p=tapestry:parameter p:subMenuBlock ul li /li /ul /p:subMenuBlock p:navBlock ul li /li /ul /p:navBlock h1${message:org.hibernatesecurity.welcome}/h1 h1 div id=page.title t:textOutput value=personclass.simplename/ /div /h1 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 /t:layout package org.tynamo.examples.hibernatesecurity.pages; import java.util.Collection; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.ClientElement; import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.annotations.Environmental; import org.apache.tapestry5.annotations.Import; import org.apache.tapestry5.annotations.InjectContainer; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.json.JSONObject; import org.apache.tapestry5.services.javascript.JavaScriptSupport; import org.tynamo.examples.hibernatesecurity.model.Coach; import org.tynamo.examples.hibernatesecurity.model.Person; import org.tynamo.examples.hibernatesecurity.model.UploadableMedia; import org.tynamo.routing.annotations.At; /** * components have parameters, pages have properties in T5 * * @author Kenneth.William.Colassi nhhockeypla...@hotmail.com */ @At(/) @Import(library = classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.script ) public class Home { /** * Component */ @Property private Class collectiontype; @Property private Integer itemsPerPage = new Integer(50); @Property private Integer tableColumns = new Integer(3); @Property private int startRow; @Property private Object currentObject; @Property private int index; @Property private int pageIndex; @Property private Object currentPage; @Property private Collection collection; /** * Script */ @Property private int itemCount; @Property private int cursor; @Property private Object component; /** * JavaScript */ /** * The event to listen for on the client. If not specified, zone update can * only be triggered manually through calling updateHome on the JS object. */ @Parameter(name = clientEvent, defaultPrefix = BindingConstants.LITERAL) private String clientEvent; /** * The event to listen for in your component class */ @Parameter(name = prefix, defaultPrefix = BindingConstants.LITERAL, value = default) private String prefix; @Parameter(name = context) private Object[] context; /** * The page to be updated by us. */ //@Parameter(name = home, defaultPrefix = BindingConstants.LITERAL, required = true) //private String home; /** * Set secure to true if https is being used, else set to false. */ @Parameter(name = secure, defaultPrefix = BindingConstants.LITERAL, value = false) private boolean secure; @Inject private ComponentResources componentResources; @Environmental private JavaScriptSupport javaScriptSupport; /** * The element we attach ourselves to you can ignore this crap... its not developed yet */ @InjectContainer private ClientElement clientElement; void afterRende() { String listenerURI = null;//componentResources.createEventLink(event, context).toAbsoluteURI(secure); // Add some JavaScript to the page to instantiate a ZoneUpdater. It will // run when the DOM has been fully loaded. JSONObject spec = new JSONObject(); spec.put(elementId, clientElement.getClientId()); spec.put(clientEvent, clientEvent); spec.put(listenerURI, listenerURI); //spec.put(homeId, home); javaScriptSupport.addScript(%sHome = new Home(%s), prefix, spec.toString()); } public Class getUploadableMediaClass() { return UploadableMedia.class; } public Class getPersonClass() { return Person.class; } public Class getCoachClass() { return Coach.class; } }
RE: strange NPE, really making me nervous
Ok here is my actual GALLERY template and code... dont get too lost... its still in-play... and messy trust me I am a clean guy... and hopin this will be cleaned up soon !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd; div xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; xmlns:p=tapestry:parameter t:block t:id=autoPagingContent id=autoPagingContent table width=100% border=1 tr td width=25% align=left nowrap=NOWRAP t:Label for=itemsPerPageSelectItems Per Page/t:Label select t:type=Select t:id=itemsPerPageSelect id=itemsPerPageSelect model=literal:5,10,15,25,50,100,250,500,1000,5000,1 value=itemsPerPage defaultValue=5 onchange=this.form.submit() / t:Label for=tableColumnsSelectTable Columns/t:Label select t:type=Select t:id=tableColumnsSelect id=tableColumnsSelect model=literal:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,25,50,100 value=tableColumns defaultValue=3 onchange=this.form.submit() / /td td colspan=0 div style=font-weight:bold; text-align: center; t:outputRaw value=${fromValue}/ span class=label to /span t:outputRaw value=${toValue}/ span class=label of /span span class=label${count}/span /div /td /tr tr td align=left nowrap=NOWRAP colspan=2 div style=font-size:10pt; text-align: center; a t:eventLink t:id=FirstPage img src=${asset:startPage.jpg} height=26 width=42/ /t:eventLink /a a t:eventLink t:id=PrevPage img src=${asset:prevPage.jpg} height=26 width=42/ /t:eventLink /a t:if test=pages t:Loop id=foreachpage source=pages value=currentPage index=pageIndex a t:eventLink t:id=Page parameters=${indexValue} t:outputRaw value=${pageValue}/ /t:eventLink /a /t:Loop /t:if a t:eventLink t:id=NextPage img src=${asset:nextPage.jpg} height=26 width=42/ /t:eventLink /a a t:eventLink t:id=LastPage img src=${asset:endPage.jpg} height=26 width=42/ /t:eventLink /a /div /td /tr /table /t:block t:block t:id=collectionContent id=collectionContent table width=100% t:Loop id=foreachrow source=collection value=currentObject index=index t:If test=okToRenderItem tr t:Loop id=foreachitem source=currentObject td a href=# model=currentObject t:pagelink t:page=Edit context=editPageContext t:Any id=${imageComponentId} img id=transparentTextImageComponentId model=currentObject src=${photoLink} image=${photoLink} alt=${currentObject}.photo.fileName title=${currentObject}.photo.fileName width=200 height=160 topLeftText=${currentObject}.transparentText topRightText=topRightText bottomLeftText=bottomleft bottomRightText=bottomright centerText=center / /t:Any /t:pagelink /a /td span jwcid=@Script
RE: strange NPE, really making me nervous
here is the latest... a component event exception is being triggered to the HOME.TML so for some reason HOME.TML or HOME.JAVA is not able to handle this somehow. An unexpected application exception has occurred.org.apache.tapestry5.ioc.internal.OperationExceptionlocationcontext:Home.tml, line 3631t:Gallery t:id=galleryWidget id=galleryWidget32 collectionType=coachClass33 itemsPerPage=itemsPerPage34 tableColumns=tableColumns35 cursor=cursor36 /37 38 /t:form39 40!--41span jwcid=@Script script=/org/trails/demo/components/Gallery.scripttraceTriggering event 'lastpage' on Home:gallerywidgetorg.apache.tapestry5.runtime.ComponentEventExceptioncontext eventTypelastpagelocationcontext:Home.tml, line 36java.lang.NullPointerExceptionFilter stack frames Stack trace org.tynamo.examples.hibernatesecurity.components.Gallery.onLastPage(Gallery.java:367) org.tynamo.examples.hibernatesecurity.components.Gallery.dispatchComponentEvent(Gallery.java) org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:923)