看来我无法从AppEngine上运行的Java类创建连接。
我使用以下库/依赖项:
<dependency>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-hbase-1.1</artifactId>
<version>0.1.9</version>
</dependency>
以下代码行:
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.*;
Configuration conf = HBaseConfiguration.create();
connection = ConnectionFactory.createConnection(conf);
ConnectionFactory.createConnection()
方法似乎尝试使用受限制的类。
您能帮我们解释一下如何在GAE上使用它吗?
在devserver上本地运行时出现以下错误:
Caused by: java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:52)
at org.apache.hadoop.util.ReflectionUtils.<clinit>(ReflectionUtils.java:137)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:65)
at org.apache.hadoop.hbase.security.UserProvider.instantiate(UserProvider.java:45)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:214)
at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:119)
at org.energyworx.datastore.BigTableTSStorage.<init>(BigTableTSStorage.java:104)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:379)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 71 more