NoinitialContextException

I am trying to build up client usng applet with JBOSS server.I am getting runtime Exception ........

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

If I use browser then only giving Exception.If I run client using appletviewer then it is not giving any error.It's worked properly.

Code.........

public boolean dataRetrive(String uname,String passwd){

boolean flag=false;

try{

Tb_User user=new Tb_User(uname,passwd);

Configuration cfg=new Configuration();

//cfg.configure("\\META-INF\\hibernate.cfg.xml");

cfg.configure(new File(System.getProperties().getProperty("sun.boot.library.path")+"\\hibernate.cfg.xml"));

SessionFactory sessionFactory=cfg.buildSessionFactory();

System.out.println("session created");

Session session=sessionFactory.openSession();

Transaction tx=session.beginTransaction();

System.out.println("nvbn");

Query q=session.createQuery("select user.user_name,user.pwd from Tb_User user");

Iterator iter=q.iterate();

System.out.print(iter.hasNext());

while (iter.hasNext()) {

System.out.println("popop");

user = (Tb_User)iter.next();

System.out.println(user.getuser_name());

System.out.println(user.getpwd());

if(uname.equals(user.getuser_name())&&passwd.equals(user.getpwd()))

flag=true;

}

tx.commit();

session.flush();

session.close();

}catch(Exception e){

e.printStackTrace();

}

return flag;

}

}

[1694 byte] By [mkundua] at [2007-9-23]
# 1

> I am trying to build up client usng applet with JBOSS

> server.I am getting runtime Exception ........

>

> javax.naming.NoInitialContextException: Cannot

> instantiate class:

> org.jnp.interfaces.NamingContextFactory [Root

> exception is java.lang.ClassNotFoundException:

> org.jnp.interfaces.NamingContextFactory]

If this code is present in the applet, this won't work. Applets are downloaded on the client machine for execution. The JAR containing that interface for JBoss is not available and is not supposed to be available to the clients. You need to have this code in a server side component like a servlet and communicate to the servlet from the applet.

x

xHackera at 2007-7-13 > top of java,Core,Core APIs...