java.rmi.ServerException: RemoteException occurred in server thread;
HI,
i had used a statefull session bean for storing the details and displaying the details of a class.Storing the records are executing perfectly. But while displaying it is giving the above error.
Here i am giving my you Session bean display function code. here i am getting the error in the line
con.createStatement(.............);
This line throwing
java.rmi.ServerException: RemoteException occurred in server thread;nested exception is:
java.rmi.RemoteException: java.lang.NullPointerException
public Vector getInsuSearchResults(String cname,String type,String tag,String id,int pageNo) throws SQLException
{
Connection con=null;
ResultSet rs=null;
String q1=null;
Vector details = new Vector();
try
{
int count1 = 0;
String fields[];
int subscript=0;
makeConnection();
stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
if(!cname.equals("") && !type.equals(""))
{
q1="select cname,to_char(frm_date,'dd-mon-yyyy') frm_date,to_char(to_date,'dd-mon-yyyy') to_date,type,ppaid,remarks from insurance where cname like '"+cname+"' and type like '"+type+"'";
}
else if(!cname.equals(""))
{
q1="select cname,to_char(frm_date,'dd-mon-yyyy') frm_date,to_char(to_date,'dd-mon-yyyy') to_date,type,ppaid,remarks from insurance where cname like '"+cname+"'";
}
else if(!type.equals(""))
{
q1="select cname,to_char(frm_date,'dd-mon-yyyy') frm_date,to_char(to_date,'dd-mon-yyyy') to_date,type,ppaid,remarks from insurance where type like '"+type+"'";
}
else
{
q1="select cname,to_char(frm_date,'dd-mon-yyyy') frm_date,to_char(to_date,'dd-mon-yyyy') to_date,type,ppaid,remarks from insurance";
}
q1+= " order by "+tag+" "+id+"";
rs=stmt.executeQuery(q1);
int first=((pageNo-1)*10);
int last=first+10;
if(first==0)
rs.beforeFirst();
else
rs.absolute(first);
while(rs.next() && first<last)
{
first++;
fields=new String[6];
subscript=0;
fields[subscript++]=rs.getString("cname");
fields[subscript++]=rs.getString("frm_date");
fields[subscript++]=rs.getString("to_date");
fields[subscript++]=rs.getString("type");
fields[subscript++]=rs.getString("ppaid");
fields[subscript++]=rs.getString("remarks");
details.add(fields);
}
}catch(Exception e)
{
throw new EJBException(e.toString());
}
finally
{
if(rs!=null) rs.close();
if(stmt!=null) stmt.close();
if(con!=null) con.close();
}
return details;
}