• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.InstantiationException:

 
Gangi koirala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I compile the following java bean,no copile error ocuurs
but the compiled class has nothing and when the JSP page loading it gives java.lang.InstantiationException: `Final.Nearest_consumer' has no
public zero-arg constructor
(The error is obvious since nothing in the class)
please find me the error
Thank you
Gangi
package Final;
import java.sql.*;
import java.io.*;
import java.util.*;
import Main.*;
public class Nearest_consumer{
public Connection conn;
public DBConnectionManager connMgr;
public String NEAREST_WALKPATH_NO="";
public int WALKPATH_NO;
public String ConNo="";
public String ValidateResult ;
//*************************Constructor******************************************
public Nearest_consumer(){
try{
connMgr = DBConnectionManager.getInstance();
conn = connMgr.getConnection("oracleNew");
conn.setAutoCommit(true);
InitVar();
}//End Try
catch (Exception e){
ValidateResult +="ClassNotFoundException: "+e.getMessage();
e.printStackTrace();
}//End Catch
}//End Constructor
public Nearest_consumer(String ConNo){
try{
//Using connectionpool
connMgr = DBConnectionManager.getInstance();
conn = connMgr.getConnection("oracleNew");
conn.setAutoCommit(true);
InitVar();
getNEAREST_WALKPATH_NO(ConNo);
}//End Try
catch (Exception e){
ValidateResult +="ClassNotFoundException: "+e.getMessage();
e.printStackTrace();
//System.out.println(ValidateResult);
}//End Catch
}//End Constructor

//**************** Initialise****************
public void InitVar(){
ACCOUNT_BALENCE="";
ADDRESS1="";


//*******************Get Nearest Consumer No*****************************
public String getNEAREST_WALKPATH_NO(String ConNo){
//Statement stmt ;
NEAREST_WALKPATH_NO=""; WALKPATH_NO=0; long TEMP_WALKPATH_NO=0;
try{
PreparedStatement stmt;
String ssql= "Select WALKPATH_NO from B_CONSUMER_HD_TAB where CONSUMER_NO= '" + ConNo + "'";

stmt= conn.prepareStatement(ssql);
ResultSet rs = stmt.executeQuery();
while(rs.next ()){
NEAREST_WALKPATH_NO=rs.getString("WALKPATH_NO");
}//End while}
System.out.println("NEAREST_WALKPATH_NO"+NEAREST_WALKPATH_NO);
rs.close();
stmt.close();
if (NEAREST_WALKPATH_NO !="" | | NEAREST_WALKPATH_NO.length() !=0 ){
PreparedStatement stmt1 = conn.prepareStatement("Select WALKPATH_NO from B_CONSUMER_HD_TAB where WALKPATH_NO BETWEEN " + NEAREST_WALKPATH_NO + " AND " + (Long.parseLong(NEAREST_WALKPATH_NO)*1 +100) + " ORDER BY WALKPATH_NO");
ResultSet rs1 = stmt1.executeQuery();
WALKPATH_NO=Integer.parseInt(NEAREST_WALKPATH_NO);
TEMP_WALKPATH_NO=0;
while(rs1.next ())
{
TEMP_WALKPATH_NO=rs1.getLong("WALKPATH_NO");
if(WALKPATH_NO<=TEMP_WALKPATH_NO){WALKPATH_NO=WALKPATH_NO+1;}
else {break;}
}//End while}
rs1.close();
stmt1.close();

} else
{ WALKPATH_NO=0; TEMP_WALKPATH_NO=0; NEAREST_WALKPATH_NO="";
}
conn.commit();

}catch (Exception e){
ValidateResult +="SQLException in getNEAREST_WALKPATH_NO Method: "+e.getMessage();
e.printStackTrace();
}//End Catch
connMgr.freeConnection("oracleNew", conn);
return NEAREST_WALKPATH_NO;

}//End getNEAREST_WALKPATH_NO

public void InitVar(){
NEAREST_WALKPATH_NO="";
WALKPATH_NO=0;
}
}
[This message has been edited by Gangi koirala (edited August 17, 2001).]
[This message has been edited by Gangi koirala (edited August 17, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!