sudheer babu

Greenhorn
+ Follow
since May 29, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sudheer babu

can i know how can we pass the control from one web page to other in servlets, by making use of just the xml and not using any of urlrewriting, forwards, includes..?
Thanks in advance...
16 years ago
hi,
did you check whether the class name you have given for the intial context is the same as you have provided. also check whether that class file is provided in the class directory.
if all these are correct, then better check for the web.xml file for the context variable.
hope you will find the solution in one of these...
16 years ago

Originally posted by Harikrishna kishore Harkala:
When Iam writing code like given below for datasource access using JNDI

public class DataSourceJNDI {

public static void main(String[] args)throws SQLException,NamingException {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("jdbc/CMPDS");
Connection con=ds.getConnection();
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT NAME,ID,DEPT FROM EMPLOY");
String name=rs.getString("NAME");
String id=rs.getString("ID");
String dept=rs.getString("DEPT");
System.out.println(name);
System.out.println(dept);
System.out.println(id);

}
}
I am getting aruntime exception like this:
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java:562)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java:494)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:60)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:257)
at javax.naming.InitialContext.init(InitialContext.java:233)
at javax.naming.InitialContext.<init>(InitialContext.java:209)
at Ray.DataSourceJNDI.main(DataSourceJNDI.java:25)

Please any one can help me?

16 years ago
hi, you can specify the context path in he "web.xml" file in order to use the class under the server mappings tag. hope it will solve your problem.
16 years ago
i faced an interview question: is there any difference in jdk versions supported in websphere5.x & websphere6.x?
16 years ago
iam new to websphere. so i don't know the commands in diferent environments to deploy applications & changing username & passwords?
16 years ago