Thanks so much for your prompt and clear help. It solved my problem. If you want help testing on GAE I would be glad to help.
Cheers, Zebulah Sent from my iPod On Nov 22, 2013, at 4:16 AM, Jörg Schaible <[email protected]> wrote: > Hi Zebulah, > > Zfadade wrote: > >> Hi, >> >> I'm using XStream 1.4.5 and Google App Engine 1.8.8 (and new to both, so >> my knowledge is limited). I'm getting the exception below. I saw a >> posting about this problem from a few years ago, but didn't quite >> understand the solution. Is there a work-around for this? > > Actually I thought, I solved the problem with the latest version 1.4.5. > However, since I have no GAE experience myself and no-one really did a real > test, I can see now - looking at your stack trace - that my approach did not > work, GAE works differently than thought. > > So all you can currently do is to overload XStream's setupConverter method > and register the converters required by your application yourself. Simply > take a copy of the method and strip any converter registration that makes > problems. You have additionally no requirement to load converters > dynamically, since you know you're running Java 7. So it will look like: > > ============= %< ============ > class XStreamGAE extends XStream { > ... > protected void setupConverters() { > registerConverter(new ReflectionConverter(getMapper(), > getReflectionProvider()), PRIORITY_VERY_LOW); > registerConverter(new SerializableConverter(getMapper(), > getReflectionProvider(), getClassLoaderReference()), PRIORITY_LOW); > registerConverter(new ExternalizableConverter(getMapper(), > getClassLoaderReference()), PRIORITY_LOW); > > registerConverter(new NullConverter(), PRIORITY_VERY_HIGH); > registerConverter(new IntConverter(), PRIORITY_NORMAL); > // ... > // continue with the rest of required converters, omitting the > // problematic like FontConverter and TextAttributeConverter > > > // For the dynamic ones you write instead of: > // ============ > // registerConverterDynamically( > // "com.thoughtworks.xstream.converters.extended.ThrowableConverter", > // PRIORITY_NORMAL, new Class[]{ConverterLookup.class}, > // new Object[]{converterLookup}); > // ============ > registerConverter(new ThrowableConverter(), PRIORITY_NORMAL, > getConverterLookup()); > } > ... > } > ============= %< ============ > > Sorry for inconvenience, I will try a different approach for next version. > > Cheers, > Jörg > >> >> Thanks, >> >> Zebulah >> >> java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a >> restricted class. Please see the Google App Engine developer's guide for >> more details. at >> com.google.appengine.runtime.Request.process- > b91d037a09503172(Request.java) >> at java.awt.font.TextAttribute.<clinit>(TextAttribute.java) at >> java.lang.reflect.Field.get(Field.java:30) at >> com.thoughtworks.xstream.core.util.Fields.read(Fields.java:69) at > com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter.readResolve(AbstractAttributedCharacterIteratorAttributeConverter.java:128) >> at > com.thoughtworks.xstream.converters.reflection.AbstractAttributedCharacterIteratorAttributeConverter.<init>(AbstractAttributedCharacterIteratorAttributeConverter.java:65) >> at > com.thoughtworks.xstream.converters.extended.TextAttributeConverter.<init>(TextAttributeConverter.java:33) >> at > com.thoughtworks.xstream.converters.extended.FontConverter.<init>(FontConverter.java:56) >> at >> com.thoughtworks.xstream.XStream.setupConverters(XStream.java:797) at >> com.thoughtworks.xstream.XStream.<init>(XStream.java:556) at >> com.thoughtworks.xstream.XStream.<init>(XStream.java:485) at >> com.thoughtworks.xstream.XStream.<init>(XStream.java:454) at >> com.thoughtworks.xstream.XStream.<init>(XStream.java:400) at >> com.thoughtworks.xstream.XStream.<init>(XStream.java:339) at > com.abigailtech.appdirect.events.SubscriptionOrderEvent.getXStream(SubscriptionOrderEvent.java:329) > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
