You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by karthik G <be...@gmail.com> on 2007/01/02 11:56:18 UTC

ClassCastException when using @InjectSpring

Hi,
I'm using  tapestry-spring-0.1.2 and tapestry 4.0.1 + annotations 4.0.2

I get a ClassCastException in the tapestry page when using @InjectSpring.

Any idea what is going wrong here.

@InjectSpring("productService")
public abstract ProductService getProductService();

The type of the bean returned by getProductService *is* ProductService. I
verified that by changing the signature to this -

@InjectSpring("productService")
public abstract Object getProductService();


But I get a classcast exception right there (the line where the call is
being made). I guess the enhanced class is casting the object returned from
the Spring ApplicationContext to 'ProductService' and still I'm getting a
ClassCastException.

So is there a possibility that the Page and Spring bean are being loaded by
un-related classloaders and hence the exception.

I use jetty for development. I just one VM running.
I'm using Spring 2.0
Thanks for any pointers

thanks
Karthik