gpt4 book ai didi

spring - 捕获 Spring 上下文关闭错误

转载 作者:行者123 更新时间:2023-12-02 11:53:46 27 4
gpt4 key购买 nike

我有一个使用 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>

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

o.a.h.hbase.client.HConnectionManager : Connection not found in the list, can't delete it (connection key=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='xyz@PQR.COM'}). May be the key was modified?

据我了解,这是一个无害的错误,即使在 Hadoop 1.x 中也会抛出

我已迁移到 Hadoop 2.x 和 Spring-Hadoop-2.0.4但是现在,spring 抛出了一个之前没有抛出的异常,

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) at org.springframework.data.hadoop.hbase.HbaseConfigurationFactoryBean.destroy(HbaseConfigurationFactoryBean.java:80) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:258) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:907) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:914) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908) at 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.ThreadPoolTaskExecutor : Shutting down ExecutorService 2015-01-22 14:58:20.170 INFO --- [ Thread-11] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' 2015-01-22 14:58:20.175 INFO --- [ Thread-2] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

问题,如何捕获此错误,使其不显示给用户...

感谢您的见解。

最佳答案

只需将删除连接设置为 false(默认为“true”),我就能够解决该错误

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

关于spring - 捕获 Spring 上下文关闭错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28111809/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com