Hi Prachi, Yes, you have to provide full configuration. The error is caused by incomplete request message.
Alternatively, define cache templates on server (configs with * in them) and then use OP_CACHE_CREATE_WITH_NAME from thin client. Thanks, Pavel On Thu, Dec 21, 2017 at 3:47 AM, Prachi Garg <[email protected]> wrote: > Pavel, > > I tried to create a cache with configuration, using the thin protocol. > > 1. Do I need to provide every configuration as mentioned in the wiki, or I > can just provide a few and the rest can be default? > > 2. Using the below code: > > DataOutputStream out = new DataOutputStream(socket.getOutputStream()); > > // Message length > writeIntLittleEndian(22, out); > > // Op code = OP_CACHE_CREATE_WITH_CONFIGURATION > writeShortLittleEndian(1053, out); > > // Request id (can be anything) > long reqId = 1; > writeLongLittleEndian(reqId, out); > > // CacheAtomicityMode > writeIntLittleEndian(0, out); > > // Backups > writeIntLittleEndian(2, out); > > // CacheMode > writeIntLittleEndian(2, out); > > // Read result > DataInputStream in = new DataInputStream(socket.getInputStream()); > > // Response length > final int len = readIntLittleEndian(in); > System.out.println("len: " + len); > > // Request id > long resReqId = readLongLittleEndian(in); > System.out.println("resReqId: " + resReqId); > > // Success > int statusCode = readIntLittleEndian(in); > System.out.println("status code: " + statusCode); > > > I get the following error: > > [2017-12-20 > 16:43:32,800][ERROR][client-connector-#45][ClientListenerNioListener] Failed > to parse client request. > class org.apache.ignite.binary.BinaryObjectException: Not enough data to read > the value [position=22, requiredBytes=4, remainingBytes=0] > at > org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream.ensureEnoughData(BinaryAbstractInputStream.java:305) > at > org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream.readInt(BinaryAbstractInputStream.java:127) > at > org.apache.ignite.internal.binary.BinaryReaderExImpl.readInt(BinaryReaderExImpl.java:743) > at > org.apache.ignite.internal.processors.platform.client.cache.ClientCacheConfigurationSerializer.read(ClientCacheConfigurationSerializer.java:125) > at > org.apache.ignite.internal.processors.platform.client.cache.ClientCacheCreateWithConfigurationRequest.<init>(ClientCacheCreateWithConfigurationRequest.java:45) > at > org.apache.ignite.internal.processors.platform.client.ClientMessageParser.decode(ClientMessageParser.java:333) > at > org.apache.ignite.internal.processors.platform.client.ClientMessageParser.decode(ClientMessageParser.java:220) > at > org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:119) > at > org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:40) > at > org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279) > at > org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109) > at > org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97) > at > org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110) > at > org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:745) > > >
