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:
"javax.naming.NameNotFoundException: Name [jdbc/Database] is not bound in this Context. Unable to find [jdbc]."
I have done a few things trying to solve it, but problem remains:
- Configure server.xml and context.xml at tomcat/config dir and Server/Tomcat-... in eclipse workspace with the following: Configuration Tomcat (Eclipse and Server configs Image)
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
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