I have configured one admin server: adminServer, and one manged
server: myServer, and I have the following in my config.xml
<JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
InitialCapacity="2" MaxCapacity="10" Name="myPool"
Password="{3DES}6rtaQWzgnegkG3KD61h6RQ=="
Properties="user=my_admin;enabled=true;dll=ocijdbc8;protocol=thin"
Targets="myServer"
URL="jdbc:oracle:thin:@ling:1526:infns200"/>
<JDBCTxDataSource EnableTwoPhaseCommit="true"
JNDIName="MyDataSource" Name="MyDataSource" PoolName="myPool"
RowPrefetchEnabled="true" Targets="myServer"/>
And I have the following in my client code:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://lishang:17771");
props.put(Context.SECURITY_PRINCIPAL, "system");
props.put(Context.SECURITY_CREDENTIALS, "weblogic");
InitialContext ctx1 = new InitialContext(props);
DataSource ds = (DataSource)ctx1.lookup("MyDataSource");
However, I keep getting exceptions as follows:
javax.naming.NameNotFoundException: Unable to resolve 'MyDataSource'
Resolved: '' Unresolved:'MyDataSource' ; remaining name 'MyDataSource'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown
Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at UpdateMonitor.getDBConnection(UpdateMonitor.java:83)
at UpdateMonitor.main(UpdateMonitor.java:146)