简体   繁体   English

Weblogic 异常:javax.naming.NameNotFoundException:无法解析“jdbc.payment”。 解决了'jdbc'; 剩余名称“付款”

[英]Weblogic exception : javax.naming.NameNotFoundException: Unable to resolve 'jdbc.payment'. Resolved 'jdbc'; remaining name 'payment'

I have this exception when I lookup jndi datasource from weblogic from spring boot application... only after one successful deployment ...I mean from the second deployment on.If I restart the container, it will work fine for the first deployment only.当我从 Spring Boot 应用程序中的 weblogic 中查找 jndi 数据源时,我遇到了这个异常……只有在一次成功部署之后……我的意思是从第二次部署开始。如果我重新启动容器,它只会在第一次部署时正常工作。

Caused by: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.payment'.引起:javax.naming.NameNotFoundException:无法解析“jdbc.payment”。 Resolved 'jdbc';解决了'jdbc'; remaining name 'payment'剩余名称“付款”

the datasource with the same name and attached to the admin server.具有相同名称并附加到管理服务器的数据源。

I use docker image : store/oracle/weblogic:12.2.1.4-dev with environment variable PRODUCTION_MODE=dev我使用 docker 镜像:store/oracle/weblogic:12.2.1.4-dev 和环境变量PRODUCTION_MODE=dev

update : if I deattach the data source from the server then reattche it again then start the war, It runs successfully for one time againز更新:如果我从服务器上断开数据源然后重新连接它然后开始战争,它再次成功运行一次Ò

update : switched to local installation of weblogic not dockerized any more and the behavior still happens更新:切换到本地安装的 weblogic 不再 dockerized 并且该行为仍然发生

It's a spring issue...has nothing to do with weblogic.这是一个春季问题......与weblogic无关。

In the war shutdown, Spring remove the data source form the server JNDI tree, however the data source still up and running on the server.在战争关闭时,Spring 从服务器 JNDI 树中删除数据源,但数据源仍然在服务器上运行。 The action of recreating or even reattaching the data source to target server, add it again to the JNDI tree.重新创建甚至将数据源重新附加到目标服务器的操作,将其再次添加到 JNDI 树中。

The workaround to solve this behavior is to prevent spring from calling the destroy method of the data source bean解决此行为的方法是防止spring调用数据源bean的destroy方法

@Primary
@Bean(name = "dataSource",destroyMethod = "")
@Profile("weblogic")
public DataSource dataSourceWeblogic() throws NamingException {

        JndiTemplate jndiTemplate = new JndiTemplate();
        InitialContext ctx = (InitialContext) jndiTemplate.getContext();
        return  (javax.sql.DataSource) ctx.lookup(jndi);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 引起原因:javax.naming.NameNotFoundException; 剩余名称“ env / jdbc / PSC” - Caused by: javax.naming.NameNotFoundException; remaining name 'env/jdbc/PSC' jdbc javax.naming.NameNotFoundException - jdbc javax.naming.NameNotFoundException javax.naming.NameNotFoundException:名称[jdbc / skynetdb]未绑定在此Context中。 找不到[jdbc] - javax.naming.NameNotFoundException: Name [jdbc/skynetdb] is not bound in this Context. Unable to find [jdbc] javax.naming.NameNotFoundException:无法解析“MyDB”。 已解决“”Weblogic 12.1.3。 c - javax.naming.NameNotFoundException: Unable to resolve 'MyDB'. Resolved '' Weblogic 12.1.3. c javax.naming.NameNotFoundException:名称[jdbc / spitterDS]未绑定在此Context中。找不到[jdbc] - javax.naming.NameNotFoundException: Name [jdbc/spitterDS] is not bound in this Context. Unable to find [jdbc] javax.naming.NameNotFoundException:名称[jdbc / rhwebDB]未绑定在此Context中。找不到[jdbc] - javax.naming.NameNotFoundException: Name [jdbc/rhwebDB] is not bound in this Context. Unable to find [jdbc] 根异常是 javax.naming.NameNotFoundException: Name jdbc not found in context "java:comp/env" - Root exception is javax.naming.NameNotFoundException: Name jdbc not found in context "java:comp/env" Jetty mysql连接池配置错误:javax.naming.NameNotFoundException; 剩余名称'env / jdbc / ---(mysql 5.0 + jetty 7.0.1) - Jetty mysql connection-pool configuration error: javax.naming.NameNotFoundException; remaining name 'env/jdbc/---(mysql 5.0+jetty 7.0.1) 异常:weblogic.application.ModuleException:javax.naming.NameNotFoundException - Exception :weblogic.application.ModuleException: javax.naming.NameNotFoundException 如何解决线程“ main”中的异常javax.naming.NameNotFoundException:未绑定? - How to resolve exception in thread “main” javax.naming.NameNotFoundException: not bound?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM