WebSphere Portal Server - JNDI Lookup Portal problem

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > February 2007 > JNDI Lookup Portal problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author JNDI Lookup Portal problem

2007-02-23, 1:22 am

I have used the following code in Web Application in WebSphere
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/api");
Connection conn = ds.getConnection();
out.println(conn.getCatalog());
} catch (Exception exp) {

}
and it works but If I execute the same code in doView() method of JSR168 portlet, It gives me an exception
javax.naming.NameNotFoundException: jdbc/api. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound

can anybody suggest me what should be done to get over this problem

Thank you

2007-02-23, 7:22 am


I'll answer it by making some assumptions (you're using WAS 6.x and you previously added it only as an application in server1).


Seeing that you use the global jndi instead of 'java:comp/env/jdbc' my firsthand guess would be to check if the datasource itself is added to the WebSphere_Portal Application server.


If you're using RAD and added a server configuration for WPS 6.0 you could use the test cient to see if the JNDI are available for it.

/Jonas V
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com