Hi , I am new to STRUTS and am trying to work out an example from a PDF "StrutsSurvival Guide" PDF by Srikanth Shenoy. When I execute the example I get the following error on the internet browser..
I saved it and restarted tomcat but still get the same error..
javax.servlet.ServletException: Exception creating bean of class java.mybank.app1.CustomerForm: {1} org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) org.apache.jsp.CustomerDetails_jsp._jspService(CustomerDetails_jsp.java:91) 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)
Can anyone please help...
Thanks, Ram
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
posted
0
In my experience this error is generally caused by one of the following:
1. There is no public, no-arguments constructor for the ActionForm bean. 2. There is a public constructor, but it's throwing an exception. 3. The bean should exist already in the specified scope, but it doesn't. Sometimes just instantiating the bean and putting it in the correct scope before forwarding to the JSP can solve the problem. [ January 10, 2006: Message edited by: Merrill Higginson ]
I understand the first two points about constructors. I have listed my ActionForm class earlier and I am listing it again.. since I have not declared any constructor, it will automatically create the no-arg constructor. I am not sure what the 3 rd point you have mentioned means. The CustomerDetails.jsp listed in my initial querry is the first jsp I am invoking from my browser.
public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; }
} >>
What is driving me crazy is the error message , it is so cryptic not sure what I should look for based on this message...
javax.servlet.ServletException: Exception creating bean of class java.mybank.app1.CustomerForm: {1} org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
Rgeards, Ram
Ram Murthy
Ranch Hand
Joined: Aug 02, 2005
Posts: 91
posted
0
Never mind, I created the classes again in a different package and it worked. Not sure the root cause but think since my classes were in the package starting with the name java, it was not working.
Thanks for all the responses
Cheers, Ram
Matt Tyson
Greenhorn
Joined: Jun 29, 2006
Posts: 5
posted
0
This is the exact same error I've been beating my head against for a couple days now. Never seen it before. I have narrowed the project down to the simplest struts app, just 1 form, 1 action and 1 jsp.
I've tried recreating the project with a different package structure.
Its a rough error.
Here's the struts-config.xml (relavant parts, rest is empty):
My guess is the original poster has already started their IDE at least once in the intervening 2.5 years.
Kothandaraman Narashimman
Greenhorn
Joined: Jul 02, 2008
Posts: 4
posted
0
Actually i got the same type of situation with the same issue. so i'm trying to help the user's who are all getting this issue in future. May be you got that in wrong way..
Cheers,
Kodan.
Artur Grigoryan
Greenhorn
Joined: Oct 30, 2009
Posts: 1
posted
0
I had the same problem and the cause was refactoring of my formbean. I changed the name to previous and the issue was resolveded.
Haris Farooque
Greenhorn
Joined: Nov 30, 2009
Posts: 6
posted
0
hi all,
I am having the same problem here with my CompanyRegistrationForm and CompanyRegistrationAction. amazing fact is that, I have successfully made 2 other forms and their actions and they are working fine but i don't what is wrong with my 3rd form(CompanyRegistrationForm) i have checked all the settings in struts-config.xml and in the companyRegistration.jsp and i didn't find anything wrong there. also thre are no Typo mistakes in any of these files.
Please suggest something if any of you have experienced similar issue before.
Haris, please start a new topic for your question, and in the new topic, post the relevant portions of your struts-config.xml file, the form bean class' code and the action class' code. When you post any source code, remember to UseCodeTags i.e. wrap your code in [code] [/code] tags...