This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Error while trying NewsLetter Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error while trying NewsLetter Example" Watch "Error while trying NewsLetter Example" New topic
Author

Error while trying NewsLetter Example

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I am getting an error on this page when trying to do the example in the newsletter on Struts 1.1

Here is the error

Anyone know why I am getting this error? Does it really have to do with the LoginView.jsp? Or could the error be the result of another file?
[ May 28, 2003: Message edited by: Thomas Paul ]

GenRocket - Experts at Building Test Data
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Do you have your tld files defined in your web.xml? Are they in the right location?


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Thomas Paul:
Do you have your tld files defined in your web.xml? Are they in the right location?


Here is my web.xml file

And my tld files are located under my WEB-INF folder.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Here's your problem:

In your web.xml, you define the URI as:
/WEB-INBF/struts-template
but you coded your JSP to use this URI:
/WEB-INBF/struts-template.tld
Those two have to be identical for it to work.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Ok, fixed that. But still getting the same error. Am I just stupid here?
Here is my LoginView.jsp page with the corrected URI's
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
And what does your web.xml look like? Did you restart your server?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I completely stopped my server, restarted it, after I made the changes. And here is the web.xml file.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Gregg Bolinger:

<%@ TAGLIB URI="/WEB-INF/struts-html" PREFIX="html" %>
<%@ TAGLIB URI="/WEB-INF/struts-bean" PREFIX="bean" %>
[/CODE]

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

This is from my file.
JSP is case sensitive

here is error I got when I changed to UPPER CASE
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: /WEB-INF/jsp/discover/contract/reviewerDecisionPanel.jsp(3,4) Invalid directive
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:383)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:795)
at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
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.ActionServlet.processActionForward(ActionServlet.java:1759)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
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.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:2415)
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.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:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)

--------------------------------------------------------------------------------
Apache Tomcat/4.1.24
make all char small letter .


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
BTW which editor you are using ??
I am using TextPad for jsp and Eclipse for Java.
TextPad shows different color[blue] for
<%@ taglib uri
and normal color[black] for
<%@ TAGLIB URI
you have to download plugin for jsp syntax coloring available at textpad.com
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Good catch, Ravish! Now I can stop pulling my hair out!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, good news. Thanks to Ravish and Thomas, I am not getting any errors.
BUT....
Now I am just getting a blank page.
I am starting to go bald because of this simple example.
I really don't know why it would be a blank page. I basically copy and pasted the code from the newsletter for the jsp page. Any ideas?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
If you do "view source" what do you see?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Thomas Paul:
If you do "view source" what do you see?

There is a whole lot of Javascript but no actual FORM tags or plain html tags anywhere. And the <HTML> is never closed.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
write one SOP just before forwarding string.
and make sure you have entry of that forward in your action.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Gregg Bolinger:

There is a whole lot of Javascript but no actual FORM tags or plain html tags anywhere. And the <HTML> is never closed.

Originally posted by Gregg Bolinger:
I am getting an error on this page when trying to do the example in the newsletter on Struts 1.1


I cant see closing HTML tag in this html file.
Are you sure you have closing </HTML> tag in your JSP ??
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Gregg Bolinger:

There is a whole lot of Javascript but no actual FORM tags or plain html tags anywhere. And the <HTML> is never closed.

