incubator-s4-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Morel <mmo...@apache.org>
Subject Re: help >> com.esotericsoftware.kryo.SerializationException
Date Tue, 05 Mar 2013 09:43:53 GMT
We use kryo for serialization. What is happening is that, for different applications, internally,
different IDs are used for these classes. So actually suggestion 2/ is not a good one, and
I take it back (was thinking of another case)! 

So the solution is to use the default generic event type for sending data from the adapter
to the downstream app. There is already quite a bit you can do with it.

Regards,

Matthieu







On Mar 5, 2013, at 10:07 , hyunju kim wrote:

> hi
> 
> Hi,
> I created same classes("Info, InputEvent")  in twitter-counter and twitter-adapter
> Nevertheless Exception is occured
> 
> 
> 
> 2013/3/5 Matthieu Morel <mmorel@apache.org>
> Hi,
> 
> this is normal: the adapter app and the twitter counter app have different classes, and
most probably you defined LatencyInfo and InputEvent in the twitter adapter app but they are
not available in the twitter counter app.
> 
> There are 2 ways to address this:
> 1/ use generic event types for inter-app communication
> 2/ create a package with the shared classes (e.g. LatencyInfo) and add it as a dependency
for both applications (adapter and counter).
> 
> We'll clarify that in the documentation for the forthcoming release (release candidate
planned for next week). S4 0.6 will also facilitate the configuration of applications.
> 
> Hope this helps,
> 
> Matthieu
> 
> 
> On Mar 5, 2013, at 08:20 , hyunju kim wrote:
> 
>> Hi~!
>> 
>> i try to change the sample app "twitter-adapter & twitter-counter" ,
>> 
>> this is "twitter-adapter" code
>> 
>> List<Info> info = new ArrayList<Info>();					    
>> Info fo = new Info("TwitterInputAdapter",startTime,currentTime);
>> info.add(fo);
>> inputEvent event = new InputEvent("statusText",str,index,info);
>> getRemoteStream().put(event);
>> 
>> 
>> Executing the code above generates the following output
>> 
>> Exception is >>
>>  
>> Exception in thread "RawStatus" com.esotericsoftware.kryo.SerializationException:
Unable to deserialize object of type: org.apache.s4.example.twitter.InputEvent
>> 	at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:571)
>> 	at com.esotericsoftware.kryo.ObjectBuffer.readClassAndObject(ObjectBuffer.java:206)
>> 	at org.apache.s4.comm.serialize.KryoSerDeser.deserialize(KryoSerDeser.java:84)
>> 	at org.apache.s4.core.Stream.run(Stream.java:282)
>> 	at java.lang.Thread.run(Thread.java:662)
>> Caused by: com.esotericsoftware.kryo.SerializationException: Unable to deserialize
object of type: org.apache.s4.example.twitter.LatencyInfo
>> Serialization trace:
>> info (org.apache.s4.example.twitter.InputEvent)
>> 	at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:571)
>> 	at com.esotericsoftware.kryo.serialize.CollectionSerializer.readObjectData(CollectionSerializer.java:113)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:220)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:200)
>> 	at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:566)
>> 	... 4 more
>> Caused by: com.esotericsoftware.kryo.SerializationException: Serialization trace:
>> kryo (org.apache.s4.example.twitter.LatencyInfo)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:238)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:200)
>> 	at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:566)
>> 	... 8 more
>> Caused by: java.lang.IllegalArgumentException: Can not set com.esotericsoftware.kryo.Kryo
field org.apache.s4.example.twitter.LatencyInfo.kryo to java.lang.Boolean
>> 	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
>> 	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
>> 	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
>> 	at java.lang.reflect.Field.set(Field.java:657)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer$CachedField.set(FieldSerializer.java:319)
>> 	at com.esotericsoftware.kryo.serialize.FieldSerializer.readObjectData(FieldSerializer.java:231)
>> 	... 10 more
>> 
> 
> 


Mime
View raw message