GeeCON Prague 2014*
The moose likes Servlets and the fly likes What is HTTP server 500 error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "What is HTTP server 500 error." Watch "What is HTTP server 500 error." New topic
Author

What is HTTP server 500 error.

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,
Could you please tell me after submitting the page in jsp it will show an error HTTP server 500 error.I am using Sun webser.I keep the jsp,web.xml and servlet file in proper location.But still i am facing same error.
Could please rectify my code which is mentioned below.

Regards
Sumanta Panda


NewPassword.jsp

NewPassword.action=response.encodeURLservlet/customerserviceServlet.NewPasswordServlet
-----------------------------------------------------------------
package customerserviceServlet;

import dbconnector.OracleDbConnector;
import java.util.Date;
import java.util.HashMap;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Vector;
import log.EnquiryLog;
import log.ExceptionLog;
import log.GlobalLog;
import commonbean.CommonBean;
import configBean.Config;
import dbconnector.ConnectionPool;
import config.SystemMessages ;

public class NewPasswordServlet extends HttpServlet
{

public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
HttpSession session = null;
CommonBean commonBean = null;
OracleDbConnector dbCon = null;
Vector newpasswordVector = null;
boolean sessionValidate = false;
String series = null;
String queryStr = null;
String requesttype=null;
String userid=null;
String dateofbirth=null;
String emailid=null;
String bankaccno=null;
String strTerminal = null;
String strUserId = null;
String sHostName=null;
String strDoGet="Success";
int responseLen = 0;

try
{
requesttype=request.getParameter("rPass");
userid=request.getParameter("txtUserId");
dateofbirth=request.getParameter("DateofBirth");
emailid=request.getParameter("txtMail");
bankaccno=request.getParameter("txtBankAcc");
System.out.println("Request Type"+requesttype);
HashMap values = new HashMap();
String procString="PR_ITS_CUSTOMER_AUTH";
values.put("1",userid);
values.put("2","dateofbirth");
values.put("3","Types.VARCHAR");
values.put("4","Types.VARCHAR");
GlobalLog.l(userid+"|"+strTerminal+" NewPasswordServlet :: Values="+values);
HashMap out = new HashMap();

if(ConnectionPool.interactiveConnectionPool!=null)
{
dbCon = new OracleDbConnector(ConnectionPool.interactiveConnectionPool);
out=dbCon.CallStatementForProcedure(procString,values,Config.itsInterDBName);

if(out!=null)
{
queryStr = (String) out.get("1");
newpasswordVector = (Vector)out.get("2");
}
GlobalLog.l(strUserId+"|"+strTerminal+" NewPasswordServlet: B call with queryStr="+queryStr+" Result:"+newpasswordVector);

}
if(newpasswordVector !=null && newpasswordVector.size() > 1)
commonBean.setMessage("");
else{
//commonBean.setMessage("No Corporate Actions Available");
commonBean.setMessage(SystemMessages.getInstance().getMessage("INVALID_SYM"));
}
commonBean.setresultDetails(newpasswordVector);
if(newpasswordVector!=null) responseLen = newpasswordVector.size();

commonBean.setPageTitle("Corporate Actions");
session.setAttribute("commonBean", commonBean);

}catch (Exception e)
{
strDoGet="Failure";

}
finally
{

dbCon = null;
newpasswordVector = null;
series = null;
queryStr = null;
}
}
}

-----------------------------------------------------------
web.xml
<servlet>
<servlet-name>customerserviceServlet.NewPasswordServlet</servlet-name>
<servlet-class>customerserviceServlet.NewPasswordServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>customerserviceServlet.NewPasswordServlet</servlet-name>
<url-pattern>/customerserviceServlet.NewPasswordServlet</url-pattern>
</servlet-mapping>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

500 means "something went wrong on the server", and usually you would need to look at the exception to fix the error in the code.
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Http error 500 is Internal server error.
Can you post the complete stack trace so that we can look what exactly might be the problem?
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Amol Sir,
This is exception which i found in the error log.Please look in to and advise me how i will resolve it.

Thanks a lot in Advance.

----- Root Cause -----
java.lang.UnsupportedClassVersionError: customerserviceServlet/NewPasswordServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1717)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:983)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1431)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1301)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:870)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:413)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:807)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at RequestFilter.doFilter(RequestFilter.java:103)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:280)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web
[08/Dec/2008:12:22:40] failure ( 3052): for host 127.0.0.1 trying to POST /servlet/customerserviceServlet.NewPasswordServlet, service-j2ee reports: StandardWrapperValve[invoker]: WEB2792: Servlet.service() for servlet invoker threw exception
javax.servlet.ServletException: WEB3314: Cannot allocate servlet instance for path /servlet/customerserviceServlet.NewPasswordServlet
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:438)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:807)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at RequestFilter.doFilter(RequestFilter.java:103)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:280)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)
----- Root Cause -----
java.lang.UnsupportedClassVersionError: customerserviceServlet/NewPasswordServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1717)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:983)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1431)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1301)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:870)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:413)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:807)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at RequestFilter.doFilter(RequestFilter.java:103)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:280)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
This is caused when you build the source for a particular version of java and the virtual machine running the class file does not for the version on which the source is built. Say your server is runing on java 1.4 but your servlets are compiled on JDK 5.
Try recompiling your servlets using the the target option like
javac - target <target_version> <your java file name>
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Thanks a lot Amol Sir....Your advise helped me a lot to achieve my milestone...

Best Regards
Sumanta Panda
Udayaditya Barua
Greenhorn

Joined: Dec 05, 2008
Posts: 8
For future ref you might consider:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
 
wood burning stoves
 
subject: What is HTTP server 500 error.