Re: T5: Exception occurs in onActivate
Hi All, I'm seeing the same behaviour, I have a page that displays a list of items which link off to a viewitem page with a pagelink with an item id for the context (a string). When I hit the viewitem page I'm seeing the onActivate event handler being called twice, the first time I can see that the item id is there, then the second time its asset ViewItem.java: public void onActivate(String theID) { log.debug(theId); } The tml is very light, no images/assets being used, the only asset that gets rendered out in the final html is the link href=assets/tapestry/default.css rel=stylesheet type=text/css that Tapestry auto renders. ViewItem.tml: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; Hello /html Log output: DEBUG - uk.co.app.pages. ViewItem.onActivate(36) | A4S4 DEBUG - uk.co.app.pages. ViewItem.onActivate(36) | assets Is there any reason why I should see two invocations, this is a render request so only one cycle should be seen right? Any ideas? Thanks, Adam. Josh Penza wrote: Can someone explain the following exception? I click on a productdetail url like ('/productdetail/9) The system.out in ProductDetail. java prints nicely 9 to the screen. ** *void* onActivate(Long productId) { *this*.productId = productId; System.*out*.println(ProductDetail.onActivate : + *this*.productId); } But where does the assets String come from?? Exception in method org.example.web.tapestry.pages.ProductDetail.onActivate( java.lang.Long) (at ProductDetail.java:49), parameter #1: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets Caused by: *java.lang.RuntimeException*: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:154*) at $TypeCoercer_1158a09422d.coerce($TypeCoercer_1158a09422d.java) at org.apache.tapestry.internal.services.ComponentEventImpl.coerceContext(* ComponentEventImpl.java:90*) ... 43 more Caused by: *java.lang.NumberFormatException*: For input string: assets at java.lang.NumberFormatException.forInputString(* NumberFormatException.java:48*) at java.lang.Long.parseLong(*Long.java:403*) at java.lang.Long.init(*Long.java:671*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:232*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:230*) at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce(* CoercionTuple.java:53*) at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:150*) -- View this message in context: http://www.nabble.com/T5%3A-Exception-occurs-in-onActivate-tp13135811p14787478.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Exception occurs in onActivate
What happening is that your HTML is referencing a static file. The file does not exist, and the format of the URL makes it look like a Tapestry page render or action request. If the file did exist, Tapestry would let the servlet container handle it. On Jan 13, 2008 8:16 AM, adamh [EMAIL PROTECTED] wrote: Hi All, I'm seeing the same behaviour, I have a page that displays a list of items which link off to a viewitem page with a pagelink with an item id for the context (a string). When I hit the viewitem page I'm seeing the onActivate event handler being called twice, the first time I can see that the item id is there, then the second time its asset ViewItem.java: public void onActivate(String theID) { log.debug(theId); } The tml is very light, no images/assets being used, the only asset that gets rendered out in the final html is the link href=assets/tapestry/default.css rel=stylesheet type=text/css that Tapestry auto renders. ViewItem.tml: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; Hello /html Log output: DEBUG - uk.co.app.pages. ViewItem.onActivate(36) | A4S4 DEBUG - uk.co.app.pages. ViewItem.onActivate(36) | assets Is there any reason why I should see two invocations, this is a render request so only one cycle should be seen right? Any ideas? Thanks, Adam. Josh Penza wrote: Can someone explain the following exception? I click on a productdetail url like ('/productdetail/9) The system.out in ProductDetail. java prints nicely 9 to the screen. ** *void* onActivate(Long productId) { *this*.productId = productId; System.*out*.println(ProductDetail.onActivate : + *this*.productId); } But where does the assets String come from?? Exception in method org.example.web.tapestry.pages.ProductDetail.onActivate( java.lang.Long) (at ProductDetail.java:49), parameter #1: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets Caused by: *java.lang.RuntimeException*: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:154*) at $TypeCoercer_1158a09422d.coerce($TypeCoercer_1158a09422d.java) at org.apache.tapestry.internal.services.ComponentEventImpl.coerceContext(* ComponentEventImpl.java:90*) ... 43 more Caused by: *java.lang.NumberFormatException*: For input string: assets at java.lang.NumberFormatException.forInputString(* NumberFormatException.java:48*) at java.lang.Long.parseLong(*Long.java:403*) at java.lang.Long.init(*Long.java:671*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:232*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:230*) at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce(* CoercionTuple.java:53*) at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:150*) -- View this message in context: http://www.nabble.com/T5%3A-Exception-occurs-in-onActivate-tp13135811p14787478.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Exception occurs in onActivate
Can someone explain the following exception? I click on a productdetail url like ('/productdetail/9) The system.out in ProductDetail. java prints nicely 9 to the screen. ** *void* onActivate(Long productId) { *this*.productId = productId; System.*out*.println(ProductDetail.onActivate : + *this*.productId); } But where does the assets String come from?? Exception in method org.example.web.tapestry.pages.ProductDetail.onActivate( java.lang.Long) (at ProductDetail.java:49), parameter #1: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets Caused by: *java.lang.RuntimeException*: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:154*) at $TypeCoercer_1158a09422d.coerce($TypeCoercer_1158a09422d.java) at org.apache.tapestry.internal.services.ComponentEventImpl.coerceContext(* ComponentEventImpl.java:90*) ... 43 more Caused by: *java.lang.NumberFormatException*: For input string: assets at java.lang.NumberFormatException.forInputString(* NumberFormatException.java:48*) at java.lang.Long.parseLong(*Long.java:403*) at java.lang.Long.init(*Long.java:671*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:232*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:230*) at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce(* CoercionTuple.java:53*) at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:150*)
Re: T5: Exception occurs in onActivate
My first guess would be that your rendered page has image/script elements that are referenced using relative urls: img src=assets/img.gif/ which would be translated to /productdetail/assets/img.gif in the browser request. My second guess is that the link you clicked on isn't what you think, but that seems less likely. Josh On 10/10/07, Josh Penza [EMAIL PROTECTED] wrote: Can someone explain the following exception? I click on a productdetail url like ('/productdetail/9) The system.out in ProductDetail. java prints nicely 9 to the screen. ** *void* onActivate(Long productId) { *this*.productId = productId; System.*out*.println(ProductDetail.onActivate : + *this*.productId); } But where does the assets String come from?? Exception in method org.example.web.tapestry.pages.ProductDetail.onActivate( java.lang.Long) (at ProductDetail.java:49), parameter #1: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets Caused by: *java.lang.RuntimeException*: Coercion of assets to type java.lang.Long (via String -- Long) failed: For input string: assets at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:154*) at $TypeCoercer_1158a09422d.coerce($TypeCoercer_1158a09422d.java) at org.apache.tapestry.internal.services.ComponentEventImpl.coerceContext (* ComponentEventImpl.java:90*) ... 43 more Caused by: *java.lang.NumberFormatException*: For input string: assets at java.lang.NumberFormatException.forInputString(* NumberFormatException.java:48*) at java.lang.Long.parseLong(*Long.java:403*) at java.lang.Long.init(*Long.java:671*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:232*) at org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(* TapestryIOCModule.java:230*) at org.apache.tapestry.ioc.services.CoercionTuple$CoercionWrapper.coerce(* CoercionTuple.java:53*) at org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(* TypeCoercerImpl.java:150*) -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.