You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Penza <jo...@gmail.com> on 2007/10/10 15:26:40 UTC

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*)

createAbsoluteAsset question

Posted by mu...@fantasymail.de.
What's wrong with this code?

IAsset image = getEngine().getInfrastructure().getAssetFactory().createAbsoluteAsset(
				"z:\\images\\0001.JPG",
				getLocale(),
				getLocation()
);

java.lang.IllegalArgumentException
Could not find a strategy instance for class java.lang.String.
Stack Trace:

      org.apache.hivemind.lib.util.StrategyRegistryImpl.searchForAdaptor(StrategyRegistryImpl.java:176) org.apache.hivemind.lib.util.StrategyRegistryImpl.getStrategy(StrategyRegistryImpl.java:74) $AssetFactory_117756b8982._getStrategy($AssetFactory_117756b8982.java) $AssetFactory_117756b8982.createAbsoluteAsset($AssetFactory_117756b8982.java) $AssetFactory_117756b8822.createAbsoluteAsset($AssetFactory_117756b8822.java) 

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


Re: T5: Exception occurs in onActivate

Posted by Howard Lewis Ship <hl...@gmail.com>.
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 <ad...@azudio.co.uk> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: Exception occurs in onActivate

Posted by adamh <ad...@azudio.co.uk>.
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Exception occurs in onActivate

Posted by Josh Canfield <jo...@thedailytube.com>.
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 <jo...@gmail.com> 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.