Spring boot JNDI datasource lookup failure - Name comp/env/jdbc not found in context “java:”

前端 未结 4 1174
北海茫月
北海茫月 2020-12-10 16:28

I have setup a spring boot (v 1.1.9) application to deploy as a WAR file. And I\'m trying to integrate this web application with an existing data service module (added as a

4条回答
  •  借酒劲吻你
    2020-12-10 16:47

    I am facing the same problem. I don't know how to define tag in spring boot since there is no web.xml file in the spring boot.

    So far what I came to know that we have to define it in the application file from where we start our spring application. I think we need to use this method to set the Datasource:

      @Bean(destroyMethod="")
      @ConfigurationProperties(prefix="datasource.mine")
      public DataSource dataSource() throws Exception {
          JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
          return dataSourceLookup.getDataSource("java:jdbc/configurationFile");
      }
    

提交回复
热议问题