我需要在 HANA 云中部署基于 Spring 的 Java 应用程序,我无法获取数据源给出错误
2016 05 17 14:33:45#INFO#LJS_OUTPUT#Thread-11#14:33:45.128 [localhost-startStop-1] ERROR c.s.c.r.k.p.client.PersistenceDataSourceFactory - An exception occurred during rest communication with local config service: java.io.FileNotFoundException: http://localhost:20002/config/v1/services/persistence/jdbc/someothername|
2016 05 17 14:33:45#INFO#LJS_OUTPUT#Thread-11#14:33:45.129 [localhost-startStop-1] ERROR c.s.c.r.k.p.client.PersistenceDataSourceFactory - Retrieved persistence properties are null!|
这是数据源配置详细信息
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/someothername</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
</resource-ref>
我尝试了 JNDI Lookup
@Bean
public DataSource getDataSource() {
final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
dsLookup.setResourceRef(true);
DataSource dataSource = dsLookup.getDataSource("jdbc/someothername");
return dataSource;
}
我直接累了
@Resource
DataSource dataSource
并且
@Resource("jdbc/someothername")
DataSource dataSource
帮我解决这个问题
谢谢 Chiranjeevi GK