The HTML is never closed because we forgot to put in a close HTML tag. But that shouldn't screw anything up.
There should be a lot of JavaScript.
The question is why aren't the tags being turned into html.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Ravish Kumar:
[QB[/qb]<hr></blockquote>
I cant see closing HTML tag in this html file.
Are you sure you have closing </HTML> tag in your JSP ??[/QB]

I had caught that before posting the problem. So yes, I have the closing </html> tag.
Here is my file, again...

Is it supposed to be this hard?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Thomas Paul:
The question is why aren't the tags being turned into html.

yes, that is the question.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Gregg Bolinger:
Is it supposed to be this hard?
If it was easy then anyone could do it! Minus the JavaScript, what does your source look like?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

If you mean my "view source" source. Whew, here goes

That is just messy looking.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
any error in your server console ??
do you have e.printStack(); in catch block ??
is problem solved ??
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thomas,
Do you by any chance have a WAR of this example app? Maybe I could see if that one works on my system and compare?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

In my Server Log I am getting this:

So something is blowing up. I am going to look at my class files again.
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi Greg,
If you are getting a 'form bean null' error, the problem is probably with your struts-config.xml file. Make sure that your action definition has a name attribute containing the name of the dynaform you wish to use on the page.
Here is an example of how it should look like:

The 'name' is used to associate a form bean with a Struts action. If you don't define it, you will get 'form bean null' type errors.
Hope this helps.
Darryl
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, I can't see anything wrong with my struts-config.xml, but here it is:
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I am getting a new error now though. Still a blank page, but in the error logs I get...

Isn't this fun??
[ May 28, 2003: Message edited by: Gregg Bolinger ]
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi there,
Sometimes when I get strange errors like this, I validate my web.xml and struts-config.xml files to make sure they are well-formed. It's happened to me on a number of occasions where the application loaded without error but didn't fully parse the configuration file because of errors in form.
Boy do I sound out of ideas, don't I? :-)
Darryl
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Darryl A. J. Staflund:
Hi there,
Sometimes when I get strange errors like this, I validate my web.xml and struts-config.xml files to make sure they are well-formed. It's happened to me on a number of occasions where the application loaded without error but didn't fully parse the configuration file because of errors in form.
Boy do I sound out of ideas, don't I? :-)
Darryl


You and me both are out of ideas. So is there an easy way for me to validate my XML files?
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Just download a demo of XML Spy from Altova.
Darryl
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
is this class is in your classpath org.apache.struts.validator.DynaValidatorForm
I have not used this class but it seems that its not finding the class.
It seems that some class should extend this class. Do you have that class?
can you provide line num 97 of LoginView_jsp.java ?
You can find this file in work folder if you are using Tomcat with default setting.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You don't have a form-beans tag in your struts-config.xml!!!
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
one more NOTE:
xml files are also case sensitive.
I saw some tags in CAPS in your xml file.
just try making them small letters.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Line 97 reads
if (pageContext != null) pageContext.handlePageException(t);
And org.apache.struts.validator.DynaValidatorForm is part of struts.jar in v1.1
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Thomas Paul:
You don't have a form-beans tag in your struts-config.xml!!!

Yes .. I think this is the problem .. and thats why its not getting Login bean ..
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Thomas Paul:
You don't have a form-beans tag in your struts-config.xml!!!


Ahh, then this is a typo on your part. You stated in your 1.1 newsletter article to change the struts-config.xml file to have the following:

I guess you left of the s??
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Gregg Bolinger:
Line 97 reads
if (pageContext != null) pageContext.handlePageException(t);
And org.apache.struts.validator.DynaValidatorForm is part of struts.jar in v1.1

thats what I was fearing ... this is almost last line of the generated code.
It does not help at all. Error is somewhere else not at line 97.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Ok, fixed the struts-config file to have <form-beans> instead of <form-bean> and still getting a blank page and a "Cannot retrieve definition for form bean login" in the error logs.
I really appreciate everyone that is helping me through this problem.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Gregg Bolinger:
<hr></blockquote>

Ahh, then this is a typo on your part. You stated in your 1.1 newsletter article to change the struts-config.xml file to have the following:

I guess you left of the s??[/QB]

actually all <form-bean> tag should be inside <form-beans> tag.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
this might help you
you need login name to access it
but its worth to be member here
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Gregg Bolinger:
Ok, fixed the struts-config file to have <form-beans> instead of <form-bean> and still getting a blank page and a "Cannot retrieve definition for form bean login" in the error logs.
I really appreciate everyone that is helping me through this problem.


No your strut-config.xml should be like this

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while trying NewsLetter Example
 
Similar Threads
Including Servlets to JSP page
Include jsp file in tomcat does not work
Class not found..
jsp forward tag not working in Tomcat 4.1.12
Struts problem, help!!