• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Getting error while running BeerStruts example

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7377
1409
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
veebhu singh
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
veebhu singh
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<form method="POST"
action="Select.do"></form>
modify
<html:form method="POST"
action="Select.do">
</html:form>
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic