|
|
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@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx
|
|