开发者社区> 问答> 正文

table store (ots) java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.

fick707 2016-02-22 14:27:40 3687

今天刚开始和ots,项目依赖sdk(只依赖了ots-public2.1.1的jar包)后,运行单元测试代码,listTable方法时,报上面的错。不知道什么原因。请指教。
java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.

at com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:192)
at com.aliyun.openservices.ots.protocol.OtsProtocol2$ListTableRequest.getSerializedSize(OtsProtocol2.java:9103)
at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:64)
at com.aliyun.openservices.ots.internal.OTSOperation.asyncInvokePost(OTSOperation.java:91)
at com.aliyun.openservices.ots.internal.OTSAsyncTableOperation.listTable(OTSAsyncTableOperation.java:67)
at com.aliyun.openservices.ots.internal.ListTableCallable.call(ListTableCallable.java:18)
at com.aliyun.openservices.ots.OTSClient.listTable(OTSClient.java:213)
at com.qxwz.externaldal.ots.api.impl.OtsClientImpl.listTable(OtsClientImpl.java:133)
at com.qxwz.externaldal.ots.api.impl.OtsClientImplTest.testListTable(OtsClientImplTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
NoSQL Java 测试技术 开发工具
分享到
取消 提交回答
全部回答(2)
  • 木洛
    2019-07-17 18:30:02

    这个的原因是OTS依赖的ProtoBuf库和您项目中的ProtoBuf库冲突导致。

    解决方案的话,可以使用OTS提供的去除PB库依赖的SDK版本:

    <groupId>com.aliyun.openservices</groupId>
    <artifactId>ots-public</artifactId>
    <version>2.2.4</version>
    <classifier>jar-with-dependencies</classifier>

    以后OTS相关的问题可以直接发到表格存储的圈子,我们会第一时间进行解答。

    0 0
  • wq_crazyboy
    2019-07-17 18:30:02

    建议您可以先建立个新项目仅包含OTS SDK中的相关jar包测试是否正常,是否是由于包冲突导致的呢?

    0 0
添加回答

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题