Weblogic数据源从JNDI树中消失 [英] Weblogic datasource disappears from JNDI tree

查看:130
本文介绍了Weblogic数据源从JNDI树中消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Weblogic版本12C.重现此问题的步骤:-

We are using weblogic version 12C. Steps to reproduce the issue: -

  1. 创建数据源.
  2. 将应用程序部署到weblogic.
  3. 应用程序运行正常.
  4. 用新的耳朵更新部署的耳朵.
  5. 应用程序无法连接数据源.
  6. JNDI树中没有可用的数据源.

我们需要每次创建一个新的数据源,或者再次保存该数据源设置.

We need to create either a new datasource everytime or save the datasource setting again.

有人可以检查一下,让我知道是否知道一些解决方案吗?

Can someone please check and let me know if you know some solution for this?

推荐答案

我遇到了同样的问题.添加destroyMethod ="为我修复了它.

I had the same problem. Adding destroyMethod="" fixed it for me.

显然,如果没有destroyMethod,Spring会尝试确定destroy方法是什么.显然,这导致关闭数据源并从树中删除JNDI密钥.将其更改为"会强制其不要查找destroyMethod.

Apparently if there is no destroyMethod, Spring tries to determine what the destroy method is. This is apparently causing the datasource to be closed and the JNDI key to be removed from the tree. Changing it to "" forces it to not look for a destroyMethod.

@Bean(destroyMethod = "")
public DataSource dataSource() throws NamingException{
    Context context = new InitialContext();
    return (DataSource)context.lookup("jdbc.mydatasource");
}

这篇关于Weblogic数据源从JNDI树中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