Javax.servlet.ServletException: Cannot find bean CustForm in any scope
while i m running my struts application.. i m getting this error.. can any one pointout wat error is this...
javax.servlet.ServletException: Cannot find bean CustForm in any scope
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.Result_jsp._jspService(Result_jsp.java:100)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
hi shanu
getting in jsp call..
ERROR [Engine] ApplicationDispatcher[customTag] Servlet.service() for servlet jsp threw exception.
n this is the action
<action-mappings >
<action path="/select" type="customTld.CustAction" name="custform" scope="request">
<forward name="ok" path="/Result.jsp"/>
</action>
</action-mappings >
Similar Messages
-
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
org.apache.jsp.index_jsp._jspx_meth_html_form_0(org.apache.jsp.index_jsp:139)
org.apache.jsp.index_jsp._jspx_meth_html_html_0(org.apache.jsp.index_jsp:114)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
This is my web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//SUN Microsystem, //"
"http://java.sun.com/j2ee/dtds/web-app_2.2/dtd">
<web-app>
<!--Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<!-- Resource Bundle base class -->
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<!-- Context Relative Path to the XML resource containing Struts Configuration -->
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<!-- The Debugging detail level for this servlet, which controls how much information -->
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
<!-- Struts Tag Lib Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>
==================================================================================================================
This is my Struts-config.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//SUN Microsystem, //"
"http://java.sun.com/j2ee/dtds/struts-config_1_0/dtd">
<struts-config>
<form-beans>
<!-- Logon Form Bean -->
<form-bean name="loginForm" type="LoginForm" />
</form-beans>
<global-forwards>
<forward name="mainmenu" path="/mainmenu.jsp" />
</global-forwards>
<action-mappings>
<!-- Process a user logon -->
<action path="/login" type="LoginAction"
name="loginForm" scope="session" input="/index.jsp">
</action>
</action-mappings>
</struts-config>
==================================================================================================================
This is my LoginForm.java file
package src;
import org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm {
private String login;
private String password;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
==================================================================================================================
This is my LoginAction.java file
package src;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.struts.action.Action;
public class LoginAction extends Action {
public ActionForward execute( ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
return (mapping.findForward("mainmenu"));
==================================================================================================================
This is my index.jsp file
<%@ page language ="java" %>
<%@ taglib uri ="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri ="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri ="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<title> My First Struts Application! </title>
</head>
<body>
<html:form action="/login">
LOGIN : <html:text property="login" />
PASSWORD : <html:password property="password" />
<html:submit> Login </html:submit>
<html:reset> Reset </html:reset>
</html:form>
</body>
</html:html>
==================================================================================================================
and finally This is my mainmenu.jsp file
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<title>Main Menu</title>
</head>
<body>
This is the MainMenu !
</body>
</html:html>
==================================================================================================================
Kindly solve my problem........
try to run on your machine...........
I am using Tomcat 5.5.9 and my Project name is MyAppliHey guys,
Even I was frustrated for a long time with all the Struts errors for which Google returned loads of results but no particular solutions. All these solutions were all based on hit and trial and only work on some cases. Let me tell you that Struts (and most other frameworks) have a general approach to consume the actual error message and throw an exception which is light years away from the actual cause. So whats' the solution?
Enable logging.... LOG4J to be precise...
...and see that it (log4j) is configured properly. You will see the actual cause there and not on the consoles of your servers (whichever you use).
In my case, it was a host not found exception in the logs because I was sitting behind a firewall and the validator could not locate struts.apache.org
(Wish this thread had some duke dollars)
Regards,
The Correspondent
http://www.araneidae.org -
Javax.servlet.ServletException: Cannot create bean of class
People,
HELP!! I am getting desperate!!!
I am a newbie when it comes to TOMCAT, but i have been using Blazix before.
My current system is using APACHE/TOMCAT on a Solaris machine and I keep hitting the same problem. I have gone through the archives but the only thing it states is to check the directory which i have done.
I keep getting:
Error 500
Internal Error
javax.servlet.ServletException: Cannot create bean of class MyClass
The code used to work on the Blazix server so i am assuming it is something to do with a config parameter somewhere - but i do not know where. I have checked the directory/package structure and they seem to work. It even serves it when they are html pages not jsp, but obviously wont use the bean. :(
I can post code if necessary.
Please help
SteveThe FormData.class file is in examples/WEB-INF/classes/ directory.
Is this wrong? then should it be in a package called examples.steve???
<TITLE> Poc </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
<META NAME="Author" CONTENT="Steve Brodie">
<META NAME="Proof of Concept order entry system" CONTENT="">
<META NAME="PROOF OF CONCEPT ORDER ENTRY SYSTEM " CONTENT="">
</HEAD>
<%@ page import="steve.FormData" %>
<jsp:useBean id="user" class="steve.FormData"/>
<jsp:setProperty name="user" property="*"/>
<FORM METHOD=POST ACTION="SaveDetails.jsp">
<CENTER>
<H1>
POC CNS demo <BR>
POC Order Entry System <BR></H1>
<H2><CENTER>PROOF OF CONCEPT ORDER ENTRY SYSTEM <BR>
in order to illustrate the use of an new product<BR></H1>
</CENTER>
<BODY>
Please enter the following details: <BR>
Second name <INPUT TYPE=TEXT NAME=secondName SIZE=20><BR>
First name <INPUT TYPE=TEXT NAME=firstName SIZE=20><BR>
Address <INPUT TYPE=TEXT NAME=address1 SIZE=20><BR>
Address <INPUT TYPE=TEXT NAME=address2 SIZE=20><BR>
Post Code <INPUT TYPE=TEXT NAME=postCode SIZE=10><BR>
Phone NO. <INPUT TYPE=TEXT NAME=phone SIZE=10><BR>
<BR>
Credit Card<INPUT TYPE=TEXT NAME=credit SIZE=15><BR>
<BR>
Quality of Service:
<SELECT TYPE=TEXT NAME="QoS">
<OPTION SELECTED TYPE=TEXT NAME=Gold>Gold <BR>
<OPTION TYPE=TEXT NAME=Silver>Silver <BR>
<OPTION TYPE=TEXT NAME=Bronze>Bronze <BR>
</SELECT>
<BR>
<BR>
<INPUT TYPE=RESET>
<P><INPUT TYPE=SUBMIT>
<BR>
<BR>
<IMG SRC=../images/Cisco.gif>
</FORM>
</BODY>
</HTML>
package steve;
* @author Steven Brodie
* @date
* @version 0.0
import java.io.*;
import java.lang.*;
import java.util.*;
public class FormData {
String secondName = null;
String firstName = null;
String address1 = null;
String address2 = null;
String postCode = null;
int credit = 0;
int phone = 0;
String qos = null;
String file = "out";
String filex = "xout";
PrintWriter pout = null;
PrintWriter xout = null;
FormData() {
try {
pout = new PrintWriter(new BufferedWriter(new FileWriter(file + ".txt")));
xout = new PrintWriter(new BufferedWriter(new FileWriter(filex + ".xml")));
xout.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xout.println("<OrderEntry xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
xout.println("xsi:noNamespaceSchemaLocation=\"http://machine2.com:8080/xml/xsd/OrderEntry.xsd\">");
} catch (IOException ioe) {
System.err.println("DataFileWriter error ioe on init");
ioe.printStackTrace();
System.exit(1);
public void setFirstName( String value ) {
firstName = value;
System.out.println(firstName);
pout.println(firstName);
xout.println("<firstname value= \"" + firstName + "\"/>");
public void setSecondName( String value ) {
secondName = value;
System.out.println(secondName);
pout.println(secondName);
xout.println("<secondname value= \"" + secondName + "\"/>");
public void setAddress1( String value ) {
address1 = value;
System.out.println(address1);
pout.println(address1);
xout.println("<address1 value= \"" + address1 + "\"/>");
public void setAddress2( String value ) {
address2 = value;
System.out.println(address2);
pout.println(address2);
xout.println("<address2 value= \"" + address2 + "\"/>");
public void setPostCode( String value ) {
postCode = value;
System.out.println(postCode);
pout.println(postCode);
xout.println("<postCode value= \"" + postCode + "\"/>");
public void setCredit( int value ) {
credit = value;
System.out.println(credit);
pout.println(credit);
xout.println("<creditCard value= \"" + credit + "\"/>");
public void setPhone( int value) {
phone = value;
System.out.println("0" + phone);
pout.println("0" + phone);
xout.println("<phoneNo value= \"0" + phone + "\"/>");
public void setQoS( String value ) {
qos = value;
System.out.println(qos);
pout.println(qos);
xout.println("<QoS value= \"" + qos + "\"/>");
xout.println("</OrderEntry>");
pout.flush();
pout.close();
xout.flush();
xout.close();
public String getFirstName() {
return firstName;
public String getSecondName() {
return secondName;
public String getAddress1() {
return address1;
public String getAddress2() {
return address2;
public String getPostCode() {
return postCode;
public int getCredit() {
return credit;
public int getPhone() {
return phone;
public String getQoS() {
return qos; -
Hi,
I am getting the following error
Cannot find bean allJobsForm in any scope. I need some help in trying to identify the problem. I have attached the strust action mapping, the JSP, and the action and form classes. Please have a look and assist me in solving this problem as it I am becoming really frustrated.
Warm Regards
Denzil
Action Mapping
<action
path="/secure/moshomo/search/GetAllJobsAction"
type="za.co.mpilo.moshomo.web.action.GetAllJobsAction"
name="allJobsForm"
scope="session"
input="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
unknown="false"
validate="true"
>
<forward
name="success"
path="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
redirect="false"
/>
JSP
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<%@ taglib uri="/tags/war-extranet" prefix="extranet" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %>
<nested:root name="allJobsForm">
<div align="center">
<table width="80%" class="mstable" >
<thead>
<td>Posted Jobs</td>
</thead>
<tr>
<td>
<table width="100%" >
<tr class="mssubhead">
<td width="60%" ><font color="#160866">
Job Title
</font></td>
<td width="22%" align="center" ><font color="#160866">
Posted Date
</font></td>
<td width="18%" align="center" ><font color="#160866">
Expiration Date
</font></td>
</tr>
<tr>
<td width="80%" ><font color="#160866">
Job Description
</font></td>
</tr>
<nested:iterate property="all" id="ref" type="za.co.mpilo.moshomo.vo.JobVO">
<tr>
<td width="60%"><font color="#160866">
<nested:write name="ref" property="jobTitle"/>
</font></td>
<td width="22%"><font color="#160866">
<nested:write name="ref" property="postedDate"/>
</font></td>
<td width="18%"><font color="#160866">
<nested:write name="ref" property="expirationDate"/>
</font></td>
</tr>
<tr>
<td width="80%" align="center"><font color="#160866">
<nested:write name="ref" property="jobDescription"/>
</td>
</tr>
</nested:iterate>
<nested:empty property="all">
<tr>
<td colspan="3"><font color="#160866"> No results found. </font></td>
</tr>
</nested:empty>
</table>
</td>
</tr>
</table>
</div>
</nested:root>
Action Class
package za.co.mpilo.moshomo.web.action;
import java.util.HashMap;
import java.util.logging.Level;
import javax.ejb.FinderException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import za.co.mpilo.common.web.action.CommonAction;
import za.co.mpilo.moshomo.interfaces.CVRepositoryManager;
import za.co.mpilo.moshomo.util.CVRepositoryManagerUtil;
import za.co.mpilo.moshomo.vo.CVVO;
import za.co.mpilo.moshomo.vo.SearchVO;
import za.co.mpilo.moshomo.vo.JobVO;
import za.co.mpilo.moshomo.web.form.AllJobsForm;
import za.co.mpilo.moshomo.web.form.AllTertiaryEducationForm;
import za.co.mpilo.moshomo.web.form.JobSearchForm;
* @struts.action
* name="allJobsForm"
* path="/secure/moshomo/search/GetAllJobsAction"
* input="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
* scope="session"
* validate="true"
* redirect="false"
* @struts.action-forward
* name="success"
* path="/secure/CVHomeHR.do?p_content=/jsp/secure/moshomo/ms_recruiter_jobs.jsp"
* @version $Revision: 1.4 $
* @author $Author: denzilf $
* @date $Date: 2006/11/02 11:03:10 $
public class GetAllJobsAction extends CommonAction{
public ActionForward execute(ActionMapping mapping, ActionForm f, HttpServletRequest request, HttpServletResponse response) throws Exception {
if ( getLogger().isLoggable(Level.INFO) )
getLogger().info( "execute" );
ActionForward result = mapping.getInputForward();
ActionMessages errors = new ActionMessages ();
AllJobsForm form = (AllJobsForm) f;
try {
//vo.setAllORany( form.getAllORany());
//vo.setMatch( form.getMatch());
//vo.setSearchText(form.getSearchText());
String uid = request.getUserPrincipal().getName(); //logged in user
CVRepositoryManager manager = CVRepositoryManagerUtil.getHome( getIntialProperies() ).create();
HashMap jobs = manager.findAllJobsPerUserId(uid);
form.setAll( jobs.values() );
result = mapping.findForward( "success" );
catch (Exception xe) {
if ( getLogger().isLoggable(Level.WARNING) )
getLogger().log( Level.WARNING , xe.getMessage() , xe );
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general" ) );
if ( !errors.isEmpty() )
saveErrors( request , errors );
return result;
Form
package za.co.mpilo.moshomo.web.form;
import java.util.Collection;
import org.apache.struts.validator.ValidatorForm;
import za.co.mpilo.moshomo.vo.JobVO;
* @struts.form
* name="allJobsForm"
public class AllJobsForm extends ValidatorForm {
private int selection;
private Collection all;
public JobVO[] getAll() {
JobVO[] array = new JobVO[all.size()];
all.toArray( array );
return array;
public void setAll(Collection all) {
this.all = all;
public int getSelection() {
return selection;
public void setSelection(int selection) {
this.selection = selection;
}type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/Edituser.jsp at line 36
33: <html:form action="/Updateuser" method="post">
34:
35: <table border="0" align="center">
36: *<logic:iterate id="details" name="user">*
37: <tr>
38: <td><html:hidden property="userid" name="details"/></td>
39: <td><html:hidden property="contactid" name="details"/></td>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:397)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:988)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "user" in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.jsp.Edituser_jsp._jspService(Edituser_jsp.java:844)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:988)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.servlet.jsp.JspException: Cannot find bean: "user" in any scope
org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:232)
org.apache.jsp.jsp.Edituser_jsp._jspService(Edituser_jsp.java:184)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1023)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:988)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the JBossWeb/2.0.1.GA logs.
-------------------------------------------------------------------------------- -
Hi!
I have a jsp with Combo boxes, when i select a value of one combo box
OnChnage of it the 2nd combo box gets its value dynamically from the
database..
Here is my JSP..............................
<script language="JavaScript">
function ELMORG_MNEMONIC1Changed() {
var frm = document.RetrieveReportDynaForm;
frm.actionType.value = "1";
frm.submit();
function ELMORG_MNEMONIC2Changed(){
var frm = document.RetrieveReportDynaForm;
frm.actionType.value = "2";
frm.submit();
function ELMORG_MNEMONIC3Changed(){
var frm = document.RetrieveReportDynaForm;
frm.actionType.value = "3";
frm.submit();
</script>
</head>
<body>
<table>
<html:form action="/RetrieveReport.do" styleId="RetrieveReportDynaForm">
<input type="hidden" name="actionType" value="">
<table cellspacing=0 cellpadding=2 border=0 class="table_data" id="TABLE1" >
<tr>
<td height="20px" colspan="5" class="table_top_td">Telecom DashBoard</td>
</tr>
<tr >
<tr class="table_data">
<td width="90px"></td>
<td class="smalltext" width="75px" align="right"><b>Organizational Element1</b></td>
<td>
<html:select property="ELMORG_MNEMONIC1" styleClass="mediumtext" style="width:120px; height:30px" onchange="ELMORG_MNEMONIC1Changed()">
<html:option value="">Select</html:option>
<html:optionsCollection name="reportlist" label="ELMORG_MNEMONIC1" value="ELMORG_MNEMONIC1"/>
</html:select>
</td>
</tr>
<tr class="table_data">
<td width="90px"></td>
<td class="smalltext" width="75px" align="right"><b>Organizational Element2</b></td>
<td>
<html:select property="ELMORG_MNEMONIC2" styleClass="mediumtext" style="width:120px; height:30px" onchange="ELMORG_MNEMONIC2Changed()">
<html:optionsCollection name="mnemonic1" label="ELMORG_MNEMONIC2" value="ELMORG_MNEMONIC2"/>
</html:select>
</td>
</tr>
<tr class="table_data">
<td width="90px"></td>
<td class="smalltext" width="75px" align="right"><b>Organizational Element3</b></td>
<td>
<html:select property="ELMORG_MNEMONIC3" styleClass="mediumtext" style="width:120px; height:30px" onchange="ELMORG_MNEMONIC3Changed()">
<html:optionsCollection name="mnemonic2" label="ELMORG_MNEMONIC3" value="ELMORG_MNEMONIC3"/>
</html:select>
</td>
</tr>
<tr class="table_data">
<td width="90px"></td>
<td class="smalltext" width="75px" align="right"><b>Organizational Element4</b></td>
<td>
<html:select property="RC_MNEMONIC" styleClass="mediumtext" style="width:120px; height:30px" onchange="RC_MNEMONICChanged()">
<html:optionsCollection name="mnemonic3" label="RC_MNEMONIC" value="RC_MNEMONIC"/>
</html:select>
</td>
</tr>
<tr>
<td></td>
<td><html:submit/></td>
</tr>
</table>
</html:form>
</body>
</html:html>
I am getting a error....
javax.servlet.jsp.JspException: Cannot find bean: "mnemonic2" in any scope
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
at org.apache.struts.taglib.html.OptionsCollectionTag.doStartTag(OptionsCollectionTag.java:173)
at org.apache.jsp.jsp.reportParameter_jsp._jspx_meth_html_optionsCollection_2(reportParameter_jsp.java:469)
at org.apache.jsp.jsp.reportParameter_jsp._jspx_meth_html_select_2(reportParameter_jsp.java:438)
at org.apache.jsp.jsp.reportParameter_jsp._jspx_meth_html_form_0(reportParameter_jsp.java:210)
at org.apache.jsp.jsp.reportParameter_jsp._jspService(reportParameter_jsp.java:130)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
when i execute this page..
I am using struts action where i am setting the "mnemonic2" variable in a session....................................
if ("2".equals(actionType)){
String MNEMONIC1 = request.getParameter("ELMORG_MNEMONIC1");
String MNEMONIC2 = request.getParameter("ELMORG_MNEMONIC2");
if(MNEMONIC2==""){
request.getSession().removeAttribute("mnemonic2");
}else{
ArrayList reportParam1 = (ArrayList)this.reportService.getELMORG_MNEMONIC3(MNEMONIC1,MNEMONIC2);
System.out.println("The arraysize in the Action class2 is"+reportParam1.size());
request.getSession().setAttribute("mnemonic2", reportParam1);
Can any one pls tell me why m i getting this error???hi enoch!
yeah definitely...
<action path="/FourthAction" name="RetrieveReportDynaForm"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="/jsp/reportParameter.jsp"></forward>
<forward name="failure" path="/jsp/reportParameter.jsp"></forward>
</action>
<form-bean name="RetrieveReportDynaForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="GRP_MNEMONIC" type="java.lang.String"
initial="" />
<form-property name="POL_MNEMONIC" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC1" type="java.lang.String"
initial="" />
<form-property name="ELMORG_MNEMONIC1" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC2" type="java.lang.String"
initial="" />
<form-property name="ELMORG_MNEMONIC2" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC3" type="java.lang.String"
initial="" />
<form-property name="ELMORG_MNEMONIC3" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC4" type="java.lang.String"
initial="" />
<form-property name="ELMORG_MNEMONIC4" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC5" type="java.lang.String"
initial="" />
<form-property name="ELMORG_MNEMONIC5" type="java.lang.String"
initial="" />
<form-property name="GRP_MNEMONIC6" type="java.lang.String"
initial="" />
<form-property name="RC_MNEMONIC" type="java.lang.String"
initial="" />
<form-property name="RC_LABEL" type="java.lang.String"
initial="" />
<form-property name="RC_MANAGER" type="java.lang.String"
initial="" />
<form-property name="RC_CODE" type="java.lang.String"
initial="" />
<form-property name="RC_MANAGER_EMAIL" type="java.lang.String"
initial="" />
<form-property name="actionType" type="java.lang.String"
initial="" />
</form-bean> -
Cannot find bean in html:write gag
hi everybody
i am new to struts
in my application i am getting the following error
Cannot find bean error in any scope
in my code
in jsp i have given
logic:messagesPresent>
<UL>
<html:messages id="error" message="false">
<LI><bean:write name="error"/></LI>
</html:messages>
</UL>
</logic:messagesPresent>
and in my validate method in action form
i have given
ActionErrors errors = new ActionErrors();
errors.add(text parameter,ActionError parameter)
while creating ActionError Object i am passing one key that is refering the message in property file
any body can help me to resolve this problem
thanks in advanceGood Morning here!
Thank you all for the fabulous responses!
First of all, let me mention an important Fact. I am using The Struts Layout Library to build dependent Combo Boxes. so My enclosing html tag is <html:layout>
I am not sure If this has an influence on how Struts verifies the existence of Session Beans/Variables.
As I mentioned before: Action Class1 puts some variables in session and forwards to the JSP page in Question, those values load well the first time, and get printed in the JSP.
The JSP page has an Action Class2, triggered by a submit button, Action Class2 forwards to the same JSP page, But when this Action Class2 is called the values that were put in Session using Action Class1 get Lost.
tolmank, your reply is Very Interesting, because my server is internally changing my IP address to somename:8080. Are you sure this is what definitely could be causing the problem?
Thanks to all of you guys!
God Bless.
Post your comments... and let me know what you think. -
Cannot find bean in html:write
hi everybody
i am new to struts
in my application i am getting the following error
Cannot find bean error in any scope
in my code
in jsp i have given
logic:messagesPresent>
<UL>
<html:messages id="error" message="false">
<LI><bean:write name="error"/></LI>
</html:messages>
</UL>
</logic:messagesPresent>
and in my validate method in action form
i have given
ActionErrors errors = new ActionErrors();
errors.add(text parameter,ActionError parameter)
while creating ActionError Object i am passing one key that is refering the message in property file
any body can help me to resolve this problem
thanks in advanceGood Morning here!
Thank you all for the fabulous responses!
First of all, let me mention an important Fact. I am using The Struts Layout Library to build dependent Combo Boxes. so My enclosing html tag is <html:layout>
I am not sure If this has an influence on how Struts verifies the existence of Session Beans/Variables.
As I mentioned before: Action Class1 puts some variables in session and forwards to the JSP page in Question, those values load well the first time, and get printed in the JSP.
The JSP page has an Action Class2, triggered by a submit button, Action Class2 forwards to the same JSP page, But when this Action Class2 is called the values that were put in Session using Action Class1 get Lost.
tolmank, your reply is Very Interesting, because my server is internally changing my IP address to somename:8080. Are you sure this is what definitely could be causing the problem?
Thanks to all of you guys!
God Bless.
Post your comments... and let me know what you think. -
Hi
i have a form from which i am gettin values and i am using struts to get those values and perform actions in my DAO,
i am able to retrieve values from DAO but the value is not gettin printed in front end.. its throwing
"javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope" error
got any suggestions
thankxGot the solution,. i had closed my <html:form> before closing one of my <html:form>
thankx -
I am trying to access a java bean through a servlet..
the bean is defined in the package com.mycomp
when i use this bean using test.jsp it works fine it finds the package com.mycomp.. but when i am using the Servlet it cannot find the package...when i am trying to compile the servlet it says it cannot resolve the symbol class ConnectionBean
it cannot find the package com.mycomp
your help will be appreciatied....
here is the structure of files:
tomcat
webapps
myapp
jsp
-test.jsp
WEB-INF
classes
-PropertyServlet.java
-PropertyServlet.class
-ConnectionBean.java
com
mycomp
-ConnectionBean.class
I have tried importing in the servlet import com.mycomp.*; but i still get an error com.mycomp not found...
I have also tried importing the class itself by import com.mycomp.ConnectionBean;
I still get the package com.mycomp not found;
is there any xml file or anything that i need to edit so servlets can read the packages located in classes folder?me also same problem...
this class path is included in server itself..
or we can set during compiling time...
then this is my compile.bat file please check
set classpath=%CLASSPATH%; ./WEB-INF/classes;
@echo off
javac -d ./WEB-INF/classes/ ./dev/beans/*.java
javac -d ./WEB-INF/classes/ ./dev/ContentManagement/beans/*.java
javac -d ./WEB-INF/classes/ ./dev/servlets/*.java
and my servlet file like this below..
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.deploy.servlet.*;
public class ControlServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Testing");
/* if (request.getParameter("pageName")=="CEOSpeak")
CEOBean CB = new CEOBean();
if (request.getParameter("actionType")=="add")
else if (request.getParameter("actionType")=="edit")
else if (request.getParameter("actionType")=="delete")
if(CB.deleteCEO(request.getParameter("CEOId")))
response.sendRedirect("CEO_Speaks.jsp"); -
Dear all,
First of all sorry, if this is not the right place for my question.
I am facing some problem with the XFire Webservices. When i am trying to access the WSDL through the url. server is throwing the following exception :
javax.servlet.ServletException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:143)
org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:107)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
org.jdom.Namespace.getNamespace(Namespace.java:164)
org.codehaus.xfire.util.NamespaceHelper.getUniquePrefix(NamespaceHelper.java:58)
org.codehaus.xfire.aegis.type.basic.BeanType.writeSchema(BeanType.java:560)
org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:224)
org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:233)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createDocLitPart(WSDLBuilder.java:403)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createPart(WSDLBuilder.java:355)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.writeParameters(WSDLBuilder.java:509)
cont.......
I am not able to figure out the root cause for this. The service.xml file looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<!-- START Service.xml -->
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<!-- Construct the castor service factory by Spring -->
<bean id="castorTypeRegistry" class="org.codehaus.xfire.castor.CastorTypeMappingRegistry"/>
<bean id="bindingProvider" class="org.codehaus.xfire.aegis.AegisBindingProvider">
<constructor-arg ref="castorTypeRegistry"/>
</bean>
<bean id="castorServiceFactory" class="org.codehaus.xfire.service.binding.ObjectServiceFactory">
<constructor-arg index="0" ref="xfire.transportManager"/>
<constructor-arg index="1" ref="bindingProvider"/>
</bean>
<service>
<name>ReleaseManager</name>
<namespace>ReleaseManager</namespace>
<serviceClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManager</serviceClass>
<implementationClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManagerImpl</implementationClass>
<schemas>
<schema>META-INF/schema/release-impact-worksheet-3.2.0.xsd</schema>
</schemas>
<style>document</style>
<serviceFactory>#castorServiceFactory</serviceFactory>
</service>
</beans>
<!-- END Service.xml-->
The issue which i am facing is it due to the problem with the service.xml (Which i dont think so..), Or is it any thing to do with the XSD file which i am using.
Can any body give me some guide lines for this ????
Thanks in advance.
Thanks and Regards,
Manjunath.Any one any thoughts..
I need to find out the solution for this as soon as possible; Not able to proceed further...
Thanks and Regards,
Manjunath. -
Javax.servlet.ServletException & java.lang.NoClassDefFoundError
I am getting this javax.servlet.ServletException & java.lang.NoClassDefFoundError
exceptions while running jsp in .netbeans.
Iwas able to compile and run jsp pgms , but i am getting this error when i use jsp:useBean.I think the java class created is not in the proper path..netbeans is using tomcat server.The ide put the jsp's in the proper path. but it is not putting the java class i created with setter and getter methods.I also set the classpath. but din't work
I t is eating up my time!Pl. suggest me a solution!
Directory structure is :source file
c:/windows/.netbeans/3.5/samples/jsp
I guess the ide is putting all the class files(jsp) in
C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP
so i copied the userData.class from source dir to the above directory.
and i also did the
set CLASSPATH= C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP
in dos prompt
pl. find the code below.
Html:
<HTML>
<HEAD>
<TITLE>getData</TITLE>
</HEAD>
<BODY>
<form method = post action="saveData.jsp">
What's your Name : <input type=text name =username size=10>
<br>
What's Age : <input type=text name=age size=10>
<br>
What's ur email id : <input type=text name=email size=10>
<input type=submit>
</FORM>
</BODY>
</HTML>
SaveData.jsp
<jsp:useBean id="user" class="JSP.userData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<html>
<head><title>using bean</title></head>
<body>
--Continue
Thank u
</body>
</html>
userData.java
* userData.java
* Created on February 12, 2004, 1:06 PM
package JSP;
* @author amano
public class userData {
String userName;
int age;
String email;
/** Creates a new instance of userData */
public userData()
public void setUsername(String str)
userName=str;
public void setAge(int str)
age=str;
public void setEmail(String str)
email=str;
public String getUsername()
return userName;
public int getAge()
return age;
public String getEmail()
return email;when i click on the submit button i get the following error msg.
Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
javax.servlet.ServletException: JSP/user_data
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:349)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
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:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:534)
root cause
java.lang.NoClassDefFoundError: JSP/user_data
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
at java.lang.Class.getConstructor0(Class.java:1922)
at java.lang.Class.newInstance0(Class.java:278)
at java.lang.Class.newInstance(Class.java:261)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.load(IDEJspServlet.java:106)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.loadIfNecessary(IDEJspServlet.java:150)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:160)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
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:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:148)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:534) -
Javax.servlet.UnavailableException: Cannot load a validator resource from '
sorry to interrupt.
i m using Struts1.1/jsp.
When i comment out the codes for validation plugin the projects works fine
but when its on its gives the following Exceptions
Sep 18, 2008 4:17:07 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_13\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.5.0_15\bin;C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin;C:\Program Files\ant\bin;C:\Program Files\hibernate-3.2\lib;C:\Program Files\hibernate-3.2;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Apache Group\Tomcat 4.1\bin
Sep 18, 2008 4:17:07 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 18, 2008 4:17:07 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2219 ms
Sep 18, 2008 4:17:07 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 18, 2008 4:17:07 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
Sep 18, 2008 4:17:07 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.TldConfig).
log4j:WARN Please initialize the log4j system properly.
Sep 18, 2008 4:17:12 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
Sep 18, 2008 4:17:12 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
Sep 18, 2008 4:17:12 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
Sep 18, 2008 4:17:33 PM org.apache.struts.validator.ValidatorPlugIn init
SEVERE: Connection timed out: connect
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1567)
at org.apache.commons.validator.ValidatorResources.<init>(ValidatorResources.java:186)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:233)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:164)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Sep 18, 2008 4:17:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet strutsController as unavailable
Sep 18, 2008 4:17:33 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /valid threw load() exception
javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:174)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Sep 18, 2008 4:17:34 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
Sep 18, 2008 4:17:34 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
Sep 18, 2008 4:17:34 PM org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
Sep 18, 2008 4:17:38 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 18, 2008 4:17:38 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 18, 2008 4:17:38 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/109 config=null
Sep 18, 2008 4:17:38 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 18, 2008 4:17:38 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 31312 ms
Sep 18, 2008 4:17:42 PM org.apache.struts.tiles.TilesRequestProcessor initDefinitionsMapping
INFO: Tiles definition factory found for request processor ''.
[Length is less than1]
Sep 18, 2008 4:17:42 PM org.apache.struts.validator.ValidatorForm validate
SEVERE: No such validation method: org.apache.struts.validator.FieldChecks.validateMinLength(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: No such validation method: org.apache.struts.validator.FieldChecks.validateMinLength(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:603)
at org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:533)
at org.apache.commons.validator.Field.validateForRule(Field.java:766)
at org.apache.commons.validator.Field.validate(Field.java:846)
at org.apache.commons.validator.Form.validate(Form.java:290)
at org.apache.commons.validator.Validator.validate(Validator.java:354)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:112)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:921)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Unknown Source)
/*********************************************Codes******************************************************/
my codes are as follows:
struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<!--
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.
Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.
NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->
<struts-config>
<form-beans>
<form-bean name="myform" type="src.Myform">
<form-property
name="name"
type="java.lang.String"/>
</form-bean>
</form-beans>
<global-exceptions/>
<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>
<action-mappings>
<action path="/myAction" type="src.MyAction" name="myform" scope="request" validate="true" input="/index.jsp">
<forward name="wel" path="/wel.jsp"/>
</action>
<!--<action
path="/AddressJavascriptValidation"
type="roseindia.net.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/pages/AddressJavascriptValidation.jsp">
<forward name="success" path="/pages/success.jsp"/>
</action>-->
</action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="resources/application"/>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
<set-property property="moduleAware" value="true"/>
</plug-in>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
<set-property property="stopOnFirstError" value="false"/>
</plug-in>
</struts-config>
validation.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<form-validation>
<formset>
<!-- <form name="form" >
<field property="name" depends="required">
<arg0 key="myform.name"/></field>
</form>
-->
<form name="myform">
<field property="name" depends="minlength">
<arg0 key="myform.name"/>
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<var>
<var-name>minlength</var-name>
<var-value>2</var-value>
</var>
</field>
</form>
<!--<form name="AddressForm">
<field property="name"
depends="required">
<arg key="AddressForm.name"/>
</field>
<field property="address"
depends="required">
<arg key="AddressForm.address"/>
</field>
<field property="emailAddress"
depends="required">
<arg key="AddressForm.emailAddress"/>
</field>
</form>-->
</formset>
</form-validation>
validator-rules.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<!--
This file contains the default Struts Validator pluggable validator
definitions. It should be placed somewhere under /WEB-INF and
referenced in the struts-config.xml under the plug-in element
for the ValidatorPlugIn.
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>
These are the default error messages associated with
each validator defined in this file. They should be
added to your projects ApplicationResources.properties
file or you can associate new ones by modifying the
pluggable validators msg attributes in this file.
# Struts Validator Error Messages
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.
errors.maxlength={0} can not be greater than {1} characters.
errors.invalid={0} is invalid.
errors.byte={0} must be a byte.
errors.short={0} must be a short.
errors.integer={0} must be an integer.
errors.long={0} must be a long.
errors.float={0} must be a float.
errors.double={0} must be a double.
errors.date={0} is not a date.
errors.range={0} is not in the range {1} through {2}.
errors.creditcard={0} is an invalid credit card number.
errors.email={0} is an invalid e-mail address.
-->
<form-validation>
<global>
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
msg="errors.required">
<javascript><![CDATA[
function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oRequired = new required();
for (x in oRequired) {
var field = form[oRequired[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (trim(value).length == 0) {
if (i == 0) {
focusField = field;
fields[i++] = oRequired[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
// Trim whitespace from left and right sides of s.
function trim(s) {
return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
]]>
</javascript>
</validator>
<validator name="requiredif"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequiredIf"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.required">
</validator>
<validator name="minlength"
classname="org.apache.struts.validator.FieldChecks"
method="validateMinLength"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.minlength">
<javascript><![CDATA[
function validateMinLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMinLength = new minlength();
for (x in oMinLength) {
var field = form[oMinLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMin = parseInt(oMinLength[x][2]("minlength"));
if ((trim(field.value).length > 0) && (field.value.length < iMin)) {
if (i == 0) {
focusField = field;
fields[i++] = oMinLength[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
}]]>
</javascript>
</validator>
<validator name="maxlength"
classname="org.apache.struts.validator.FieldChecks"
method="validateMaxLength"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.maxlength">
<javascript><![CDATA[
function validateMaxLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMaxLength = new maxlength();
for (x in oMaxLength) {
var field = form[oMaxLength[x][0]];
if (field.type == 'text' ||
field.type == 'textarea') {
var iMax = parseInt(oMaxLength[x][2]("maxlength"));
if (field.value.length > iMax) {
if (i == 0) {
focusField = field;
fields[i++] = oMaxLength[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
}]]>
</javascript>
</validator>
<validator name="mask"
classname="org.apache.struts.validator.FieldChecks"
method="validateMask"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.invalid">
<javascript><![CDATA[
function validateMask(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMasked = new mask();
for (x in oMasked) {
var field = form[oMasked[x][0]];
if ((field.type == 'text' ||
field.type == 'textarea') &&
(field.value.length > 0)) {
if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
if (i == 0) {
focusField = field;
fields[i++] = oMasked[x][1];
isValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return isValid;
function matchPattern(value, mask) {
return mask.exec(value);
}]]>
</javascript>
</validator>
<validator name="byte"
classname="org.apache.struts.validator.FieldChecks"
method="validateByte"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.byte"
jsFunctionName="ByteValidations">
<javascript><![CDATA[
function validateByte(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oByte = new ByteValidations();
for (x in oByte) {
var field = form[oByte[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oByte[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
if (i == 0) {
focusField = field;
fields[i++] = oByte[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="short"
classname="org.apache.struts.validator.FieldChecks"
method="validateShort"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.short"
jsFunctionName="ShortValidations">
<javascript><![CDATA[
function validateShort(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oShort = new ShortValidations();
for (x in oShort) {
var field = form[oShort[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oShort[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
if (i == 0) {
focusField = field;
fields[i++] = oShort[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="integer"
classname="org.apache.struts.validator.FieldChecks"
method="validateInteger"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.integer"
jsFunctionName="IntegerValidations">
<javascript><![CDATA[
function validateInteger(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oInteger = new IntegerValidations();
for (x in oInteger) {
var field = form[oInteger[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
if (!isAllDigits(value)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oInteger[x][1];
} else {
var iValue = parseInt(value);
if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
if (i == 0) {
focusField = field;
fields[i++] = oInteger[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
function isAllDigits(argvalue) {
argvalue = argvalue.toString();
var validChars = "0123456789";
var startFrom = 0;
if (argvalue.substring(0, 2) == "0x") {
validChars = "0123456789abcdefABCDEF";
startFrom = 2;
} else if (argvalue.charAt(0) == "0") {
validChars = "01234567";
startFrom = 1;
} else if (argvalue.charAt(0) == "-") {
startFrom = 1;
for (var n = startFrom; n < argvalue.length; n++) {
if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
return true;
}]]>
</javascript>
</validator>
<validator name="long"
classname="org.apache.struts.validator.FieldChecks"
method="validateLong"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.long"/>
<validator name="float"
classname="org.apache.struts.validator.FieldChecks"
method="validateFloat"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.float"
jsFunctionName="FloatValidations">
<javascript><![CDATA[
function validateFloat(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oFloat = new FloatValidations();
for (x in oFloat) {
var field = form[oFloat[x][0]];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio') {
var value = '';
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
if (si >= 0) {
value = field.options[si].value;
} else {
value = field.value;
if (value.length > 0) {
// remove '.' before checking digits
var tempArray = value.split('.');
var joinedString= tempArray.join('');
if (!isAllDigits(joinedString)) {
bValid = false;
if (i == 0) {
focusField = field;
fields[i++] = oFloat[x][1];
} else {
var iValue = parseFloat(value);
if (isNaN(iValue)) {
if (i == 0) {
focusField = field;
fields[i++] = oFloat[x][1];
bValid = false;
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
return bValid;
}]]>
</javascript>
</validator>
<validator name="double"
classname="org.apache.struts.validator.FieldChecks"
method="validateDouble"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.double"/>
<validator name="date"
classname="org.apache.struts.validator.FieldChecks"
method="validateDate"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.date"
jsFunctionName="DateValidations">
<javascript><![CDATA[
function validateDate(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oDate = new DateValidations();
for (x in oDate) {
var value = form[oDate[x][0]].value;
var datePattern = oDate[x][2]("datePatternStrict");
if ((form[oDate[x][0]].type == 'text' ||
form[oDate[x][0]].type == 'textarea') &&
(value.length > 0) &&
(datePattern.length > 0)) {
var MONTH = "MM";
var DAY = "dd";
var YEAR = "yyyy";
var orderMonth = datePattern.indexOf(MONTH);
var orderDay = datePattern.indexOf(DAY);
var orderYear = datePattern.indexOf(YEAR);
if ((orderDay < orderYear && orderDay > orderMonth)) {
var iDelim1 = orderMonth + MONTH.length;
var iDelim2 = orderDay + DAY.length;
var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
if (iDelim1 == orderDay && iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
} else if (iDelim1 == orderDay) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
} else if (iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
} else {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
var matched = dateRegexp.exec(value);
if(matched != null) {
if (!isValidDate(matched[2], matched[1], matched[3])) {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else {
if (i == 0) {
focusField = form[oDate[x][0]];
fields[i++] = oDate[x][1];
bValid = false;
} else if ((orderMonth < orderYear && orderMonth > orderDay)) {
var iDelim1 = orderDay + DAY.length;
var iDelim2 = orderMonth + MONTH.length;
var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
if (iDelim1 == orderMonth && iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
} else if (iDelim1 == orderMonth) {
dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
} else if (iDelim2 == orderYear) {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
} else {
dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");Hello,
thanks for your contribution. But how I already said we have seen that the first error message:
The error is: javax.servlet.UnavailableException: Cannot load a validator resource from '/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml'
But behind that message is an additional message that describes the real root cause of the problem:
SEVERE: Cannot find resource "org/apache/commons/digester/xmlrules/digester-rules.dtd"
org.apache.commons.digester.xmlrules.XmlLoadException: Cannot find resource
"org/apache/commons/digester/xmlrules/digester-rules.dtd"
Unfortunately we have no idea why the dtd file can not be loaded. The appropriate line of code is:
getClass().getResourceAsStream("<link_to_resource")
And this returns a NULL object. The NULL object causes the general exception and finishes the instantiation of Struts.
Any additonal hints?
Regards, Maik -
Hi all,
I faced the following issues while calling the JNI library from Struts Action Class.
Initially got the following exception -
java.lang.UnsatisfiedLinkError: no arapi in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at com.cisco.ar.api.ARAPINativeImpl.<init>(ARAPINativeImpl.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.cisco.ar.api.ARAPI.<init>(ARAPI.java:191)
After setting the required "so" files in the LD_LIBRARY_PATH, I got the following exception -
java.lang.UnsatisfiedLinkError: /opt/CSCOar/lib/libarapi.so: Can't load IA 32-bit .so on a IA 32-bit platform
I seached the java forums and found that the issue could be coz of JDK. So, I reverted my JDK 1.5 Update 10 to JDK 1.5 Update 7 and again got another exception as follows-
javax.servlet.ServletException: /opt/CSCOar/lib/libarapi.so: libstdc++.so.6: cannot open shared object file: No such file or directory
So, I am unable to call the JNI. Please let me know if I am missing anything in environment settings. Please help to resolve this.
TIA,
DeepaHi,
My questions are the same.
But I have also set up the classpath for the servlet component.
After that, I found I can't call user-defined obecjts in my servlet.
Even when I just write a simple Java command-line progarm which call the outside objects, it also can't find the user-defined objects; unless I move out the setup of CLASSPATH. So does anyone have the further solution? or tell me where I can find the answer!
Thank you so much! -
Javax.servlet.ServletException: Before start of result set
I have a page where i want to put items that have been entered into a bean and put them into my SQL database. Firs of all i want to insert some value into my question table and then I use the SELECT LAST_INSERT_ID() function in mySQL to get the last incremented ID from the first statement. As you can see I then want to use this ID and insert it into the other statements to relate the tables but I get an exception which is shown below. The frist insert staemet works fine when the rest is commented out but when i try it with the other 2 insert statements it throws this back at me.
javax.servlet.ServletException: Before start of result set
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.authoring.question_005fmanager.process_005fquestion_jsp._jspService(process_005fquestion_jsp.java:453)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
java.sql.SQLException: Before start of result set
com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:4424)
com.mysql.jdbc.ResultSet.getNativeInt(ResultSet.java:6210)
com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1335) org.apache.jsp.authoring.question_005fmanager.process_005fquestion_jsp._jspService(process_005fquestion_jsp.java:126)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
My code is shown here
// gets the feedback string parameters
if (request.getParameterValues("feedbackBox") != null) {
String [] feedbackList = request.getParameterValues("feedbackBox");
questionData.feedback = feedbackList;
//gets the session username variable
String insertQuestion1__username = null;
if (session.getValue("MM_Username") != null) {
insertQuestion1__username = (String)session.getValue("MM_Username");
//Creates a new mySQL date
java.sql.Date currentDate = new java.sql.Date((new java.util.Date()).getTime());
//goes thorugh each element of the scores array and calculates maxScore
questionData.maxScore = 0;
for (int i = 0; i < questionData.scores.length; i++) {
questionData.maxScore = questionData.maxScore + questionData.scores;
Driver DriverinsertQuestion = (Driver)Class.forName(MM_connQuestion_DRIVER).newInstance();
Connection ConninsertQuestion1 = DriverManager.getConnection(MM_connQuestion_STRING, MM_connQuestion_USERNAME,
MM_connQuestion_PASSWORD);
questionData.numOutcomes = questionData.choices.length;
PreparedStatement insertQuestion1 =
ConninsertQuestion1.prepareStatement("INSERT INTO Question.question (Topic_ID, Description, Image, Author, Created_Date, Max_Score, Question_Type) VALUES ('"
+ questionData.topicID + "', '"
+ questionData.questionText + "', '"
+ questionData.questionImage + "', '"
+ insertQuestion1__username + "', '" + currentDate
+ "', " + questionData.maxScore + ", '"
+ questionData.questionType + "') ");
insertQuestion1.executeUpdate();
PreparedStatement StatementlastID = ConninsertQuestion1.prepareStatement("SELECT LAST_INSERT_ID()");
ResultSet lastID = StatementlastID.executeQuery();
int questionID = lastID.getInt(1);
Driver DriverinsertQuestion2 = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
Connection ConninsertQuestion2 = DriverManager.getConnection(MM_connAnswer_STRING, MM_connAnswer_USERNAME,
MM_connAnswer_PASSWORD);
PreparedStatement insertQuestion2 =
ConninsertQuestion2.prepareStatement("INSERT INTO Answer.question (Question_ID, Question_Description, Question_Type, Topic, Number_Outcomes, Question_Wording) VALUES ('"
+ questionID + "', '" + questionData.questionLabel
+ "', '" + questionData.questionType + "', '"
+ questionData.questionType + "', '"
+ questionData.topicID + "', '"
+ questionData.numOutcomes + "', '"
+ questionData.questionText + "' ) ");
insertQuestion2.executeUpdate();
Driver DriverinsertOutcomes = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
Connection ConninsertOutcomes = DriverManager.getConnection(MM_connAnswer_STRING, MM_connAnswer_USERNAME,
MM_connAnswer_PASSWORD);
for (int i = 0; i < questionData.numOutcomes; i++) {
PreparedStatement insertOutcomes =
ConninsertOutcomes.prepareStatement("INSERT INTO Answer.outcome (Question_ID, Outcome_Number, Outcome_Text, Score, Feedback) VALUES ( '"
+ questionID + "', '" + i + "', '"
+ questionData.choices[i] + "', '"
+ questionData.scores[i] + "', '"
+ questionData.feedback[i] + "' ) ");
insertOutcomes.executeUpdate();further to Limo2kz's problem, LAST_INSERT_ID() will return 0 if the last INSERT statement actually has inserted 0 records. this could happen if the previous INSERT attempt has failed.
as far as i can remember, you should find out if the account or user that you are currently using to connect to MySQL database is allowed to do more SQL executions and create more SQL connections at certain given time (i.e., 10 executions in 1 hour, 10 connections in 1 hour). otherwise, you would have subsequent SQL exceptions because the database server won't allow you to execute them, thus giving you a null ResultSet. -
Javax.servlet.ServletException: Unknown SMTP host
Hi
I am using tomcat and trying to send emails. I keep getting a javax.servlet.ServletException: Unknown SMTP host error.
I initially thought the problem was with the line: props.put("mail.smtp.host", "makethegrade.co.za"); But i checked the smtp info with the guys i'm hosing with and they said its right
I am currently setting the fields manually, so it can't be a problem with passing data around in the webpage
In my WEB-INF/lib i have jaf-1.0.2 and javamail-1.4.1 (i.e. mail.jar and activation.jar)
The code for my mailer bean is:
package mailer;
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
public final class MailerBean extends Object implements Serializable {
/* Bean Properties */
private String to = null;
private String from = null;
private String subject = null;
private String message = null;
public static Properties props = null;
public static Session session = null;
static {
/* Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "makethegrade.co.za");
session = Session.getDefaultInstance(props, null);
/* Setter Methods */
public void setTo(String to) {
this.to = to;
public void setFrom(String from) {
this.from = from;
public void setSubject(String subject) {
this.subject = subject;
public void setMessage(String message) {
this.message = message;
/* Sends Email */
public void sendMail() throws Exception {
if(!this.everythingIsSet())
throw new Exception("Could not send email.");
try {
MimeMessage message = new MimeMessage(session);
message.setRecipient(Message.RecipientType.TO,
new InternetAddress(this.to));
message.setFrom(new InternetAddress(this.from));
message.setSubject(this.subject);
message.setText(this.message);
Transport.send(message);
} catch (MessagingException e) {
throw new Exception("Caught in sendMail" + e.getMessage());
/* Checks whether all properties have been set or not */
private boolean everythingIsSet() {
if((this.to == null) || (this.from == null) ||
(this.subject == null) || (this.message == null))
return false;
if((this.to.indexOf("@") == -1) ||
(this.to.indexOf(".") == -1))
return false;
if((this.from.indexOf("@") == -1) ||
(this.from.indexOf(".") == -1))
return false;
return true;
}and the error i get is:
org.apache.jasper.JasperException: Exception in JSP: /processingPages/mailer.jsp:17
14: mailer.setFrom("[email protected]");
15: mailer.setSubject("mailer test");
16: mailer.setMessage("TEst test test");
17: mailer.sendMail();
18:
19: %>
20: </jsp:useBean>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
javax.servlet.ServletException: Unknown SMTP host: mail.yourisp.com
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.lang.Exception: Unknown SMTP host: mail.yourisp.com
mailer.MailerBean.sendMail(MailerBean.java:54)
org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Tomcat logs give:
Jul 15, 2009 10:50:35 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.Exception: Unknown SMTP host: mail.yourisp.com
at mailer.MailerBean.sendMail(MailerBean.java:54)
at org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
If anyone needs any other details feel free to ask.
Any help or any pointers to a place to find a solution would be deeply appreciated
ThanksAll I can see is that you are running this in a web application. In most web application containers there's a place where you configure your mail providers and mail sessions. You seem to be ignoring that (you aren't using JNDI to get a session for example) but you are getting the default instance, so perhaps that uses that configuration anyway.
Maybe you are looking for
-
Hi, in my ssrs report i have two parameters, accounts and Manager ,there is a cascading between the accounts parameter and manager parameter, as per the cascading we will get managers names based on the account we selected in the accounts parameter,
-
How to make a loop that changes two different movieclips from visible to invisible every second
I am writing some code that puzzles me. It may be, because I have a cold or because I've never needed to do anything like this. I want to have two movieclips one is visible and one is not. then one second passes the one that was visible is invisible
-
Design a sheduler, like in outlook express
hi I want to design a sheduler like we have in outlook Express, can some one guide???? Is there any website describing to design a one in details
-
Counter column in the Receiver file
Hi All, My requirement --> Souce is IDOC and target is a file. In the Receiver file there is one column counter which will indicate the counter for each line... So the Receiver file should be like this FHEAD,0001 THEAD,00002,00001,20081103 TDETL,0003
-
TS1404 ipod plays but no menu display
my ipod plays but i cannot see anything on the display. I have reset it, saw the apple logo but still no display. how to I reset it back to normal.