title: Spring boot WebLogic 12c Jndi Datasource
body: <p>I'm deploying a Spring boot application on WebLogic 12c.</p>
  
  <p>Without Jndi datasource all works fine.
  I tried to configure on WebLogic a datasource with name "jdbc/MyDataSource" and on my application I setted the propertie like that:</p>
  
  <pre><code>spring.datasource.jndi-name=jdbc/MyDataSource
  </code></pre>
  
  <p>But, when I deploy my web app I receive the following error:</p>
  
  <blockquote>
    <p>weblogic.application.ModuleException:
    javax.naming.NameNotFoundException: While trying to lookup
    'jdbc.MyDataSource' didn't find subcontext 'jdbc'. Resolved '';
    remaining name 'jdbc/MyDataSource'</p>
  </blockquote>
  
  <p>I tried also the following properties configuration without success:</p>
  
  <pre><code>spring.datasource.jndi-name=java:comp/env/jdbc/MyDataSource
  
  spring.datasource.jndi-name=java:/jdbc/MyDataSource
  
  spring.datasource.jndi-name=java:jdbc/MyDataSource
  </code></pre>
  
  <p>My maven configuration:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.0.2.RELEASE&lt;/version&gt;
      &lt;relativePath /&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>My Spring App Configuration:</p>
  
  <pre><code>@EnableSwagger2
  
  @ComponentScan({ "com.ws.repository", "com.ws.service", "com.ws.controller" })
  
  @EntityScan("com.ws.entity")
  
  @EnableJpaRepositories(basePackages = "com.ws.repository")
  
  public class MyServiceApplication {
  ...
  }
  </code></pre>
  
  <p>Expected:</p>
  
  <p>I want to use the same jndi datasource because I want to deploy many services that use just one datasource</p>