| Author |
Getting error while running BeerStruts example
|
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Please help!!!
While trying to run BeerStrtus example given in book, I encountered following 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: java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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
java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:146)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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.18 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.18
Can anyone kindly explain me what does it mean.
Thanks in advance.
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2691
|
|
veebhu singh wrote:While trying to run BeerStrtus example given in book,...
Which book? You may get more helpful responses if you copy that example here because not everyone has that whatever book.
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Devaka Cooray wrote:
veebhu singh wrote:While trying to run BeerStrtus example given in book,...
Which book? You may get more helpful responses if you copy that example here because not everyone has that whatever book.
This is HeadFirst Servlets and Jsp 2nd Edition.
following is my form.jsp
struts-config.xml is as following:-
following is my web.xml:-
Actually the thing is that while executing it through Tomcat 6.0, it is unable to locate org.apache.struts.action.ActionServlet.
Also, KINDLY explain me how is it created by container?
Thanks a lot.
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
it is unable to locate org.apache.struts.action.ActionServlet.
If that's the case it means that you have not included Struts library files into your application. You can download Struts 1.x from here and then include its jar files into your application...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Ankit Garg wrote:
it is unable to locate org.apache.struts.action.ActionServlet.
If that's the case it means that you have not included Struts library files into your application. You can download Struts 1.x from here and then include its jar files into your application...
rightly said, I had copied those jar files in TOMCAT's main lib, not in my webapp's lib.Now I have all struts-jars in my webapp's lib directory as well. But still it is not the end, I am getting following 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: java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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
java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:146)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
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)
WHICH IS BEYOND MY UNDERSTANDING.IS IT A TOMCAT SPECIFIC PROBLEM?CAN OTHER VERSION OF JARs (1.3.10 AND 1.3.8) WORKING TOGETHER CAUSE THIS PROBLEM?
BY THE WAY, I AM USING TOMCAT-6.0 AND I HAVE INCLUDED STRUTS-1.3.10 JARs.
IF THERE IS ANY OTHER CONFIGURATION REQUIRED,PLEEEEEZ INFORM ME.
THANKS A TON
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
You should not put Struts jars in Tomcat libs folder. Only include Struts library files in your web application. Also don't use multiple Struts versions in your app, use a single version of Struts jars in your application...
|
 |
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Ankit Garg wrote:You should not put Struts jars in Tomcat libs folder. Only include Struts library files in your web application. Also don't use multiple Struts versions in your app, use a single version of Struts jars in your application...
I did exactly same as you suggested.
no extra jar file in Tomcat's directory.
all downloaded jar files included in package struts-1.3.10 are included in webapp's lib directory.
Still i am getting one error:-
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
org.apache.struts.chain.commands.AbstractSelectAction.execute(AbstractSelectAction.java:71)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Should I include only the following jars as depicted in book Head First Servlets n Jsp
struts-taglib-1.3.10.jar
struts-core-1.3.10.jar
commons-beanutils-1.8.0.jar
commons-chain-1.2.jar
commons-digester-1.8.jar
On doing so,I am gettin following error:-
HTTP Status 404 - Servlet FrontController is not available
--------------------------------------------------------------------------------
type Status report
message Servlet FrontController is not available
description The requested resource (Servlet FrontController is not available) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.18
I am completely stucked.Please have some more patience to sort it out.
Thanking you.
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
What is the URL that you are entering in the browser?? I've not used Struts 1.x much, but looking at an example here, it seems that the path attribute of action tag in struts-config.xml should not have .do in the end...
|
 |
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Ankit Garg wrote:What is the URL that you are entering in the browser?? I've not used Struts 1.x much, but looking at an example here, it seems that the path attribute of action tag in struts-config.xml should not have .do in the end...
url I entered is as following
http://localhost:8080/BeerStruts/form.jsp
Actually when I removed the ".do" extension as you suggested, I am not getting any error.
But still I am getting a blank page with following url:-
http://localhost:8080/BeerStruts/Select.do
It seems that bean is not getting populated.
I have a confusion as well if I am not extracting parameters from form.jsp explicitly (like using getParameter or jsp:setProperty) then how will bean get populated?
|
 |
Prakash Mani - Attur
Ranch Hand
Joined: Oct 08, 2009
Posts: 100
|
|
|
You will get blank page with the same URL when you return "null" from the execute method...I have experienced this once.. if you cant still get it, post your action class(i think thats the only part you have not posted here)..that will be easy to debug your problem...
|
 |
veebhu singh
Greenhorn
Joined: Jun 19, 2010
Posts: 11
|
|
Prakash Attur wrote:You will get blank page with the same URL when you return "null" from the execute method...I have experienced this once.. if you cant still get it, post your action class(i think thats the only part you have not posted here)..that will be easy to debug your problem...
No, I am not able to sort it out.I am posting my "form,action and model" classes. Pleeez give it a look:-
FORM:-
ACTION:-
MODEL:-
Thanks a ton in advance
|
 |
Prakash Mani - Attur
Ranch Hand
Joined: Oct 08, 2009
Posts: 100
|
|
Hi veebu,
Add the following lines to your web.xml then restart the server and tell us..
Hi All
but i got a very big doubt here... actions are not servlets right? then why do i have to add these lines in my web.xml? but in my project they have added only the servlets in the web.xml not the actions... can anyone please explain it??
|
 |
Lawrence Xu
Greenhorn
Joined: Feb 11, 2004
Posts: 11
|
|
<form method="POST"
action="Select.do"></form>
modify
<html:form method="POST"
action="Select.do">
</html:form>
|
 |
 |
|
|
subject: Getting error while running BeerStruts example
|
|
|