spring-data-hadoop使用--maven配置详解

这几天一直在纠结spring-data-hadoop的JAR包,总是运行不成功,现在终于可以运行了,pom内容为:


	4.0.0
	winksi.com.cn
	hadoopTest
	0.0.1-SNAPSHOT

	
	
		
			cloudera
			https://repository.cloudera.com/artifactory/cloudera-repos/
		
		
			spring-repo
			http://repo.springsource.org/libs-milestone
		
	
	
		1.6
		UTF-8
		UTF-8
		
		3.2.3.RELEASE
		
		1.0.13
		1.7.5
		
		4.11
		
		2.0.0-cdh4.5.0
		2.0.0-mr1-cdh4.5.0
		1.8.5
	

	
		
		
			org.springframework
			spring-context
			${spring-framework.version}
		
		
			org.springframework
			spring-tx
			${spring-framework.version}
		
		
		
			org.springframework
			spring-jdbc
			${spring-framework.version}
		

		
		
			org.slf4j
			slf4j-api
			${slf4j.version}
			compile
		
		
			ch.qos.logback
			logback-classic
			${logback.version}
			runtime
		

		
		
			org.springframework
			spring-test
			${spring-framework.version}
			test
		
		
			junit
			junit
			${junit.version}
			test
		
		
			com.alibaba
			fastjson
			1.1.37
		

		
		
			org.springframework.data
			spring-data-hadoop
			1.0.2.RELEASE-cdh4
		
		
			org.apache.hadoop
			hadoop-hdfs
			${CDH.version}
		
		
			org.apache.hadoop
			hadoop-core
			${hadoop.core.version}
		
		
			org.codehaus.groovy
			groovy
			${groovy.version}
		
		
			org.apache.hadoop
			hadoop-client
			${CDH.version}
		
		
			org.apache.hive
			hive-service
			0.10.0-cdh4.5.0
		
		
			org.apache.hbase
			hbase
			0.94.6-cdh4.5.0
		
	

主要是红色部分的JAR包

spring配置文件为:



	
	
		fs.default.name=${hd.fs}
		mapred.job.tracker=${hd.mr}
	

	
	
			     
	
		
	
				

	


参数配置文件为:

hd.fs=hdfs://172.16.1.50:8020
hd.mr=172.16.1.50:8021
hd.zk.port=2181
hd.zk.host=172.16.1.50
hive.host=172.16.1.50
hive.port=10000


程序中调用方式:

        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        HiveTemplate hiveTemplate = (HiveTemplate) ac.getBean("hiveTemplate");
        List list = hiveTemplate.query("show tables;");
        System.out.println(JSON.toJSONString(list));

调用成功


你可能感兴趣的:(hadoop,maven)