You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by "Das, Tanmay" <ta...@optum.com> on 2017/06/06 13:44:51 UTC

Error in CAS Serialization to JSON

Hi

When I try to run the following line of code(as given in the guide) :
jcs.serialize(cas, sw);

It produces an error -
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.apache.uima.cas.impl.CasSerializerSupport.COMPARATOR_SHORT_TYPENAME from class org.apache.uima.json.JsonCasSerializer$JsonDocSerializer
       at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.collectUsedSubtypes(JsonCasSerializer.java:842)
       at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.serializeJsonLdContext(JsonCasSerializer.java:717)
       at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.writeFeatureStructures(JsonCasSerializer.java:532)
       at org.apache.uima.cas.impl.CasSerializerSupport$CasDocSerializer.serialize(CasSerializerSupport.java:439)
       at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:318)
       at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:299)
       at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:289)

The definition of COMPARATOR_SHORT_TYPENAME in class CasSerializerSupport :

  final static Comparator<TypeImpl> COMPARATOR_SHORT_TYPENAME = new Comparator<TypeImpl>() {
    public int compare(TypeImpl object1, TypeImpl object2) {
      return object1.getShortName().compareTo(object2.getShortName());
    }
  };

Can anyone thank me with the problem.


Thanks
-TD

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.

Re: Error in CAS Serialization to JSON

Posted by Marshall Schor <ms...@schor.com>.
I accidentally replied off list.  The reply was:

Can you describe your runtime environment?

The description for this particular error says "
this error is caught by the compiler; this error can only occur at run time if
the definition of a class has incompatibly changed."

What level of Java and UIMA etc., are you running?  Is it possible you have some
mixed levels?

-Marshall
On 6/6/2017 9:44 AM, Das, Tanmay wrote:
> Hi
>
> When I try to run the following line of code(as given in the guide) :
> jcs.serialize(cas, sw);
>
> It produces an error -
> Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.apache.uima.cas.impl.CasSerializerSupport.COMPARATOR_SHORT_TYPENAME from class org.apache.uima.json.JsonCasSerializer$JsonDocSerializer
>        at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.collectUsedSubtypes(JsonCasSerializer.java:842)
>        at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.serializeJsonLdContext(JsonCasSerializer.java:717)
>        at org.apache.uima.json.JsonCasSerializer$JsonDocSerializer.writeFeatureStructures(JsonCasSerializer.java:532)
>        at org.apache.uima.cas.impl.CasSerializerSupport$CasDocSerializer.serialize(CasSerializerSupport.java:439)
>        at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:318)
>        at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:299)
>        at org.apache.uima.json.JsonCasSerializer.serialize(JsonCasSerializer.java:289)
>
> The definition of COMPARATOR_SHORT_TYPENAME in class CasSerializerSupport :
>
>   final static Comparator<TypeImpl> COMPARATOR_SHORT_TYPENAME = new Comparator<TypeImpl>() {
>     public int compare(TypeImpl object1, TypeImpl object2) {
>       return object1.getShortName().compareTo(object2.getShortName());
>     }
>   };
>
> Can anyone thank me with the problem.
>
>
> Thanks
> -TD
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.
>