Hi:
I am using a session bean to access the database and I am getting the following error when I run the client
--Application threw an exception :AbstractMethodError:Chronos_stub.getEmail()Ljava/sql/ResultSet:
Also in the command prompt where I have started the
J2ee server it gives a message saying that
"java.comp:/env/ChronosCoreUser is using a JNDI name that is not bound :ChronosCoreUser"
can anyone pl throw some light on this error.
___________________________________________________________
Chronos.java
----------------------------------------------------------
public interface Chronos extends EJBObject {
//gets email id of the user whose name is passed in as a parameter
public ResultSet getEmail() throws RemoteException;
}
---------------------------------------------------------
ChronosBean.java
----------------------------------------------------------
public class ChronosBean implements SessionBean {
public DataSource ds=null;
//
String datasourcename="java:comp/env/ChronosCoreUser";
String datasourcename="ChronosCoreUser";
ResultSet rs;
public ResultSet getEmail(){
try{
InitialContext ctx=new InitialContext();
ds=(DataSource)ctx.lookup(datasourcename);
Connection conn=ds.getConnection();
Statement stmt=conn.createStatement();
rs=stmt.executeQuery("select email from core_user where firstname='xyz'");
// while(rs.next()){
// System.out.println("The email id is "+rs.getString("email"));
// emailid= rs.getString("email");
//}
}
catch(Exception e){
System.out.println(e);
}
//System.out.println("I am at the Bean implementation ----> "+returnvalue);
return rs;
}
---------------------------------------------------------
ChronosClient.java
----------------------------------------------------------
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objref = initial.lookup("ChronosUsrMailid");
ChronosHome home = (ChronosHome)PortableRemoteObject.narrow(objref,ChronosHome.class);
Chronos usermailid = home.create();
ResultSet rs=usermailid.getEmail();
while(rs.next()){
System.out.println("Email of Hemanth is "+ rs.getString("Email"));
}
// System.out.println(usermailid.getEmail());
}
catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
} ChornosClient.java