0
votes

I'm trying to setup a datasource on websphere-liberty:springBoot2 docker image. I'm shared a war file and a server.xml file that contains a jdni definition

<dataSource id="oracle" jndiName="jdbc/oracle">
    <jdbcDriver libraryRef="OracleLib"/>
    <properties ....... />
</dataSource>

The war file has the bean definition:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/oracle"/>
    <property name="lookupOnStartup" value="false"/>
    <property name="cache" value="true" />
    <property name="proxyInterface"  value="javax.sql.DataSource" />
</bean>

But the next error stack appears:

Invocation of init method failed; nested exception is org.springframework.jndi.JndiLookupFailureException: 
JndiObjectTargetSource failed to obtain new target object; 
nested exception is javax.naming.NamingException: 
CWWKE0800W: An attempt was made to retrieve an initial context for [jdbc/oracle] but no JNDI feature is configured.

I'm shared both the server.xml and the ojdbc8.jar, to container. Thanks in advance.

1

1 Answers

3
votes

You need to enable the JNDI feature by adding <feature>jndi-1.0</feature> to the <featureManager> element of your server.xml And you probably want to use the Oracle specific config element properties.oracle not the generic driver config element properties