Sunday 15 August 2010

java - Not able to intercat with Hbase via spring project -



java - Not able to intercat with Hbase via spring project -

trying since morning , need help going. ubuntu 14.04 64 bit version installed hadoop/hbase latest version. using pseudo-distributed mode.

core-site.xml

<configuration> <property> <name>hadoop.tmp.dir</name> <value>/app/hadoop/tmp</value> <description>a base of operations other temporary directories.</description> </property> <property> <name>fs.default.name</name> <value>hdfs://localhost:54310</value> <description>some text...</description> </property> </configuration>

hdfs-site.xml

<configuration> <property> <name>dfs.replication</name> <value>1</value> <description>default block replication. actual number of replications can specified when file created. default used if replication not specified in create time. </description> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/usr/local/hadoop_store/hdfs/namenode</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/usr/local/hadoop_store/hdfs/datanode</value> </property> </configuration>

hbase-site.xml no explicit zookeeper installation.

<configuration> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.rootdir</name> <value>hdfs://localhost:54310/hbase</value> </property> <property> <name>hbase.zookeeper.quoram</name> <value>localhost</value> </property> <property> <name>hbase.zookeeper.property.clientport</name> <value>2181</value> </property> </configuration>

spring project details -

mvc-config.xml -

<hdp:configuration id="hadoopconfiguration"> fs.default.name=hdfs://localhost:54310 </hdp:configuration> <!-- hbase configuration --> <hdp:hbase-configuration configuration-ref="hadoopconfiguration" zk-quorum="localhost" zk-port="2181" /> <bean id="hbasetemplate" class="org.springframework.data.hadoop.hbase.hbasetemplate"> <property name="configuration" ref="hbaseconfiguration" /> </bean>

dao implementation -

