java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Zfadade
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?

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)


Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Jörg Schaible-3
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


Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Zfadade
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 <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: Re: java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Jörg Schaible-2
Hi Zebula,

Zfadade wrote:

> Thanks so much for your prompt and clear help.  It solved my problem.

Nice to hear.
 
> If you want help testing on GAE I would be glad to help.

I've uploaded a new SNAPSHOT (1.5.0-SNAPSHOT) that should address the
problems. It would be a great help, if you can give that version a try
without overloading setupConverters and report back.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Re: java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Zfadade
Hello Jörg,

Your fixed worked !

I used the xstream-1.5.0-20131127.212802-1.jar, and commented out my overriding setupConverters().

It worked on GAE without any problems.

Thanks for your rapid response.  

XStream is a real pleasure to use.

Zebulah




On Wednesday, November 27, 2013 4:38 PM, Jörg Schaible <[hidden email]> wrote:
Hi Zebula,

Zfadade wrote:

> Thanks so much for your prompt and clear help.  It solved my problem.

Nice to hear.

> If you want help testing on GAE I would be glad to help.

I've uploaded a new SNAPSHOT (1.5.0-SNAPSHOT) that should address the
problems. It would be a great help, if you can give that version a try
without overloading setupConverters and report back.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: java.lang.NoClassDefFoundError: java.awt.font.TextAttribute is a restricted class

Jörg Schaible-3
Hi Zebulah,

Zfadade wrote:

> Hello Jörg,
>
> Your fixed worked !
>
> I used the xstream-1.5.0-20131127.212802-1.jar, and commented out my
> overriding setupConverters().
>
> It worked on GAE without any problems.

Thanks for the prompt feedback!
 
> Thanks for your rapid response.
>
> XStream is a real pleasure to use.

;-)

OK, I'll plan to do another 1.4.x release within the next two weeks that
contains these modifications.

Cheers,
Jörg

>
> Zebulah
>
>
>
>
>
> On Wednesday, November 27, 2013 4:38 PM, Jörg Schaible
> <[hidden email]> wrote:
>  
> Hi Zebula,
>
> Zfadade wrote:
>
>> Thanks so much for your prompt and clear help.  It solved my problem.
>
> Nice to hear.
>
>> If you want help testing on GAE I would be glad to help.
>
> I've uploaded a new SNAPSHOT (1.5.0-SNAPSHOT) that should address the
> problems. It would be a great help, if you can give that version a try
> without overloading setupConverters and report back.
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> 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