File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes servlet error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet error " Watch "servlet error " New topic
Author

servlet error

nishant vaishnaw
Greenhorn

Joined: Feb 27, 2013
Posts: 22
Hi,

When the JSP page is calling login servlet , below error comming :
SEVERE: Servlet.service() for servlet NTACLoginServlet threw exception
java.lang.StackOverflowError
at java.util.Properties.getProperty(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.ibm.jwf.config.PropertyFile.findPropertyFilePath(PropertyFile.java:48)
at com.ibm.jwf.config.PropertyFile.getProperties(PropertyFile.java:102)
at com.ibm.jwf.config.ApplicationContext.initalise(ApplicationContext.java:208)
at com.ibm.jwf.config.ApplicationContext.<init>(ApplicationContext.java:48)
at com.ibm.jwf.config.ApplicationContext.getInstance(ApplicationContext.java:127)
***************************************
the jsp page is :
<!--
Name Date Version Comment
L. Gentile 28/02/05 1.0 Created version number for CVS
Kingston J 22/04/06 1.1 Modified set the maxlength for userid and password textbox
-->

<FORM name="frmLogin" action="/NTACFrontEndWeb/servlets/Login" method="POST">
<input type="hidden" name="ACTION_TYPE_KEY" value="LOGIN_HANDLER">
<TABLE border="0" cellspacing="0" cellpadding="0" width="150" class="lightpanel">
<TR>
<TD width="10" rowspan="5" valign="top"><IMG src="/global/images/curve_tl.gif" width="10" height="10" alt="" title=""></TD>
<TD width="130"><IMG src="/global/images/spacer.gif" width="1" height="1" alt="" title=""></TD>
<TD width="10" rowspan="5" valign="bottom"><IMG src="/global/images/curve_br.gif" width="10" height="10" alt="" title=""></TD>
</TR>
<TR>
<TD class="Calltopb">Login</TD>
</TR>
<TR>
<TD class="FieldLabel">
<P>Enter your username and password<BR>
<BR>
Username<BR>
<INPUT type="text" size="20" maxlength="7" name="<%= ParametersKeys.USERID_KEY %>" >
Password<BR>
<INPUT type="password" size="20" maxlength="8" name="<%= ParametersKeys.PASSWORD_KEY %>"> <BR>
</P>
</TD>
</TR>
<TR>
<TD align="right"><INPUT type="image" src="/global/images/but_login_med_up.gif" name="but_go" width="61" height="20" border="0" alt="Login" title="Login" onClick="setActionType('LOGIN_HANDLER'); return false;">  </TD>
</TR>
<TR>
<TD><IMG src="/global/images/spacer.gif" width="1" height="10" alt="" title="" ></TD>
</TR>
</TABLE>
</FORM>
<BR>
<BR>
<A href="/servlet/com.telstra.ntac.servlet.LoginServlet?ACTION_TYPE_KEY=DISPLAY_CHANGE_PWD_HANDLER" >Change my password</A>

<BR>


<script language="JavaScript">
document.frmLogin.USERID_KEY.focus();
</script>
*******************************************
servlet code is :
package com.telstra.ntac.servlet;

import java.io.IOException;

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

import com.ibm.jwf.action.ActionHandler;
import com.ibm.jwf.action.ActionHandlerFactory;
import com.ibm.jwf.bean.ResultBean;
import com.ibm.jwf.config.ApplicationContext;
import com.ibm.jwf.config.JWFParametersKeys;
import com.ibm.jwf.config.MissingAppContextPropertyException;
import com.ibm.jwf.log.Log;
import com.ibm.jwf.servlet.JWFHttpServlet;
import com.ibm.jwf.util.Parameters;
import com.telstra.ntac.config.ParametersKeys;
import com.telstra.ntac.config.StateKeys;
import com.telstra.ntac.constants.ErrorMessage;
import com.telstra.ntac.viewobjects.WelcomeViewBean;


/*

public void performTask(HttpServletRequest pRequest, HttpServletResponse pResponse)
{
try
{
//
// Create a new session for the user about to log in
//
HttpSession httpSession = createSession(pRequest);

//
// This object is a neat container for the contents of the Request object
//
Parameters parameters = new Parameters(pRequest, httpSession);

//
// This singleton object contains all the methods to access the property
// files and maps for the application
//
ApplicationContext appContext = ApplicationContext.getInstance();


//
// Determine the actionHandler to be used for the login action using the Application Context
//
String actionType = parameters.getParameterAsString(ParametersKeys.ACTION_TYPE_KEY);
String actionClass = appContext.getActionHandlerClass(actionType);


//
// Use the ActionHandlerFactory to create a concrete Action Handler
// in this case a LoginHandler
//
ActionHandler actionHandler = ActionHandlerFactory.getInstance().getActionHandler(actionClass);

//
// Run the implemented execute method on the concrete ActionHandler
//
ResultBean resultBean = actionHandler.execute(parameters, httpSession);

//
// Process the Result and serve the correct JSP page
//
processResult(pRequest, pResponse, resultBean);
}
catch (Throwable t)
{
Log.getInstance().logFatal(t,t.getMessage());
launchHTML(pResponse, ErrorMessage.INTERNAL_ERROR_TITLE, ErrorMessage.INTERNAL_ERROR_MSG);
}
}

/**
* This method uses result bean's application state to perform a lookup of what
* should happen next. To do this a lookup is performed, based on the state, to
* know which JSP to next invoke. It then launches the JSP passing the ResultBean
* as part of the request. The JSP then accesses only the ResultBean to determine
* and render the dynamic portions of the page. The JSP may also access the Message
* Bean stored in the Result Bean to display any messages. The resulting HTML is
* then displayed/passed to the client browser.
*
* If the request to login is successful, the user will be taken to the NTAC
* Welcome page, otherwise they will be taken back to the Login page with a message
* informing of the problem.
*
* @param pRequest Object - that encapsulates the request to the servlet containing
* the input data and the results of processing.
* @param pResponse Object - that encapsulates the response from the servlet
* @param resultBean - the results of processing.
* @exception ServletException, IOException
*
* throws ServletException, IOException
*
*/
public void processResult( HttpServletRequest pRequest,
HttpServletResponse pResponse,
ResultBean resultBean) throws ServletException, IOException
{
storePersistObjects(pRequest, resultBean.getPersistObjects());

ApplicationContext context = ApplicationContext.getInstance();

if (resultBean != null)
{
String jspToLaunch = null;
try
{
jspToLaunch = context.getJspFilename(resultBean.getStateBean().getState());
}
catch (MissingAppContextPropertyException macpe)
{
throw new ServletException(macpe);
}

//
// We are storing the current result in the session so that if we have to do an undo
// then we have access to the previous viewbean
//
storeObjectInSession(pRequest, JWFParametersKeys.RESULT_KEY, resultBean);
String state = resultBean.getStateBean().getState();
if( state == StateKeys.DISPLAY_WELCOME)
{
storeObjectInSession(pRequest, ParametersKeys.USER_KEY, ((WelcomeViewBean) resultBean.getViewBean()).getUser());
}
if((state == StateKeys.CHANGE_PWD) || (state == StateKeys.PWD_EXP))
{
invalidateSession(pRequest);
storeObjectInRequest(pRequest, ParametersKeys.RESULT_KEY, resultBean);
}
launchJSP(pRequest, pResponse, jspToLaunch);
}
else
{
throw new ServletException("Result Bean is null");
}
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

A stack overflow usually means that you have an infinite loop in your code. Because you did not UseCodeTags, your code is unreadable so I did not look at it.

Look through it for loops that never end.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Nishant,

Also, the code you posted may seem to be related to your work, but make sure you post the code related to the issue, instead of all. Take care of not posting code that is not required, as you may post proprietary code accidentally and violate your corporate code of conduct


Regards
KumarRaja

evangilbort gilbort
Greenhorn

Joined: Apr 25, 2013
Posts: 7
Sometime the default package is the no name given that class to put into when you not give it an servlet. All class in web application to need in an explicit package. A servlet will work when place in the default package but the most often it will not work. So, generate error in servlet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

WHile it is true that putting a servelt (indeed, all classes) in a package is important, it cannot be the cause of a stack overflow error.
evangilbort gilbort
Greenhorn

Joined: Apr 25, 2013
Posts: 7
Thank's to Mr.Bear Bibeault am agree with you. Obviously this is a good information for me and it's a very useful in future.

Regard's
Evangilbort
 
Consider Paul's rocket mass heater.
 
subject: servlet error
 
Similar Threads
error to login page
Verification failed on Username existence check using AJAX
Login code problem
Login Code Error
jsp:setProperty