lundi 13 avril 2015

java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to com.oreilly.servlet.MultipartRequest


I am using JSP and servlet to post the data from a form which contains enctype="multipart/form-data" file uploading , where i getting parameter value as null while i receiving throw request.getParameter("NameOfParam"). then trying to receive that data throw MultipartRequest mpr.getParameter("NameOfParam") . In this case it providing Error : java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to com.oreilly.servlet.MultipartRequest


If any solution let me know . My code as follows.



try { MultipartRequest mpr=(MultipartRequest)request; int id=Integer.parseInt(mpr.getParameter("id")); int aqarId=Integer.parseInt(mpr.getParameter("aqarId")); int year=Integer.parseInt(mpr.getParameter("year")); String aqarStatus=mpr.getParameter("status"); finalServiceImp.uploadAQRAFile(filePath,aqarStatus,aqarId,year); System.out.println("Path :"+filePath+" status :"+aqarStatus+" idS :"+idS+" aqarIdS :"+aqarIdS); }


Thank you Raj BC


Aucun commentaire:

Enregistrer un commentaire