I have the following servlet code
public void doPost (HttpServletRequest request, HttpServletResponse response) {backup BUP = new backup (); Bup.doBackup (); Response.setContentType ("text / html"); PrintWriter Out; Try {Out = response.getWriter (); Out.println ("You've Supported Your Data - Good Hope"); Out.flush (); Out.close (); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); }}
and the following stack trace
javax.servlet.ServletException: Class view. Backup Servlet is not a servlet org.apache.catalina.valves. Arrorrportvovekinvoke (Arrorrportvovekjawa:l02) Orgkapachekkatlinkknectorkkyoteadptrksrvis (Kyoteadptrkjawa:293) OrgkapachekkoyotkhttpllkhttpllProcessorkproses (HttpllProcessorkjawa:849) Orgkapache. KoyotkhttpllkhttpllProtocol $ HttpllConnectionHandlerkproses (HttpllProtocolkjawa:583) Orgkapachektomkatkutilknetkjioandpoint $ Vrkrkrn (Jioandpointkjawa:454) Jawaklangkthredkrn (Thredkjawa: 619)
can not be molded into the root cause
java.lang.ClassCastException: view.BackupServlet javax.servlet.Servlet org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve a. java: 102) org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:849) org.apache.coyo te.http11 KhttpllProtocol $ HttpllConnectionHandlerkproses (HttpllProtocolkjawa:583) Orgkapachektomkatkutilknetkjioandpoint $ Vrkrkrn (Jioandpointkjawa:454) Jawaklangkthredkrn (Thredkjawa 619) < / P>
and web.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Web-app id = "WebApp_ID" version = "2.4" xmlns = "http://java.sun.com/xml/ns/j2ee" xmlns: xsi = "http://www.w3.org/2001 / XMLSchema - Example "xsi: schema location =" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-<br>app_2_4.xsd " & Gt; & Lt; Display-name & gt; Backup & lt; / Display-name & gt; & Lt; Welcome-file-list & gt; & Lt; Welcome-file & gt; Index.html & lt; / Welcome-file & gt; & Lt; Welcome-file & gt; Index.htm & lt; / Welcome-file & gt; & Lt; Welcome-file & gt; Index.jsp & lt; / Welcome-file & gt; & Lt; Welcome-file & gt; Default.html & lt; / Welcome-file & gt; & Lt; Welcome-file & gt; Default.htm & lt; / Welcome-file & gt; & Lt; Welcome-file & gt; Default.jsp & lt; / Welcome-file & gt; & Lt; / Welcome-file-list & gt; & Lt; Servlet & gt; & Lt; Description & gt; BackupServlet & lt; / Description & gt; & Lt; Display-name & gt; BackupServlet & lt; / Display-name & gt; & Lt; Servlet-name & gt; BackupServlet & lt; / Servlet-name & gt; & Lt; Br> & Lt; Servlet category & gt; View.BackupServlet & lt; / Servlet category & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; BackupServlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / BackupServlet & lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt; & Lt; / Web-app & gt; You have not shown your class declaration - I guess your class Servlet does not extend
or HTTPSWllet
.
If it does , check how many different servlet.jar files you have in your deployment - it may be loaded by two different classloaders is being done.
Comments
Post a Comment