简体   繁体   English

JNDI失败,并出现javax.naming.NameNotFoundException:在部署Spring Boot2 Tomcat 9时,此上下文未绑定名称[jdbc / Database]

[英]JNDI fails with javax.naming.NameNotFoundException:Name [jdbc/Database] is not bound in this Context when deploying Spring Boot2 Tomcat 9 NO EMBEDDED

When I tried to deploy an spring boot application from STS (eclipse) to a tomcat 9 container (embedded server was turn off excluded from pom) using JNDI it fails with the following message: 当我尝试使用JNDI将Spring Boot应用程序从STS(eclipse)部署到tomcat 9容器(嵌入式服务器已从pom中关闭)时,它失败并显示以下消息:

"javax.naming.NameNotFoundException: Name [jdbc/Database] is not bound in this Context. Unable to find [jdbc]." “ javax.naming.NameNotFoundException:名称[jdbc / Database]在此上下文中未绑定。无法找到[jdbc]。”

I have done a few things trying to solve it, but problem remains: 我已经做了一些尝试解决它的事情,但是问题仍然存在:

My application spring configure is: 我的应用程序春季配置是:

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    application.profiles("production");
    return application.sources(Application.class);
}

public static void main(String[] args) throws Exception {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    builder.headless(false);
    builder.profiles("production");
    builder.web(WebApplicationType.NONE);
    builder.run(args); }

And datasource config is: JNDI Datasource creation source code Image 数据源配置为: JNDI数据源创建源代码Image

I have tried other possible solutions (like creating context.xml in META-INF dir of app) but nothing works until now, same error is raised: Error Image 我尝试了其他可能的解决方案(例如,在应用程序的META-INF目录中创建context.xml),但到目前为止没有任何效果,并且会出现相同的错误: 错误图片

问题是eclipse STS中存在带有配置文件的第三名,并且位于我的环境中:.metadata.plugins \\ org.eclipse.wst.server.core \\ tmp0 \\ conf,我复制context.xml和server.xml配置,例如图像和问题已解决。

暂无
暂无

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

相关问题 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:名称[jdbc / skynetdb]未绑定在此Context中。 找不到[jdbc] - javax.naming.NameNotFoundException: Name [jdbc/skynetdb] is not bound in this Context. Unable to find [jdbc] 自定义SessionListener,此上下文中未绑定名称,javax.naming.NameNotFoundException - Custom SessionListener, name is not bound in this context, javax.naming.NameNotFoundException javax.naming.NameNotFoundException:名称[comp / env]在此上下文中未绑定。 在Tomcat中找不到[comp] - javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp] in Tomcat javax.naming.NameNotFoundException:名称未绑定在此Context中。无法找到 - javax.naming.NameNotFoundException: Name is not bound in this Context. Unable to find 使用JBoss / Spring和NetBeans部署WebAppp时javax.naming.NameNotFoundException - javax.naming.NameNotFoundException when deploying WebAppp with JBoss/Spring and NetBeans Spring Boot构建正常,但抛出javax.naming.NameNotFoundException:剩余名称:运行时的env / jmx / runtime - Spring Boot builds fine but throws javax.naming.NameNotFoundException: remaining name: env/jmx/runtime when running jdbc javax.naming.NameNotFoundException - jdbc javax.naming.NameNotFoundException 名称[ejb:..]未在此上下文中绑定。 无法在Wildfly中找到[ejb:]。]的根本原因javax.naming.NameNotFoundException - Name [ejb:..] is not bound in this Context. Unable to find [ejb: ].] with root cause javax.naming.NameNotFoundException in Wildfly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM