Hi,

I am using https://github.com/RuedigerMoeller/fast-serialization for ser/des.

my code is rather simple

public class EncoderSerDes
{
private static ISerDes serDes = new FstSerDes();

public static byte[] serialize(ColumnEncoder encoder) throws Exception
{
return serDes.serialize(encoder);
}

public static ColumnEncoder deserialize(byte[] bytes) throws Exception
{
return serDes.deserialize(bytes);
}

interface ISerDes
{
byte[] serialize(ColumnEncoder encoder) throws Exception;

ColumnEncoder deserialize(byte[] bytes) throws Exception;
}

static class JavaSerDes implements ISerDes
{

@Override
public byte[] serialize(ColumnEncoder encoder) throws Exception
{
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos))
{
oos.writeObject(encoder);
return baos.toByteArray();
}
}

@Override
public ColumnEncoder deserialize(byte[] bytes) throws Exception
{
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais))
{
return (ColumnEncoder) ois.readObject();
}
}
}

static class FstSerDes implements ISerDes
{
private static FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();

static
{
conf.registerClass(ArrayEncoder.class,
...
Column.class);
}

@Override
public byte[] serialize(ColumnEncoder encoder) throws Exception
{
return conf.asByteArray(encoder);
}

@Override
public ColumnEncoder deserialize(byte[] bytes) throws Exception
{
return (ColumnEncoder) conf.asObject(bytes);
}
}

}

when this code run in ignite server side. it throws

Exception in thread "pub-#173" java.lang.NoClassDefFoundError: Could not initialize class encoder.EncoderSerDes

How to use singleton instance in ignite server side?  I read doc  https://apacheignite.readme.io/docs/cluster-singletons
but It is not so clear for me. it is the right way for me? and how to call the singleton service?



                
Thanks
Shawn

Reply via email to