Reputation: 191
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hiveServer': Invocation of init method failed; nested exception is org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:10000.
Upvotes: 1
Views: 713
Reputation: 1339
May be improper bean declaration in config file.
You can follow below mentioned steps :
create hive-config.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="hive.properties"/>
<bean id="hive-driver" class="org.apache.hadoop.hive.jdbc.HiveDriver"/>
<bean id="hive-ds" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"
c:driver-ref="hive-driver" c:url="${hive.url}"/>
</beans>
create hive.properties
hive.url=jdbc:hive://localhost:10000/default
add spring-jdbc jar
get connection in java code.
ApplicationContext ac = new FileSystemXmlApplicationContext("hive-config.xml");
DataSource dataSource = (DataSource) ac.getBean("hive-ds");
Connection con =dataSource.getConnection();
and start firing your queries to hiveServer
Upvotes: 1