我正在尝试创建一个与BigTable的简单连接,但我认为我的依赖项是不正确的。据我了解,如果我有一个独立的Java应用程序,我唯一需要导入的是bigtable-hbase-1.x,如下所示,但是,似乎不包括一些所需的hbase类。任何援助将不胜感激。
Exception in thread "main" java.lang.IllegalStateException: Could not find an appropriate constructor for com.google.cloud.bigtable.hbase1_x.BigtableConnection
at com.google.cloud.bigtable.hbase.BigtableConfiguration.connect(BigtableConfiguration.java:114)
at com.google.cloud.bigtable.hbase.BigtableConfiguration.connect(BigtableConfiguration.java:99)
at com.example.cloud.bigtable.helloworld.HelloWorld.connect(HelloWorld.java:14)
at com.example.cloud.bigtable.helloworld.HelloWorld.main(HelloWorld.java:19)
CODE
package com.example.cloud.bigtable.helloworld;
import com.google.cloud.bigtable.hbase.BigtableConfiguration;
import java.io.IOException;
public class HelloWorld {
private static final String PROJECT_ID = "______";
private static final String INSTANCE_ID = "_______";
//private static Connection connection = null;
public static void connect() throws IOException {
BigtableConfiguration.connect(PROJECT_ID, INSTANCE_ID);
}
public static void main(String[] args) {
try {
connect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
POM
<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Copyright (c) 2016 Google Inc. All Rights Reserved. ~ ~ Licensed under
the Apache License, Version 2.0 (the "License"); you ~ may not use this file
except in compliance with the License. You may ~ obtain a copy of the License
at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by
applicable law or agreed to in writing, software ~ distributed under the
License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or ~ implied. See the License for the specific
language governing ~ permissions and limitations under the License. -->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.bigtable.helloworld</groupId>
<artifactId>cloud-bigtable-hello-world</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>cloud-bigtable-hello-world</name>
<url>http://maven.apache.org</url>
<properties>
<bigtable.version>1.0.0-pre1</bigtable.version>
<hbase.version>1.1.5</hbase.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- <repository> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy> </releases> <snapshots> <enabled>false</enabled>
<updatePolicy>never</updatePolicy> <checksumPolicy>fail</checksumPolicy>
</snapshots> <id>google-maven-central</id> <name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com</url> <layout>default</layout>
</repository> -->
</repositories>
<!-- <pluginRepositories> <pluginRepository> <releases> <enabled>true</enabled>
<updatePolicy>daily</updatePolicy> <checksumPolicy>warn</checksumPolicy>
</releases> <snapshots> <enabled>false</enabled> <updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy> </snapshots> <id>google-maven-central</id>
<name>Google Maven Central</name> <url>https://maven-central.storage.googleapis.com</url>
<layout>default</layout> </pluginRepository> </pluginRepositories> -->
<dependencies>
<dependency>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-hbase-1.x</artifactId>
<version>${bigtable.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.hbase/hbase-client -->
<!-- <dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.3.1</version>
</dependency> -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork26</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.hbase/hbase -->
<!-- <dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.90.3</version>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<mainClass>com.example.cloud.bigtable.helloworld.HelloWorld</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:0)
我相信我有一个损坏的依赖jar。我开始干净,正在运行1.0.0-pre3,一切都很好。感谢您的回复