@autowired private hbasetemplate hbasetemplate; private string tablename = "test"; public static byte[] cf_info = bytes.tobytes("cf"); private byte[] quser = bytes.tobytes("a"); private byte[] qemail = bytes.tobytes("email"); public object save(urlmodel urlparam) { final urlmodel url = urlparam; homecoming hbasetemplate.execute(tablename, new tablecallback<object>() { public object dointable(htableinterface table) throws throwable { set p = new put(bytes.tobytes(url.geturl())); p.add(cf_info, quser, bytes.tobytes(url.geturl())); p.add(cf_info, qemail, bytes.tobytes(url.getemail())); table.put(p); homecoming null; } });

jps output -

7785 hmaster 3421 nodemanager 7946 hregionserver 7720 hquorumpeer 3140 secondarynamenode 2803 namenode 3294 resourcemanager 2927 datanode 10647 jps fuser 2181/tcp 2181/tcp: 7720

now problem when nail save button , controller takes save code, nil happens , page keeps loading infinitely. no exception , no info stored.

output bin/hbase zkcli -server localhost:2181

slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. connecting localhost:2181 2014-10-05 17:33:36,172 info [main] zookeeper.zookeeper: client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 gmt 2014-10-05 17:33:36,173 info [main] zookeeper.zookeeper: client environment:host.name=anurag-dev 2014-10-05 17:33:36,173 info [main] zookeeper.zookeeper: client environment:java.version=1.7.0_67 2014-10-05 17:33:36,173 info [main] zookeeper.zookeeper: client environment:java.vendor=oracle corporation 2014-10-05 17:33:36,173 info [main] zookeeper.zookeeper: client environment:java.home=/usr/lib/jvm/java-7-oracle/jre 2014-10-05 17:33:36,173 info [main] zookeeper.zookeeper: client environment:java.class.path=...lots of jars 2014-10-05 17:33:36,174 info [main] zookeeper.zookeeper: client environment:java.library.path=/usr/local/hadoop/lib 2014-10-05 17:33:36,174 info [main] zookeeper.zookeeper: client environment:java.io.tmpdir=/tmp 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:java.compiler=<na> 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:os.name=linux 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:os.arch=amd64 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:os.version=3.13.0-24-generic 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:user.name=hduser 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:user.home=/home/hduser 2014-10-05 17:33:36,175 info [main] zookeeper.zookeeper: client environment:user.dir=/usr/local/hbase 2014-10-05 17:33:36,178 info [main] zookeeper.zookeeper: initiating client connection, connectstring=localhost:2181 sessiontimeout=30000 watcher=org.apache.zookeeper.zookeepermain$mywatcher@438e9e9 welcome zookeeper! 2014-10-05 17:33:36,391 info [main-sendthread(localhost:2181)] zookeeper.clientcnxn: opening socket connection server localhost/127.0.0.1:2181. not effort authenticate using sasl (unknown error) 2014-10-05 17:33:36,559 info [main-sendthread(localhost:2181)] zookeeper.clientcnxn: socket connection established localhost/127.0.0.1:2181, initiating session jline back upwards enabled 2014-10-05 17:33:36,716 info [main-sendthread(localhost:2181)] zookeeper.clientcnxn: session establishment finish on server localhost/127.0.0.1:2181, sessionid = 0x148dfa216b7000c, negotiated timeout = 30000 watcher:: watchedevent state:syncconnected type:none path:null

cat catalina.out

info: loading xml bean definitions class path resource [spring/application-config.xml] oct 05, 2014 5:14:50 pm org.springframework.beans.factory.support.defaultlistablebeanfactory preinstantiatesingletons info: pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@36dfe178: defining beans []; root of mill hierarchy oct 05, 2014 5:14:50 pm org.springframework.web.context.contextloader initwebapplicationcontext info: root webapplicationcontext: initialization completed in 578 ms oct 05, 2014 5:14:50 pm org.springframework.web.servlet.frameworkservlet initservletbean info: frameworkservlet 'dispatcherservlet': initialization started oct 05, 2014 5:14:50 pm org.springframework.context.support.abstractapplicationcontext preparerefresh info: refreshing webapplicationcontext namespace 'dispatcherservlet-servlet': startup date [sun oct 05 17:14:50 ist 2014]; parent: root webapplicationcontext oct 05, 2014 5:14:50 pm org.springframework.beans.factory.xml.xmlbeandefinitionreader loadbeandefinitions info: loading xml bean definitions servletcontext resource [/web-inf/mvc-config.xml] oct 05, 2014 5:14:50 pm org.springframework.context.annotation.classpathscanningcandidatecomponentprovider registerdefaultfilters info: jsr-250 'javax.annotation.managedbean' found , supported component scanning oct 05, 2014 5:14:50 pm org.springframework.context.annotation.classpathscanningcandidatecomponentprovider registerdefaultfilters info: jsr-330 'javax.inject.named' annotation found , supported component scanning oct 05, 2014 5:14:50 pm org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor <init> info: jsr-330 'javax.inject.inject' annotation found , supported autowiring oct 05, 2014 5:14:50 pm org.springframework.beans.factory.support.defaultlistablebeanfactory preinstantiatesingletons info: pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@3a77c2d: defining beans [homecontroller,org.springframework.context.annotation.internalconfigurationannotationprocessor,org.springframework.context.annotation.internalautowiredannotationprocessor,org.springframework.context.annotation.internalrequiredannotationprocessor,org.springframework.context.annotation.internalcommonannotationprocessor,mvccontentnegotiationmanager,org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping#0,org.springframework.format.support.formattingconversionservicefactorybean#0,org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter#0,org.springframework.web.servlet.handler.mappedinterceptor#0,org.springframework.web.servlet.mvc.method.annotation.exceptionhandlerexceptionresolver#0,org.springframework.web.servlet.mvc.annotation.responsestatusexceptionresolver#0,org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver#0,org.springframework.web.servlet.handler.beannameurlhandlermapping,org.springframework.web.servlet.mvc.httprequesthandleradapter,org.springframework.web.servlet.mvc.simplecontrollerhandleradapter,org.springframework.web.servlet.view.internalresourceviewresolver#0,urldao,datasource,hadoopconfiguration,hbaseconfiguration,hbasetemplate,org.springframework.context.annotation.configurationclasspostprocessor.importawareprocessor]; parent: org.springframework.beans.factory.support.defaultlistablebeanfactory@36dfe178 oct 05, 2014 5:14:50 pm org.springframework.jdbc.datasource.drivermanagerdatasource setdriverclassname info: loaded jdbc driver: com.mysql.jdbc.driver oct 05, 2014 5:14:51 pm org.apache.hadoop.conf.configuration warnonceifdeprecated info: fs.default.name deprecated. instead, utilize fs.defaultfs oct 05, 2014 5:14:51 pm org.springframework.data.hadoop.hbase.hbaseconfigurationfactorybean setstopproxy warning: utilize of 'stopproxy' has been deprecated oct 05, 2014 5:14:51 pm org.apache.hadoop.conf.configuration warnonceifdeprecated info: fs.default.name deprecated. instead, utilize fs.defaultfs oct 05, 2014 5:14:51 pm org.springframework.web.servlet.handler.abstracthandlermethodmapping registerhandlermethod info: mapped "{[/showmessage.html],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.modelandview com.data.hello.controller.homecontroller.showaddurlpage(org.springframework.web.servlet.modelandview) throws java.io.ioexception oct 05, 2014 5:14:51 pm org.springframework.web.servlet.handler.abstracthandlermethodmapping registerhandlermethod info: mapped "{[/saveurl],methods=[post],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.modelandview com.data.hello.controller.homecontroller.actionaddurl(com.data.hello.model.urlmodel,org.springframework.web.servlet.modelandview) oct 05, 2014 5:14:51 pm org.springframework.web.servlet.frameworkservlet initservletbean info: frameworkservlet 'dispatcherservlet': initialization completed in 1495 ms oct 05, 2014 5:14:51 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory /var/lib/tomcat7/webapps/root oct 05, 2014 5:14:52 pm org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-bio-8080"] oct 05, 2014 5:14:52 pm org.apache.catalina.startup.catalina start info: server startup in 23851 ms oct 05, 2014 5:14:53 pm org.apache.hadoop.util.nativecodeloader <clinit> warning: unable load native-hadoop library platform... using builtin-java classes applicable info zookeeper - client environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 gmt info zookeeper - client environment:host.name=anurag-dev info zookeeper - client environment:java.version=1.7.0_65 info zookeeper - client environment:java.vendor=oracle corporation info zookeeper - client environment:java.home=/usr/lib/jvm/java-7-openjdk-amd64/jre info zookeeper - client environment:java.class.path=/usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar info zookeeper - client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib info zookeeper - client environment:java.io.tmpdir=/tmp/tomcat7-tomcat7-tmp info zookeeper - client environment:java.compiler=<na> info zookeeper - client environment:os.name=linux info zookeeper - client environment:os.arch=amd64 info zookeeper - client environment:os.version=3.13.0-24-generic info zookeeper - client environment:user.name=tomcat7 info zookeeper - client environment:user.home=/usr/share/tomcat7 info zookeeper - client environment:user.dir=/var/lib/tomcat7 info zookeeper - initiating client connection, connectstring=localhost:2181 sessiontimeout=180000 watcher=hconnection info clientcnxn - opening socket connection server /127.0.0.1:2181 oct 05, 2014 5:14:53 pm org.apache.hadoop.hbase.zookeeper.recoverablezookeeper <init> info: identifier of process 10244@anurag-dev info zookeepersaslclient - client not sasl-authenticate because default jaas configuration section 'client' not found. if not using sasl, may ignore this. on other hand, if expected sasl work, please prepare jaas configuration. info clientcnxn - socket connection established localhost/127.0.0.1:2181, initiating session info clientcnxn - session establishment finish on server localhost/127.0.0.1:2181, sessionid = 0x148dfa216b7000a, negotiated timeout = 90000

pom.xml

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.springframework.samples.service.service</groupid> <artifactid>datahello</artifactid> <version>0.0.1-snapshot</version> <packaging>war</packaging> <properties> <!-- generic properties --> <java.version>1.6</java.version> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <!-- web --> <jsp.version>2.2</jsp.version> <jstl.version>1.2</jstl.version> <servlet.version>2.5</servlet.version> <!-- spring --> <spring-framework.version>3.2.3.release</spring-framework.version> <!-- hibernate / jpa --> <hibernate.version>4.2.1.final</hibernate.version> <!-- logging --> <logback.version>1.0.13</logback.version> <slf4j.version>1.7.5</slf4j.version> <!-- test --> <junit.version>4.11</junit.version> <!-- hadoop/hbase --> <spring.hadoop.version>2.0.2.release</spring.hadoop.version> <hadoop.version>1.2.1</hadoop.version> <hbase.version>0.92.1</hbase.version> </properties> <dependencies> <!-- spring mvc --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>${spring-framework.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>${spring-framework.version}</version> </dependency> <!-- hadoop habse --> <dependency> <groupid>org.springframework.data</groupid> <artifactid>spring-data-hadoop</artifactid> <version>${spring.hadoop.version}</version> <exclusions> <exclusion> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> </exclusion> <exclusion> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-core</artifactid> <version>${hadoop.version}</version> <scope>compile</scope> </dependency> <dependency> <groupid>org.apache.hbase</groupid> <artifactid>hbase</artifactid> <version>${hbase.version}</version> <scope>compile</scope> <exclusions> <exclusion> <groupid>log4j</groupid> <artifactid>log4j</artifactid> </exclusion> <exclusion> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> </exclusion> </exclusions> </dependency> <!-- other web dependencies --> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>${jstl.version}</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>${servlet.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet.jsp</groupid> <artifactid>jsp-api</artifactid> <version>${jsp.version}</version> <scope>provided</scope> </dependency> <!-- spring , transactions --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> <version>${spring-framework.version}</version> </dependency> <!-- logging slf4j & logback --> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>${slf4j.version}</version> <scope>compile</scope> </dependency> <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>${logback.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.30</version> </dependency> <!-- hibernate --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>${hibernate.version}</version> </dependency> <!-- test artifacts --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-test</artifactid> <version>${spring-framework.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>${junit.version}</version> <scope>test</scope> </dependency> </dependencies> </project>

please allow me know if sharing else solve purpose.

any infor here appreciable.

-aj

java spring spring-mvc hadoop hbase

No comments:

Post a Comment