It's not a secret anymore!*
The moose likes Websphere and the fly likes WSAD 5.0.1 JNDI Lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "WSAD 5.0.1 JNDI Lookup" Watch "WSAD 5.0.1 JNDI Lookup" New topic
Author

WSAD 5.0.1 JNDI Lookup

Rajan Vashisht
Greenhorn

Joined: Jun 06, 2002
Posts: 2
Hi,
I am trying to do jndi look up a datasource which is created and tested from Websphere Administration Console. Here is the test client.
/**
* @author crvashi
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.ConnectionEvent;
import java.util.*;
public class Test1 {
public static void main(String[] args) {
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
Context initialContext = new InitialContext(env);
javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("ContractDS");
}
catch(Exception e) {
e.printStackTrace();
}

}
}
But when i run this class as an application it gives an error. The stack trace is :
javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "ContractDS" failed. Please get the root cause Throwable contained in this NamingException for more information. Root exception is java.lang.IncompatibleClassChangeError: class com.ibm.ejs.jts.jts.CurrentSet does not implement interface org.omg.CosTransactions.CurrentOperations
at com.ibm.ws.naming.jndicos.CNContextImpl.suspendTransaction(CNContextImpl.java:4070)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3521)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1565)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1525)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1225)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:45)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:153)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at com.bunge.bgm.common.domain.BrokerMain.configure(BrokerMain.java:20)
at com.bunge.bgm.common.domain.BrokerMain.main(BrokerMain.java:155)
rethrown as net.sf.hibernate.HibernateException: Could not find datasource: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "ContractDS" failed. Please get the root cause Throwable contained in this NamingException for more information.
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:49)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:153)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at com.bunge.bgm.common.domain.BrokerMain.configure(BrokerMain.java:20)
at com.bunge.bgm.common.domain.BrokerMain.main(BrokerMain.java:155)
Please reply if someone has fixed this problem.
Thanks in advance.
Ramakrishnan thiyagarajan
Ranch Hand

Joined: Oct 07, 2003
Posts: 57
hai,
u dont identify the JNDIlookup.np problem. once u deployed ur project
in the j2ee hierarchy and u open .xmi file.actually xmi file mention the jndi lookup name.
Ramakrishnan.T
Bene Ged
Greenhorn

Joined: Jan 25, 2005
Posts: 1
Hi Rajan!

Have you solved this problem?
I have the same error and I can't find out how to solve it.
 
jQuery in Action, 2nd edition
 
subject: WSAD 5.0.1 JNDI Lookup
 
Similar Threads
In which jar the CurrentFactory is found?
WSAD error while running Hibernate
Hibernate error on using it with WSAD
Exception while Lookup for JNDI Name
remote ejb client with websphere