javax.servlet.ServletException: Servlet execution threw an exception

i am getting this error
root cause
[
java.lang.NoSuchMethodError: javax.servlet.http.HttpSessionBindingEvent.<init>(Ljavax/servlet/http/HttpSession;Ljava/lang/String;Ljava/lang/Object;)V
org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1306)
org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:176)
masterservlet.CheckLogin.doPost(CheckLogin.java:87)
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


note The full stack trace of the root cause is available in the Tomcat logs.
===================
my CheckLogin code is:
================

package masterservlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cadsemployeebean.EncodeDecodePassword;

import databaseconnection.estaconnection;

public class CheckLogin extends HttpServlet 
{
	PrintWriter out=null;
	HttpSession session=null;
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		doPost(request, response);
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		String loginName=request.getParameter("loginid").trim();
		String password=request.getParameter("password").trim();
		System.out.println(password);
		System.out.println(loginName);
		session=request.getSession();
	    Connection cn=null;	
		Statement st=null;
		ResultSet rs=null;
		String path="";
		String invaliduser="Invalid Id/Password";
		String userId=null;
	    String userLevel=null;
		estaconnection es =new estaconnection();
	    cn=es.getConnect();
	    if(cn==null)
	    {
	    	System.out.println(8);
	    }
	    else
	    {
	    try
	    {    	
			 st=cn.createStatement();
			 String query="SELECT  APP.VC_FIRST_NAME, APP.VC_LAST_NAME, LOGIN.NU_USER_ID, LOGIN.VC_PASSWORD,LOGIN.VC_USER_GROUP_CODE,LOGIN.CH_LEVEL, LOGIN.VC_PRESENT_STATUS,LOGIN.VC_ACTIVATION FROM  CADS_MST_APPLICATION_REGISTER APP, MST_CADS_LOGIN LOGIN, MST_EMPLOYEE_REGISTER EMP WHERE LOGIN.NU_EMP_ID=EMP.NU_EMP_ID AND APP.VC_APPLICATION_NO=EMP.VC_APPLICATION_NO AND LOGIN.VC_USER_CODE='"+loginName+"'";
			 rs=st.executeQuery(query);
			 System.out.println(query);
			 if(rs.next())
			 {				 
				 if(rs.getString(8).equalsIgnoreCase("y"))
				 {
					 String  presentStatus=rs.getString(7);
					 if(presentStatus.equalsIgnoreCase("1"))
					 {
						 String encmsg=rs.getString(4);
						 String decmsg="";
						 try
						 {
							 decmsg=EncodeDecodePassword.getDecodePassword(encmsg);
							 System.out.println("The password is:: "+ decmsg);
						 }
						 catch(Exception ioe){}
						 if(decmsg.equals(password))
						 {
							 userId=rs.getString(3);
							 String userGroupCode=rs.getString(5);
							 userLevel=rs.getString(7);
							 
							 String myName=rs.getString(1);
							 if(myName==null)
								 myName="";
							 if(rs.getString(2)!=null)
								 myName=myName+" "+rs.getString(2);
							 path="menu.jsp";
							 String updatequery="update mst_cads_login set vc_present_status='0',VC_LOGIN_STATUS='success',DT_LOGIN_DATETIME=sysdate where vc_user_code='"+loginName+"'";
							 //st.executeUpdate(updatequery);
							 System.out.println(updatequery);
							 session.setAttribute("loginName1",myName);
							 /*session.setAttribute("loginName",myName);
							 session.setAttribute("curentloginname", loginName);
							 session.setAttribute("userId", userId);
							 session.setAttribute("userGroupCode", userGroupCode);
							 session.setAttribute("userlevel",userLevel);
							 session.setAttribute("presentstatus","0");
							 session.setAttribute("userpass", password);*/
						 }
						 else
						 {
							 String updatequery1="update mst_cads_login set VC_LOGIN_STATUS='unsuccess',DT_LOGIN_DATETIME=sysdate where vc_user_code='"+loginName+"'";
							 st.executeUpdate(updatequery1);
							 System.out.println(updatequery1);
							 invaliduser="INVALID PASSWORD";
							 request.setAttribute("invaliduser",invaliduser);
							 path="login.jsp"; 
						 }
					 }
					 else
					 {
						 invaliduser="ALREADY U VE LOGIN";
						 request.setAttribute("invaliduser",invaliduser);
						 path="login.jsp"; 
					 }
				 }
				 else
				 {
					 invaliduser="YOUR  LOGIN ID IS NOT ACTIVATED";
					 request.setAttribute("invaliduser",invaliduser);
					 path="login.jsp"; 
				 }
			 }
			 else
			 {
				 invaliduser="INVALID USER NAME";
				 request.setAttribute("invaliduser",invaliduser);
				 path="login.jsp";
			 }
		}
	    catch(SQLException e)
	    {		    		
	    	System.out.println(e);
	    }
	    finally
	    {
	    	try
	    	{	
	    		if(rs!=null)
	    		{
	    			rs.close();
	    		}
		 		if(st!=null)
		 		{
		 			st.close();
		 		}
		 		if(cn!=null)
		 		{
		 			cn.close();
		 		}
		 	}catch(SQLException e){}
		 }
	   }
	   /*RequestDispatcher rd=request.getRequestDispatcher(path);
	   try
	   {
		   rd.forward(request, response);
	   }
	   catch(Exception e){}*/
	}
}

Seems you are using incorrect Servlet API jar, please change your classPath to use the one in $CATALINA_HOME/common/lib only.

Hope it will help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.