Configuration is in hadoop-common module. Do you have the following in your pom.xml ?
<dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>2.6.0.2.2.0.0</version> Cheers On Sun, Apr 19, 2015 at 2:53 AM, guxiaobo1982 <guxiaobo1...@qq.com> wrote: > Later I found spring-data-hadoop has a dependency with > spring-data-hadoop-hbase, which has dependency with hbase-client, but with > version 0.98.5, so I switch to > > > > <dependency> > > <groupId>org.springframework.data</groupId> > > <artifactId>spring-data-hadoop</artifactId> > > <version>2.1.2.RELEASE</version> > > </dependency> > > > > > > > > > <!-- --> > > <dependency> > > <groupId>org.apache.hbase</groupId> > > <artifactId>hbase-client</artifactId> > > <version>0.98.5-hadoop2</version> > > </dependency> > > > > > But still come to the same problem. > > > > > > > > > > > ------------------ Original ------------------ > From: "guxiaobo1982";<guxiaobo1...@qq.com>; > Send time: Sunday, Apr 19, 2015 5:45 PM > To: "user"<user@hbase.apache.org>; > > Subject: Simple HbaseTemplate demo can't run > > > > Hi, > > > > I am running HDP2.2 with Hbase 0.98.4.2.2.0.0 and HDFS 2.6.0.2.2.0.0, so I > add the 2.1.2.RELEASE version of spring-data-hadoop to my maven pom file, > but failed to complie with the following error messages: > > > > > Exception in thread "main" java.lang.Error: Unresolved compilation > problems: > > The type org.apache.hadoop.hbase.client.Scan cannot be resolved. > It is indirectly referenced from required .class files > > The type new RowMapper<String>(){} must implement the inherited > abstract method RowMapper<String>.mapRow(Result, int) > > Result cannot be resolved to a type > > at bh.com.hbase_test.HBaseSpringTest.main(HBaseSpringTest.java:23) > > I thought spring-data-hadoop should has hbase-client as it's dependency, > but I found it does not, so I add the 0.98.4-hadoop2 version of > hbase-client manually, then the program can compile, but failed with the > following > > > > > Exception in thread "main" > org.springframework.data.hadoop.hbase.HbaseSystemException: > java.lang.reflect.InvocationTargetException; nested exception is > java.io.IOException: java.lang.reflect.InvocationTargetException > > at > org.springframework.data.hadoop.hbase.HbaseUtils.convertHbaseException(HbaseUtils.java:42) > > at > org.springframework.data.hadoop.hbase.HbaseUtils.getHTable(HbaseUtils.java:82) > > at > org.springframework.data.hadoop.hbase.HbaseTemplate.getTable(HbaseTemplate.java:75) > > at > org.springframework.data.hadoop.hbase.HbaseTemplate.execute(HbaseTemplate.java:54) > > at > org.springframework.data.hadoop.hbase.HbaseTemplate.find(HbaseTemplate.java:126) > > at > org.springframework.data.hadoop.hbase.HbaseTemplate.find(HbaseTemplate.java:155) > > at > org.springframework.data.hadoop.hbase.HbaseTemplate.find(HbaseTemplate.java:143) > > at bh.com.hbase_test.HBaseSpringTest.main(HBaseSpringTest.java:23) > > Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException > > at > org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:411) > > at > org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:388) > > at > org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:269) > > at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:197) > > at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:174) > > at > org.springframework.data.hadoop.hbase.HbaseUtils.getHTable(HbaseUtils.java:76) > > ... 6 more > > Caused by: java.lang.reflect.InvocationTargetException > > 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 > org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:409) > > ... 11 more > > Caused by: java.util.ServiceConfigurationError: > org.apache.hadoop.fs.FileSystem: Provider > org.apache.hadoop.hdfs.DistributedFileSystem could not be instantiated > > at java.util.ServiceLoader.fail(ServiceLoader.java:224) > > at java.util.ServiceLoader.access$100(ServiceLoader.java:181) > > at > java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377) > > at java.util.ServiceLoader$1.next(ServiceLoader.java:445) > > at > org.apache.hadoop.fs.FileSystem.loadFileSystems(FileSystem.java:2400) > > at > org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2411) > > at > org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2428) > > at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:88) > > at > org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2467) > > at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449) > > at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367) > > at org.apache.hadoop.fs.Path.getFileSystem(Path.java:287) > > at > org.apache.hadoop.hbase.util.DynamicClassLoader.<init>(DynamicClassLoader.java:104) > > at > org.apache.hadoop.hbase.protobuf.ProtobufUtil.<clinit>(ProtobufUtil.java:202) > > at org.apache.hadoop.hbase.ClusterId.parseFrom(ClusterId.java:64) > > at > org.apache.hadoop.hbase.zookeeper.ZKClusterId.readClusterIdZNode(ZKClusterId.java:69) > > at > org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:83) > > at > org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.retrieveClusterId(HConnectionManager.java:852) > > at > org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:657) > > ... 16 more > > Caused by: java.lang.NoClassDefFoundError: > org/apache/hadoop/conf/Configuration$DeprecationDelta > > at > org.apache.hadoop.hdfs.HdfsConfiguration.addDeprecatedKeys(HdfsConfiguration.java:66) > > at > org.apache.hadoop.hdfs.HdfsConfiguration.<clinit>(HdfsConfiguration.java:31) > > at > org.apache.hadoop.hdfs.DistributedFileSystem.<clinit>(DistributedFileSystem.java:115) > > 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) > > ... 32 more > > Caused by: java.lang.ClassNotFoundException: > org.apache.hadoop.conf.Configuration$DeprecationDelta > > at java.net.URLClassLoader$1.run(URLClassLoader.java:366) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:354) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:425) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:358) > > > > ... 41 more