You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jose Gonzalez Gomez <jg...@opentechnet.com> on 2004/11/05 18:11:20 UTC
Totally lost with ClassCastException problem
Hi there,
I'm getting a ClassCastException in a point of my Tapestry
application and I cannot find the root of the problem. I have simplified
the problem as much as I can, but I still don't see the solution... here
you have the clues:
I have two classes (Organization -> PostalAddress) and a form to
edit the Organization data. As PostalAddress will be used in other
classes/forms I have extracted the fields of PostalAddress into a
component with a single parameter, the PostalAddress to edit. Whenever
my form is shown, either empty or with a selected Organization,
everything is fine (I create an empty Organization with an empty
PostalAddress in pageBeginRender in case there is no Organization
selected). But whenever I submit the form I get a ClassCastException.
Once I got the error, I took out almost everything but the problematic
things.
Stack trace of the exception as shown by Tapestry:
An exception has occurred.
You may continue by *restarting
<http://localhost:8080/interbanca/restart.do>* the session.
org.apache.tapestry.ApplicationRuntimeException
component:
com.houndline.interbanca.web.admin.OrganizacionPage$Enhance_0@7b9a29[admin/organizacion/organizacion]
location:
context:/WEB-INF/espec-paginas/admin/organizacion/Organizacion.page,
line 19, column 81
java.lang.ClassCastException
Stack Trace:
* org.apache.tapestry.param.AbstractParameterConnector.resetParameter(AbstractParameterConnector.java:148)
* org.apache.tapestry.param.ParameterManager.resetParameters(ParameterManager.java:124)
* org.apache.tapestry.AbstractComponent.cleanupAfterRender(AbstractComponent.java:932)
* org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:863)
* org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
* org.apache.tapestry.form.Form.renderComponent(Form.java:362)
* org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
* org.apache.tapestry.form.Form.rewind(Form.java:568)
* org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:435)
* org.apache.tapestry.form.Form.trigger(Form.java:582)
* org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
* org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
* org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
* org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
* [...]
From Organization.page:
<property-specification name="selectedOrganization"
type="[fullPackageName].Organization"/>
<component id="postalAddress" type="PostalAddress">
<binding name="postalAddress"
expression="selectedOrganization.postalAddress"/>
</component>
From PostalAddress.jwc (I have commented out all embedded components
while testing, and with only this I get the error):
<component-specification class="org.apache.tapestry.BaseComponent"
allow-body="no" allow-informal-parameters="no">
<parameter name="postalAddress" direction="form"
type="[fullPackageName].PostalAddress" required="yes"/>
</component-specification>
From OrganizationPage.java:
public void pageBeginRender( PageEvent arg0 )
{
if( this.getSelectedOrganization( ) == null )
{
this.setSelectedOrganization( new Organization( ) );
}
}
From Organization.java:
private PostalAddress postalAddress = new PostalAddress( );
Any help would be greatly appreciated... the only thing I doubt
about it is the direction of the parameter... should this be form?
Thanks in advance, best regards
Jose
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Totally lost with ClassCastException problem
Posted by Jose Gonzalez Gomez <jg...@opentechnet.com>.
But I don't want to give any extra functionality in this component,
apart from packaging several fields that will be used in a form. I've
taken a look at the API, and I haven't found any class I could use out
of the box for this purpose... am I missing anything? Is this the
correct way to do this?
Best regards
Jose
Filip S. Adamsen wrote:
> I see it! (I think.)
>
> You have a form component, but it doesn't implement the IFormComponent
> interface - that's what's causing the ClassCastException. If this is
> the case, I can't think of anything else, then subclassing
> AbstractFormComponent might help you get the job done quickly.
>
> -Filip
>
> Jose Gonzalez Gomez wrote:
>
>>
>> Hi there,
>>
>> I'm getting a ClassCastException in a point of my Tapestry
>> application and I cannot find the root of the problem. I have
>> simplified the problem as much as I can, but I still don't see the
>> solution... here you have the clues:
>>
>> I have two classes (Organization -> PostalAddress) and a form to
>> edit the Organization data. As PostalAddress will be used in other
>> classes/forms I have extracted the fields of PostalAddress into a
>> component with a single parameter, the PostalAddress to edit.
>> Whenever my form is shown, either empty or with a selected
>> Organization, everything is fine (I create an empty Organization with
>> an empty PostalAddress in pageBeginRender in case there is no
>> Organization selected). But whenever I submit the form I get a
>> ClassCastException. Once I got the error, I took out almost
>> everything but the problematic things.
>>
>> Stack trace of the exception as shown by Tapestry:
>> An exception has occurred.
>>
>> You may continue by *restarting
>> <http://localhost:8080/interbanca/restart.do>* the session.
>>
>> org.apache.tapestry.ApplicationRuntimeException
>>
>> component:
>> com.houndline.interbanca.web.admin.OrganizacionPage$Enhance_0@7b9a29[admin/organizacion/organizacion]
>>
>> location:
>> context:/WEB-INF/espec-paginas/admin/organizacion/Organizacion.page,
>> line 19, column 81
>>
>> java.lang.ClassCastException
>>
>> Stack Trace:
>>
>> *
>> org.apache.tapestry.param.AbstractParameterConnector.resetParameter(AbstractParameterConnector.java:148)
>>
>>
>> *
>> org.apache.tapestry.param.ParameterManager.resetParameters(ParameterManager.java:124)
>>
>>
>> *
>> org.apache.tapestry.AbstractComponent.cleanupAfterRender(AbstractComponent.java:932)
>>
>>
>> *
>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:863)
>>
>> *
>> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
>>
>>
>> * org.apache.tapestry.form.Form.renderComponent(Form.java:362)
>> *
>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
>>
>> * org.apache.tapestry.form.Form.rewind(Form.java:568)
>> *
>> org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:435)
>>
>>
>> * org.apache.tapestry.form.Form.trigger(Form.java:582)
>> *
>> org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
>>
>> *
>> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
>>
>>
>> *
>> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
>>
>>
>> *
>> org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
>>
>> * [...]
>>
>>
>>
>> From Organization.page:
>>
>> <property-specification name="selectedOrganization"
>> type="[fullPackageName].Organization"/>
>> <component id="postalAddress" type="PostalAddress">
>> <binding name="postalAddress"
>> expression="selectedOrganization.postalAddress"/>
>> </component>
>>
>> From PostalAddress.jwc (I have commented out all embedded
>> components while testing, and with only this I get the error):
>>
>> <component-specification class="org.apache.tapestry.BaseComponent"
>> allow-body="no" allow-informal-parameters="no">
>> <parameter name="postalAddress" direction="form"
>> type="[fullPackageName].PostalAddress" required="yes"/>
>> </component-specification>
>>
>> From OrganizationPage.java:
>>
>> public void pageBeginRender( PageEvent arg0 )
>> {
>> if( this.getSelectedOrganization( ) == null )
>> {
>> this.setSelectedOrganization( new Organization( ) );
>> }
>> }
>>
>> From Organization.java:
>>
>> private PostalAddress postalAddress = new PostalAddress( );
>>
>>
>> Any help would be greatly appreciated... the only thing I doubt
>> about it is the direction of the parameter... should this be form?
>>
>> Thanks in advance, best regards
>> Jose
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Totally lost with ClassCastException problem
Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
I see it! (I think.)
You have a form component, but it doesn't implement the IFormComponent
interface - that's what's causing the ClassCastException. If this is the
case, I can't think of anything else, then subclassing
AbstractFormComponent might help you get the job done quickly.
-Filip
Jose Gonzalez Gomez wrote:
>
> Hi there,
>
> I'm getting a ClassCastException in a point of my Tapestry
> application and I cannot find the root of the problem. I have simplified
> the problem as much as I can, but I still don't see the solution... here
> you have the clues:
>
> I have two classes (Organization -> PostalAddress) and a form to edit
> the Organization data. As PostalAddress will be used in other
> classes/forms I have extracted the fields of PostalAddress into a
> component with a single parameter, the PostalAddress to edit. Whenever
> my form is shown, either empty or with a selected Organization,
> everything is fine (I create an empty Organization with an empty
> PostalAddress in pageBeginRender in case there is no Organization
> selected). But whenever I submit the form I get a ClassCastException.
> Once I got the error, I took out almost everything but the problematic
> things.
>
> Stack trace of the exception as shown by Tapestry:
> An exception has occurred.
>
> You may continue by *restarting
> <http://localhost:8080/interbanca/restart.do>* the session.
>
> org.apache.tapestry.ApplicationRuntimeException
>
> component:
> com.houndline.interbanca.web.admin.OrganizacionPage$Enhance_0@7b9a29[admin/organizacion/organizacion]
>
> location:
> context:/WEB-INF/espec-paginas/admin/organizacion/Organizacion.page,
> line 19, column 81
>
> java.lang.ClassCastException
>
> Stack Trace:
>
> *
> org.apache.tapestry.param.AbstractParameterConnector.resetParameter(AbstractParameterConnector.java:148)
>
>
> *
> org.apache.tapestry.param.ParameterManager.resetParameters(ParameterManager.java:124)
>
>
> *
> org.apache.tapestry.AbstractComponent.cleanupAfterRender(AbstractComponent.java:932)
>
>
> *
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:863)
>
> *
> org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
>
>
> * org.apache.tapestry.form.Form.renderComponent(Form.java:362)
> *
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
>
> * org.apache.tapestry.form.Form.rewind(Form.java:568)
> *
> org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:435)
>
> * org.apache.tapestry.form.Form.trigger(Form.java:582)
> *
> org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
>
> *
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
>
> *
> org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
>
>
> *
> org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
> * [...]
>
>
>
> From Organization.page:
>
> <property-specification name="selectedOrganization"
> type="[fullPackageName].Organization"/>
> <component id="postalAddress" type="PostalAddress">
> <binding name="postalAddress"
> expression="selectedOrganization.postalAddress"/>
> </component>
>
> From PostalAddress.jwc (I have commented out all embedded components
> while testing, and with only this I get the error):
>
> <component-specification class="org.apache.tapestry.BaseComponent"
> allow-body="no" allow-informal-parameters="no">
> <parameter name="postalAddress" direction="form"
> type="[fullPackageName].PostalAddress" required="yes"/>
> </component-specification>
>
> From OrganizationPage.java:
>
> public void pageBeginRender( PageEvent arg0 )
> {
> if( this.getSelectedOrganization( ) == null )
> {
> this.setSelectedOrganization( new Organization( ) );
> }
> }
>
> From Organization.java:
>
> private PostalAddress postalAddress = new PostalAddress( );
>
>
> Any help would be greatly appreciated... the only thing I doubt about
> it is the direction of the parameter... should this be form?
>
> Thanks in advance, best regards
> Jose
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: Totally lost with ClassCastException problem
Posted by Jose Gonzalez Gomez <jg...@opentechnet.com>.
Of course, that isn't the real package name :o)
Best regards
Jose
Omar Valerio wrote:
>Hello Jose,
>
>I have a question, in your page file did you manually edit the package name?
>
>
>
>>type="[fullPackageName].PostalAddress"
>>
>>
>
>--
>Omar V.M.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Totally lost with ClassCastException problem
Posted by Omar Valerio <om...@gmail.com>.
Hello Jose,
I have a question, in your page file did you manually edit the package name?
> type="[fullPackageName].PostalAddress"
--
Omar V.M.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org