my dog learned polymorphism*
The moose likes Websphere and the fly likes ORACLE XA DataSource Problem in WebSphere 5.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "ORACLE XA DataSource Problem in WebSphere 5.1 " Watch "ORACLE XA DataSource Problem in WebSphere 5.1 " New topic
Author

ORACLE XA DataSource Problem in WebSphere 5.1

Raghuveer Rawat
Ranch Hand

Joined: Apr 03, 2003
Posts: 102
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




Raghuveer Rawat<br />SCJP2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Raghuveer Rawat
Ranch Hand

Joined: Apr 03, 2003
Posts: 102
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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

Joined: Apr 03, 2003
Posts: 102
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ORACLE XA DataSource Problem in WebSphere 5.1
 
Similar Threads
MSAccess and Tomcat JNDI Configuration
Connection Pool in WebSphere
WebSphere - DB2 DataSource Connection Problem
Datasource JNDI Lookup in WSAD from standalone app
Cannot create PoolableConnectionFactory