You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by stephanos2k <st...@googlemail.com> on 2011/07/15 13:16:58 UTC

Scala + v5.3 + ${}: IntrospectionException

I just tried to reference a variable from a Scala case class in a template
file when I received this:
     /java.beans.IntrospectionException: type mismatch between read and
write methods/

I used something like ${currentEntity.id} when the exception occured, just
${currentEntity} works.

I'm not 100% certain that it has to do with Scala, yet, but it seems like
it. I think in v5.2 it worked. 
*Does anyone have a clue why this happens or how to fix it?*

Oh, here is part of the stacktrace:
     /java.lang.RuntimeException: java.beans.IntrospectionException: type
mismatch between read and write methods
	at
org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.buildAdapter(PropertyAccessImpl.java:103)
	at
org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.getAdapter(PropertyAccessImpl.java:68)
/

Cheers

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Scala-v5-3-IntrospectionException-tp4590266p4590266.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: Scala + v5.3 + ${}: IntrospectionException

Posted by stephanos2k <st...@googlemail.com>.
Hm, I tried to debug and went to the root of the exception:
java.beans.PropertyDescriptor.findPropertyType

It seems that the read method for the 'id' field is
     /public java.lang.Object com.mycompany.sql.model.DataEntity.id()/
while the write method is
     /public void com.mycompany.sql.model.DataEntity.id_$eq(long)/

I will try a few things to see if I can somehow resolve this.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Scala-v5-3-IntrospectionException-tp4590266p4590540.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: Scala + v5.3 + ${}: IntrospectionException

Posted by stephanos2k <st...@googlemail.com>.
Thanks for your reply. I tried adding @BeanProperty to the case class and it
still fails - BUT the stacktrace is different:

/Caused by: java.beans.IntrospectionException: type mismatch between read
and write methods
	at
java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:603)
	at
java.beans.PropertyDescriptor.setWriteMethod(PropertyDescriptor.java:270)
	at
org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.addPropertyIfScalaGetterMethod(PropertyAccessImpl.java:156) 
	at
org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.addPropertiesFromScala(PropertyAccessImpl.java:138)
	at
org.apache.tapestry5.ioc.internal.services.PropertyAccessImpl.buildAdapter(PropertyAccessImpl.java:97)/

It appears as though somebody especially wrote methods just to handle Scala
classes, but it leaves me even more puzzled as to why it fails then.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Scala-v5-3-IntrospectionException-tp4590266p4590494.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: Scala + v5.3 + ${}: IntrospectionException

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Hi!

On Fri, 15 Jul 2011 08:16:58 -0300, stephanos2k  
<st...@googlemail.com> wrote:

> I just tried to reference a variable from a Scala case class in a  
> template file when I received this:
>      /java.beans.IntrospectionException: type mismatch between read and
> write methods/

Do you know how the bytecode of a case class' getters and setters are  
generated? I'm curious about Scala, but I haven't had the time to really  
experiment with it yet. As far as I know, Scala doesn't generate  
Java-style getters and setters for fields unless you use the @BeanProperty  
annotation. This blog has documenting the use of Scala and Tapestry  
together:  
http://fanf42.blogspot.com/2009/01/t5-scala-first-injection-and-property.html.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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