陷阱Spring上下文关闭错误

时间:2015-01-23 14:13:44

标签: spring hbase spring-data-hadoop

我有一个使用spring-hadoop的spring集成项目。 我有一个Hbase模板,如下所示,

<beans:bean id="fsh" class="org.springframework.data.hadoop.fs.FsShell">
</beans:bean>

<beans:bean id="hbaseTemplate"  
   class="org.springframework.data.hadoop.hbase.HbaseTemplate">
    <beans:property name="configuration" ref="hdpConfiguration" />
</beans:bean>

现在,当我关闭应用程序和最后的上下文时,它会抛出一个奇怪的错误,

  

oahhbase.client.HConnectionManager:列表中找不到连接,无法删除它(连接密钥= HConnectionKey {properties = {hbase.zookeeper.quorum = xxx.com,xxx.com,hbase.rpc .timeout = 60000,hbase.client.prefetch.limit = 10,hbase.zookeeper.property.clientPort = 2181,zookeeper.znode.parent = / hbase-secure,hbase.client.retries.number = 35,hbase.client。 pause = 100},username =&#39; xyz@PQR.COM'})。可能是关键被修改了吗?

据我了解,这是一个无害的错误,甚至在Hadoop 1.x中也被抛出

我已迁移到Hadoop 2.x和Spring-Hadoop-2.0.4 但是现在,春天抛出一个早先没被抛出的例外,

  

java.lang.Exception:null                   at org.apache.hadoop.hbase.client.HConnectionManager.deleteConnection(HConnectionManager.java:488)                   at org.apache.hadoop.hbase.client.HConnectionManager.deleteConnection(HConnectionManager.java:424)                   在org.springframework.data.hadoop.hbase.HbaseConfigurationFactoryBean.destroy(HbaseConfigurationFactoryBean.java:80)                   在org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:258)                   在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)                   在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)                   在org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:907)                   在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)                   在org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:914)                   在org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)                   在org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)                   at org.springframework.context.support.AbstractApplicationContext $ 1.run(AbstractApplicationContext.java:804)   2015-01-22 14:58:20.168 INFO --- [Thread-11] o.s.s.concurrent.ThreadPoolTask​​Executor:关闭ExecutorService   2015-01-22 14:58:20.170 INFO --- [Thread-11] o.s.s.c.ThreadPoolTask​​Scheduler:关闭ExecutorService&#39; taskScheduler&#39;   2015-01-22 14:58:20.175 INFO --- [Thread-2] j.LocalContainerEntityManagerFactoryBean:关闭持久性单元的JPA EntityManagerFactory&#39;默认&#39;

问题,如何捕获此错误,以便它不会向用户显示...

感谢您的任何见解。

1 个答案:

答案 0 :(得分:4)

我能够解决错误,只需将delete-connection设置为false,(默认为'true')

<hbase-configuration configration-ref="hdpConfiguration" delete-connection="false"/>