I’m trying to deploy a spring boot application on weblogic 12c but i get this error:
javax.naming.NameNotFoundException: Unable to resolve 'jdbc.DS_NMR_MDJS_eng'. Resolved 'jdbc'; remaining name 'DS_NMR_MDJS_eng'
The Datasource and the application are running on the same cluster, what i can’t undestand is why do i get the dot between my jdbc and the name when i have the / in the code, I also tried different code like using:
DataSource ds1 = (DataSource) ctx.lookup(
and
JndiDataSourceLookup lookup = new JndiDataSourceLookup();
return lookup.getDataSource("jdbc/DS_NMR_MDJS_eng");
@Bean(destroyMethod = "")
@Primary
// @ConfigurationProperties(prefix = "datasource.datasource-nmr-wl")
public DataSource nmrDataSource() throws NamingException {
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
bean.setJndiName("jdbc/DS_NMR_MDJS_eng");
bean.setProxyInterface(DataSource.class);
bean.setLookupOnStartup(false);
bean.afterPropertiesSet();
try {
bean.afterPropertiesSet();
} catch (Exception e) {
throw new IllegalArgumentException("Failed to lookup JNDI DataSource: "+ nmrDS, e);
}
return (DataSource) bean.getObject();
}
@Bean(destroyMethod = "")
// @ConfigurationProperties(prefix = "datasource.datasource-dwh-wl")
public DataSource dwhDataSource() throws NamingException {
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
bean.setJndiName(dwhDS);
bean.setProxyInterface(DataSource.class);
bean.setLookupOnStartup(false);
bean.afterPropertiesSet();
try {
bean.afterPropertiesSet();
} catch (Exception e) {
throw new IllegalArgumentException("Failed to lookup JNDI DataSource:" +dwhDS, e);
}
return (DataSource) bean.getObject();
}
@Bean
@Primary
public NamedParameterJdbcTemplate nmrJdbcTemplate(@Qualifier("nmrDataSource") DataSource nmrDataSource) {
return new NamedParameterJdbcTemplate(nmrDataSource);
}
@Bean
public NamedParameterJdbcTemplate dwhJdbcTemplate(@Qualifier("dwhDataSource") DataSource dwhDataSource) {
return new NamedParameterJdbcTemplate(dwhDataSource);
}
the app to find the ds