How to use JNDI DataSource provided by WebLogic 12.2.1 in Spring?

I created a JNDI connection with the following values:

i option selected Generic Data Source

Name : jdbc / sampleDataSource

JNDI Name : jdbc / sampleDataSource

Spring configuration file:

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/sampleDataSource" />

I am getting below the error.

Error An error occurred during activation of changes, please see the log for details.
Error javax.naming.NameNotFoundException: While trying to lookup 'jdbc.sampleDataSource' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/sampleDataSource'
Error While trying to lookup 'jdbc.sampleDataSource' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/sampleDataSource' 

I could not solve it. How to configure in Spring 4. Any additional jar file is required. Please help with this.

+4
source share
1 answer

Sometimes this happens when you forget Targetyour datasourcespecific server. You can find it on the administration server Weblogic:

enter image description here

then on the tab Targets:

enter image description here

.

, datasource applicationContext.xml:

<bean id="dataSource" name="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/mcfsDS"/>
    <property name="resourceRef" value="true"/>
</bean>

dataSource, datasource.

, .

+3

Source: https://habr.com/ru/post/1625824/


All Articles