public class Class
{
public static void main(String[] args) throws IOException
{
Configuration config = HBaseConfiguration.create();
config.addResource(new Path("/usr/local/HBase/conf/hbase-site.xml"));
config.addResource(new Path("/home/hadoop/hadoop/etc/hadoop/core-site.xml"));
Connection connection = ConnectionFactory.createConnection(config);
Admin admin = connection.getAdmin();
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf("people"));
tableDescriptor.addFamily(new HColumnDescriptor("personal"));
tableDescriptor.addFamily(new HColumnDescriptor("contactinfo"));
admin.createTable(tableDescriptor);
}
@localhost hadoop]$hadoop jar hbase-0.0.1-snapshot-shaded.jar包.class
错误:-
17/08/29 22:25:04 INFO client.RpcRetryingCaller: Call exception, tries=10, retries=35, started=38496 ms ago, cancelled=false, msg=
17/08/29 22:25:14 INFO client.RpcRetryingCaller: Call exception, tries=11, retries=35, started=48538 ms ago, cancelled=false, msg=
17/08/29 22:25:35 INFO client.RpcRetryingCaller: Call exception, tries=12, retries=35, started=68728 ms ago, cancelled=false, msg=
17/08/29 22:25:55 INFO client.RpcRetryingCaller: Call exception, tries=13, retries=35, started=88917 ms ago, cancelled=false, msg=
17/08/29 22:26:15 INFO client.RpcRetryingCaller: Call exception, tries=14, retries=35, started=109077 ms ago, cancelled=false, msg=
17/08/29 22:26:35 INFO client.RpcRetryingCaller: Call exception, tries=15, retries=35, started=129269 ms ago, cancelled=false, msg=
Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=35, exceptions:
Tue Aug 29 22:24:26 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
Tue Aug 29 22:24:26 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
Tue Aug 29 22:24:26 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
Tue Aug 29 22:24:27 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
Tue Aug 29 22:24:27 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
Tue Aug 29 22:24:28 IST 2017, RpcRetryingCaller{globalStartTime=1504025666395, pause=100, retries=35}, org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:157)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4297)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4289)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTableAsyncV2(HBaseAdmin.java:753)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:674)
at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:607)
at puma.pack.main(pack.java:28)
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1561)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionManager.java:1581)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getKeepAliveMasterService(ConnectionManager.java:1738)
Caused by: com.google.protobuf.ServiceException: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:240)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingStub.isMasterRunning(MasterProtos.java:58383)
Caused by: java.lang.NoClassDefFoundError: com/yammer/metrics/core/Gauge
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:225)
... 21 more
我已经将hbase client jar、hbase common jar、metric core jar添加到我的eclipse pom文件中…我找不到需要做的更改…请帮助我解决这个问题。。
1条答案
按热度按时间brc7rcf01#
我解决了这个问题,因为在中出现了由以下原因引起的问题:java.lang.noclassdeffounderror:com/yammer/metrics/core/gauge所以,将metrics-core-2.2.0.jar添加到hadoop\u classpath不起作用…所以我将这个jar添加到hadoop mapred/lib、hdfs/lib、common/lib文件夹中..因此这个jar在classpath中可用。。