0

I am using chronicle queue v4 for writing serialized object to queue. But I keep getting below Exception

Exception in thread "CLF-1" java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. at net.openhft.chronicle.wire.AbstractWire.writeHeader(AbstractWire.java:228) at net.openhft.chronicle.queue.impl.single.StoreRecovery.writeHeader(StoreRecovery.java:28) at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueStore.writeHeader(SingleChronicleQueueStore.java:298) at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writingDocument(SingleChronicleQueueExcerpts.java:232) at net.openhft.chronicle.wire.MarshallableOut.writeDocument(MarshallableOut.java:68)

This is how my code looks

SingleChronicleQueue queue = SingleChronicleQueueBuilder.binary(queueFullPath).build();
ExcerptAppender queueWriter = queue.acquireAppender();
UserStat stat=new UserStat();//this is my object
byte[] bytes = convertObjectToBytes(stat);//custom serialization to convert java object to byte array
queueWriter.writeDocument(w -> w
    .getValueOut().bytes(bytes));

There is nothing written to .cq4 file. But I see the last modified time changed everytime writeDocument() method is called.

1 Answers1

0

Most likely (according to the stack trace) the file you're writing to is damaged. You need to clean it up and retry (and it seems you were using fairly old version). Try to test with new version of Chronicle Queue - chances are high it is solved.

Dmitry Pisklov
  • 1,196
  • 1
  • 6
  • 16