I’m doing a fairly “by the book” clobber update (store and fetch below work
fine) on an entity using the Java client. I’m seeing an error that happens at
type-inference time within the Riak Java client. I’m pasting below the exact
test that I’m using to generate this, as well as the stacktrace. Please let me
know if I’m missing something or if it’s a known bug.
Thank you
Cosmin
@Test
public void testRiakUpdate() throws Exception {
RiakNode node = new
RiakNode.Builder().withRemoteAddress("192.168.168.2").withRemotePort(8087).build();
RiakCluster cluster = new RiakCluster.Builder(node).build();
cluster.start();
RiakClient client = new RiakClient(cluster);
SomeEntity entity = new SomeEntity();
entity.setName("John Doe");
entity.setDescription("Some Description");
Location location = new Location(new Namespace("bucket"), "entity-key");
// Store
StoreValue storeOp = new
StoreValue.Builder(entity).withLocation(location).build();
client.execute(storeOp);
// Fetch
FetchValue fetchOp = new FetchValue.Builder(location).build();
entity = client.execute(fetchOp).getValue(SomeEntity.class);
// Update
entity.setName("New name");
UpdateValue updateOp = new UpdateValue.Builder(location)
.withFetchOption(FetchValue.Option.DELETED_VCLOCK, true)
.withUpdate(UpdateValue.Update.clobberUpdate(entity))
.build();
client.execute(updateOp).getValue(SomeEntity.class);
}
private static class SomeEntity {
private String name;
private String description;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
java.lang.ClassCastException:
sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to
java.lang.Class at
com.basho.riak.client.api.commands.kv.UpdateValue$1.handle(UpdateValue.java:149)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.api.commands.ListenableFuture.notifyListeners(ListenableFuture.java:78)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.api.commands.CoreFutureAdapter.handle(CoreFutureAdapter.java:120)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.FutureOperation.fireListeners(FutureOperation.java:131)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.FutureOperation.setResponse(FutureOperation.java:170)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.RiakNode.onSuccess(RiakNode.java:823)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.netty.RiakResponseHandler.channelRead(RiakResponseHandler.java:58)
~[riak-client-2.0.0.jar:na] at
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:155)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:108)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:116)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
java.lang.Thread.run(Thread.java:745) [na:1.8.0_05] 20:34:13.390
[nioEventLoopGroup-2-1] DEBUG c.b.riak.client.core.FutureOperation -
IllegalStateException; required: [CREATED, WRITTEN, RETRY] current: COMPLETE
20:34:13.391 [nioEventLoopGroup-2-1] WARN i.n.channel.DefaultChannelPipeline -
An exception was thrown by a user handler's exceptionCaught() method while
handling the following exception: java.lang.ClassCastException:
sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to
java.lang.Class at
com.basho.riak.client.api.commands.kv.UpdateValue$1.handle(UpdateValue.java:149)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.api.commands.ListenableFuture.notifyListeners(ListenableFuture.java:78)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.api.commands.CoreFutureAdapter.handle(CoreFutureAdapter.java:120)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.FutureOperation.fireListeners(FutureOperation.java:131)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.FutureOperation.setResponse(FutureOperation.java:170)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.RiakNode.onSuccess(RiakNode.java:823)
~[riak-client-2.0.0.jar:na] at
com.basho.riak.client.core.netty.RiakResponseHandler.channelRead(RiakResponseHandler.java:58)
~[riak-client-2.0.0.jar:na] at
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:155)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:108)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:340)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:326)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:116)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
[netty-all-4.0.17.Final.jar:4.0.17.Final] at
java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com