I created a JNDI connection with the following Values:
i selected Generic Data Source
option
Name: jdbc/sampleDataSource
JNDI Name: jdbc/sampleDataSource
Spring Config File:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/sampleDataSource" />
I'm getting below 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 was unable to resolve it. How do i configure in Spring 4. Any addition jar file is required. Please help on this.
JNDI provides a common-denominator interface to many existing naming services, such as LDAP (Lightweight Directory Access Protocol) and DNS (Domain Name System). These naming services maintain a set of bindings, which relate names to objects and provide the ability to look up objects by name.
JPA Configuration – Model, DAO and Service. With this, you have everything you need in order to use your JNDI datasource in your Spring application.
Sometimes this happens when you forget to Target
your defined datasource
to a specific server. You can find it in Weblogic
's administration server :
then in the Targets
tab:
you should select the target.
If that wasn't the problem, you may try the way of getting your datasource
in the applicationContext.xml
:
<bean id="dataSource" name="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/mcdsDS"/>
<property name="resourceRef" value="true"/>
</bean>
And use the dataSource reference wherever you need a datasource
.
Hope this would be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With