It's not a secret anymore!*
The moose likes BEA/Weblogic and the fly likes JNDI look up problem for JDBC data source in weblogic 10.3.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "JNDI look up problem for JDBC data source in weblogic 10.3.5" Watch "JNDI look up problem for JDBC data source in weblogic 10.3.5" New topic
Author

JNDI look up problem for JDBC data source in weblogic 10.3.5

Prasanna Kulkarni
Greenhorn

Joined: Jan 07, 2004
Posts: 15
Hi,

I'm defining a JDBC datasource in my weblogic(10.3.5) domain with JNDI name "weblogic.xyzDataSource". I have defined this data source from admin console.
When I try to look up this data source from code, I do not get it instead get a naming exception saying

javax.naming.NameNotFoundException: While trying to look up /weblogic.xyzDataSource in myclass.; remaining name '/weblogic/xyzDataSource'

Some surprising things are -

1. When WLS boots up, it shows a message that this datasource is successfully tied to assigned JNDI name with message like -
[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1315572938610> <BEA-001174> <Creating Data Source named xyzDataSource, JNDI Name = weblogic.xyzDataSource>

2. When I do JNDI tree lookup from admin console, I can see this data source in weblogic tree

3. I tried to change jndi name to something like "XYZ" only but still same error.

4. When I test datasource from admin console, it is successful.

5. Same code works with 8.1 (Now my application is migrated successfully to 10.3 except this error )

My JDBC data source XML is as followsReplacing host/user/sid/pwd with real values)

<jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/jdbc-data-source http://xmlns.oracle.com/weblogic/jdbc-data-source/1.0/jdbc-data-source.xsd">
<name>BASPDataSource</name>
<jdbc-driver-params>
<url>jdbcracle:thin:@host:1521:sid</url>
<driver-name>oracle.jdbc.driver.OracleDriver</driver-name>
<properties>
<property>
<name>user</name>
<value>name</value>
</property>
<property>
<name>dll</name>
<value>ocijdbc10</value>
</property>
<property>
<name>server</name>
<value>(description=(address=(host=host)(protocol=tcp)(port=1521))(connect_data=(sid=sid)))</value>
</property>
<property>
<name>protocol</name>
<value>thin</value>
</property>
</properties>
<password-encrypted>pwd</password-encrypted>
</jdbc-driver-params>
<jdbc-connection-pool-params>
<initial-capacity>1</initial-capacity>
<max-capacity>15</max-capacity>
<capacity-increment>1</capacity-increment>
<shrink-frequency-seconds>900</shrink-frequency-seconds>
<highest-num-waiters>2147483647</highest-num-waiters>
<connection-creation-retry-frequency-seconds>0</connection-creation-retry-frequency-seconds>
<connection-reserve-timeout-seconds>10</connection-reserve-timeout-seconds>
<test-frequency-seconds>120</test-frequency-seconds>
<test-connections-on-reserve>false</test-connections-on-reserve>
<ignore-in-use-connections-enabled>true</ignore-in-use-connections-enabled>
<inactive-connection-timeout-seconds>0</inactive-connection-timeout-seconds>
<test-table-name>dual</test-table-name>
<login-delay-seconds>0</login-delay-seconds>
<statement-cache-size>10</statement-cache-size>
<statement-cache-type>LRU</statement-cache-type>
<remove-infected-connections>true</remove-infected-connections>
<seconds-to-trust-an-idle-pool-connection>10</seconds-to-trust-an-idle-pool-connection>
<statement-timeout>-1</statement-timeout>
<pinned-to-thread>false</pinned-to-thread>
<wrap-types>true</wrap-types>
</jdbc-connection-pool-params>
<jdbc-data-source-params>
<jndi-name>weblogic.xyzDataSource</jndi-name>
<row-prefetch>false</row-prefetch>
<stream-chunk-size>256</stream-chunk-size>
<global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
</jdbc-data-source-params>
</jdbc-data-source>

My code to look JNDI name is as follows:



Exception:

javax.naming.NameNotFoundException: While trying to look up /weblogic.xyzDataSource inmyclass.; remaining name '/weblogic/xyzDataSource'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
--------------------------------------------

Please help me, I have searched a lot and tried a lot but it does not work


Thanks !
muralidhar vejendla
Greenhorn

Joined: Sep 11, 2011
Posts: 5
Hi

everything is fine,

check these ...

1)have you save the changes, then Activate the Changes.
2)restart the Server.


i think , the Port no using for J N D I is 1521 and trying to connect 7001 ... check the port nos.

i hope it will work for port nos.

 
GeeCON Prague 2014
 
subject: JNDI look up problem for JDBC data source in weblogic 10.3.5