• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

org.apache.jasper.JasperException: An exception occurred processing JSP page /jsps/ActionForms/Displ

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
I am writing this simple struts application . I am getting errors and its hard to debug since I dont know what exactly is going wrong. Please help me out in this..Thank you very much in advance.

Here is the struts-config.xml for the same:


This is the formBean--


This is the actionClass--


This is the JSP for the same--


The transfer object is as follow-

This the output view--


This is the web.xml for the project--


Error I get is::
I get this error --


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspService(DisplayAddProductForm_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:487)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspx_meth_html_005fform_005f0(DisplayAddProductForm_jsp.java:138)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspService(DisplayAddProductForm_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)







Please help ..I m trying to debug the app for 2 days now!



 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, that's an old version of Struts--any reason you're learning it?

In any case--the thing I'd try first would be to rename the form bean by removing the "_XML" part--I don't know if it'll fix the issue, but it's easy to try.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason why I am learning Struts1 is that there are lot many applications in that. it adheres to basic rules like form-bean.
Its widely used .
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@David..removing of _XML doesnt work.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kalith Aazad wrote:The reason why I am learning Struts1 is that there are lot many applications in that. it adheres to basic rules like form-bean. Its widely used .


I was actually referring to the 1.0 part; that's like a decade old. If you're happy doing maintenance work, Struts 1 is fine--enjoy!

(Although I wouldn't call "form-bean" a "basic rule"--other frameworks behave quite differently.)
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the Javadocs for ActionMessage--I don't recall for 1.0, but nothing 1.1+ takes an immediate string; they're expecting a resource/message key.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am confused...You want me to create a message resource file in the WEB-INF/classes directory for the error to be removed??
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you look at the Javadocs for the version of Struts you're using? I have no idea what version you're using-this makes it more difficult to help.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to check the version of Struts?
I have imported the following jar files and tld's in my eclipse folder
here is a snapshot of it.
Image of JAR and taglib files
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't even know what version of Struts you're using?!
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the thing i found out of struts.jar from manifest file.


Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.1
Created-By: 1.3.1_04-b02 (Sun Microsystems Inc.)
Extension-Name: Struts Framework
Specification-Title: Struts Framework
Specification-Vendor: The Apache Software Foundation
Specification-Version: 1.2.9
Implementation-Title: Struts Framework
Implementation-Vendor: The Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: 1.2.9
Class-Path: commons-beanutils.jar commons-digester.jar commons-fileup
load.jar commons-logging.jar commons-validator.jar jakarta-oro.jar


 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My statement about reading the Javadocs for ActionMessage still apply: it expects a key, not a string literal.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(Note I'm giving you a hint about how to solve the problem: if you do not read the Javadocs, you may not discover how to do what it is you wish to do.)
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I am creating a applicationResource.properties file in the src/resources directory and mapping it onto struts-config.xml and will then create entities in the applicationResource.properties file to check if the appropriate keys are being called. Will keep you posted on this. I appreciate the help,.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is one solution; there is another.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the thing i did,
I created the entity:
<message-resources parameter="resources.MessageResources" />

in the resources folder.

After that i added:
error.productName = Product name not found
error.price = price not entered
error.description = description not entered

to the MessageResources.properties
After that I modified the validate method in the ActionForm

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors actionErrors = new ActionErrors();
if (this.getProductName() == null)
actionErrors.add("ProductName", new ActionMessage(
"error.productName"));
if (this.getPrice() == null)
actionErrors.add("ProductPrice", new ActionMessage(
"error.price"));
if (this.getDescription() == null)
actionErrors.add("ProductDescription", new ActionMessage(
"error.description"));
return actionErrors;
}

Now I still get the same error

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspService(DisplayAddProductForm_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.jsp.JspException: Exception creating bean of class chapter2.multiPageForms.ProductForm.ProductFormBean: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:487)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:457)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspx_meth_html_005fform_005f0(DisplayAddProductForm_jsp.java:138)
org.apache.jsp.jsps.ActionForms.DisplayAddProductForm_jsp._jspService(DisplayAddProductForm_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.


 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At what point does the error occur? Are you trying to access the JSP page directly? Did you understand when I told you that reading the documentation would show you how to avoid creating a resource file (although this does not appear to be the immediate problem)?

Side notes: why do you configure your taglibs in the web.xml? That hasn't been necessary for years. How do you expect this code to work (besides that it appears to be completely unnecessary)--if it's null, what do you think this code would do?
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This seems crazy, but I guess I used netbeans, as i used to use earlier, just tweaked the web.xml ...and cleaned and built the project.
Added the standard.jar and jstl.jar files
And the small app worked.

Thank you so very much for helping me out in this situation.I really appreciate it.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the final working Code for the entire app.

Web.xml--



struts-config.xml-->



ProductFormBean.java -->

ProductTO.java -->

SaveProductAction.java -->

DisplayAddProductForm.jsp -->

ShowProductForm.jsp -->



But thank you so much for guiding me.



 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
 
Kalith Aazad
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic