我正在努力使用 Scio/Bigtable/HBase 验证以下示例项目的错误。依赖树需要 protobuf 版本(2.5、2.6.1、3.0、3.1)并且似乎默认为 3.2。我使用了 的着色组件sbt-assembly
,不确定我是否正确。
我的build.sbt:
name := "scalalab"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"com.spotify" %% "scio-core" % "0.3.2",
"com.google.cloud.bigtable" % "bigtable-hbase-1.2" % "0.9.2",
"org.apache.hbase" % "hbase-client" % "1.2.5",
"org.apache.hbase" % "hbase-common" % "1.2.5",
"org.apache.hadoop" % "hadoop-common" % "2.7.3"
)
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("com.google.**" -> "shadeio.@1").inAll
)
assemblyMergeStrategy in assembly := {
case x => MergeStrategy.first
}
我的Main.scala:
import com.google.cloud.bigtable.hbase.adapters.Adapters
import com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks
import org.apache.hadoop.hbase.client.Scan
object Main {
def main(args: Array[String]): Unit = {
val scan = new Scan
scan.setMaxVersions()
scan.addFamily("family".getBytes)
scan.setRowPrefixFilter("prefix".getBytes)
val builder = Adapters.SCAN_ADAPTER.adapt(scan, new DefaultReadHooks)
System.out.println(builder)
}
}
输出到:
scalalab git:(master) ? java -cp .:target/scala-2.11/scalalab-assembly-1.0.jar Main
Exception in thread "main" java.lang.VerifyError: Bad return type
Exception Details:
Location:
shadeio/cloud/bigtable/hbase/adapters/AppendAdapter.adapt(Lorg/apache/hadoop/hbase/client/Operation;)Lshadeio/bigtable/repackaged/com/google/protobuf/GeneratedMessageV3$Builder; @8: areturn
Reason:
Type 'shadeio/bigtable/v2/ReadModifyWriteRowRequest$Builder' (current frame, stack[0]) is not assignable to 'shadeio/bigtable/repackaged/com/google/protobuf/GeneratedMessageV3$Builder' (from method signature)
Current Frame:
bci: @8
flags: { }
locals: { 'shadeio/cloud/bigtable/hbase/adapters/AppendAdapter', 'org/apache/hadoop/hbase/client/Operation' }
stack: { 'shadeio/bigtable/v2/ReadModifyWriteRowRequest$Builder' }
Bytecode:
0x0000000: 2a2b c000 28b6 00a0 b0
at shadeio.cloud.bigtable.hbase.adapters.Adapters.<clinit>(Adapters.java:40)
at Main$.main(Main.scala:12)
at Main.main(Main.scala)
我究竟做错了什么 ?
谢谢你的帮助