1

org.springframework.beans.factory.BeanCreationException:「hiveServer」という名前のBeanの作成中にエラーが発生しました:initメソッドの呼び出しに失敗しました。ネストされた例外はorg.apache.thrift.transport.TTransportExceptionです:アドレス0.0.0.0/0.0.0.0:10000にServerSocketを作成できませんでした。

4

1 に答える 1

1

構成ファイルの Bean 宣言が不適切である可能性があります。

以下の手順に従うことができます:

  1. 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>
    
  2. hive.properties を作成する

    hive.url=jdbc:hive://localhost:10000/default
    
  3. spring-jdbc jar を追加

  4. Java コードで接続を取得します。

    ApplicationContext ac = new FileSystemXmlApplicationContext("hive-config.xml");
    DataSource dataSource =  (DataSource) ac.getBean("hive-ds");
    Connection con =dataSource.getConnection();
    

hiveServer へのクエリの発行を開始します

于 2013-04-18T09:07:25.797 に答える