Reputation: 123
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:
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
Upvotes: 0
Views: 1401
Reputation: 123
Problem was a THIRD place with configuration files in eclipse STS exists and is located in my environment at: .metadata.plugins\org.eclipse.wst.server.core\tmp0\conf , I copy context.xml and server.xml configuration like the images and problem was solved.
Upvotes: 0