Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ORACLE XA DataSource Problem in WebSphere 5.1

 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Have you guys faced this problem earlier. I am trying to retrieve datasource connection but it is giving error.

I have tryed these ways:

java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
Context jndi = new InitialContext(parms); DataSource ds=(DataSource) jndi.lookup(strDataSourceName);
objConn = ds.getConnection();

and

Context jndi = new InitialContext();
DataSource ds=(DataSource) jndi.lookup(strDataSourceName);
objConn = ds.getConnection();

Error Description

NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.java.javaURLContextRoot
Context method: list(Name)
Context name: java:
Target name: comp/env/jdbc/ORADS
Other data:
Exception stack trace: javax.naming.NotContextException: The object bound under the name "comp/env/jdbc/ORADS" is not a context


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghuveer,
Are you using WSAD or WebSphere App Server? Can you view the DataSource in the JNDI through the Universal Test Client's JNDI explorer (if WSAD) or the admin console (if WebSphere) ? Does the server start up clean? Does it output a line about the DataSource?
 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne for reply.

I am using WebSphere App Server.
yeah, Server Starts Up Properly.
I am able to see Data Source properties. Test Connection is successful.

Earlier there was a problem as there were two data source with same name but with case difference under same Node.

e.g.
DataSource Name: OracleDS
JNDI Name: jndi/OraDS
and
DataSource Name: oracleDS
JNDI Name: jndi/oraDS

Is this a probem? I was getting a configuration error saying that we can not define two Data Sources Under Same Node.

I changed the name of Data Sources and jndi names but still I am getting the same error as mentioned earlier.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghuveer,
Having datasources that only differ in case would be a problem.

Is "jndi/oraDS" exactly what you have in the JNDI? It should be "jdbc/oraDS" to match how you are calling it.
 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
I am sorry I did not check...
my Jndi Name for Data Source were jdbc/OraDS and jdbc/oraDS.

But now I have changes the name but still it is giving same problem.
I also have doubt about full datasource path.

Could please clarify what one should pass in lookup.

Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/OraDS");

or

DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/OraDS");


What is the difference between two approaches?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic