Chris,
First off, are you using the prepackaged 1.5b1 or are you building 1.5 
yourself? There were some 
changes that excluded abstract classes but I'm not sure if it was before or 
after 1.5b1.

It looks like your GenericEntityFormatter isn't abstract - making it abstract 
would probably make 
the error go away. Stripes should be fixed to handle the situation you 
encountered and treat the 
class as though it was abstract.

With 1.5 you shouldn't need your own FormatterFactory because the 
auto-discovery code works with the 
DefaultFormatterFactory. I'd pull the Formatter classes into their own package.

Aaron

Christopher Maier wrote:
> I'm in the process of upgrading to version 1.5, but I've hit a snag with some
> custom Formatter classes I have that have worked fine up until now.
> 
> I'm using some custom Formatters to transform serial identifiers from a 
> database into my domain objects.  Since this process is the same for all my 
> objects, I have put the main code into a single class, defined thusly:
> 
> public class GenericEntityFormatter<T extends BaseThing> 
>     implements Formatter<T>{
>     // not important...
>     }
> 
> Each concrete formatter is implemented as a public static class within 
> MyFormatterFactory, which extends DefaultFormatterFactory:
> 
> public static class ThingFormatter extends GenericEntityFormatter<Thing>{}
> public static class FooFormatter extends GenericEntityFormatter<Foo>{}
> ... et cetera ...
> 
> As I said, this works fine with Stripes, pre 1.5.  However, when I try to 
> deploy my Stripes 1.5-enabled webapp in Tomcat, it dies with the following 
> stack trace:
> 
> [TRACE] Found Formatter 
>     [class blah.web.format.MyFormatterFactory$ThingFormatter] - 
>     type parameters: null
> [TRACE] Found Formatter 
>     [class blah.web.format.GenericEntityFormatter] - 
>     type parameters: [T]
> [DEBUG] Adding auto-discovered Formatter 
>     [class blah.web.format.GenericEntityFormatter] for [T] 
>     (from type parameter)
> [ERROR] Exception starting filter StripesFilter
> java.lang.ClassCastException: 
>     sun.reflect.generics.reflectiveObjects.TypeVariableImpl
> at net.sourceforge.stripes.config.RuntimeConfiguration.init
>     (RuntimeConfiguration.java:281)
> at net.sourceforge.stripes.controller.StripesFilter.init
>     (StripesFilter.java:127)
>     ...lots of Tomcat frames omitted...
> 
> It looks like the new configuration can't determine the proper type parameters
> (e.g. MyFormatterFactry$ThingFormatter ultimately implements 
> Formatter<Thing>).
> It's also trying to add my GenericEntityFormatter class as a proper formatter 
> for "T", which is what ultimately causes the crash.
> 
> Is this supposed to happen this way?  Is there a better way I can organize my 
> classes so v1.5 can properly find everything?  Any help is appreciated.
> 
> Thanks,
> Chris
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to