Unable to access weblogic datasource from java with prefix jdbc/

raoul.nair picture raoul.nair · Sep 6, 2013 · Viewed 37.2k times · Source

I have created two datasource in weblogic with below jndi names

  • jdbc/testDatasource
  • testDatasource1

I am able to access datasource testDatasource1 using java but while access dataource jdbc/testDatasource i am getting below mention error

javax.naming.NameNotFoundException: While trying to lookup 'jdbc.testDatasource' didn't find subcontext 'jdbc'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jdbc.testDatasource' didn't find subcontext 'jdbc'. Resolved '']; remaining name 'jdbc/testDatasource'

it seem that prefix jdbc/ is giving problem.

Answer

bvhoang picture bvhoang · Apr 17, 2014

In some cases, it is caused by the datasource not in the same target with your servers. The servers that are using the datasource should be added to the same targets.