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/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users