Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 500 - When Tried The First Login Example

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I began to learn the Struts yesterday. I followed the step by step instructions at
http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts
I am very embarrassed to say that I failed to run the first "Login" example. Java source codes are provided, and all I have to do is to compile them and put class files, xml files, JSP files in the right directories. I got HTTP status 500 (the error messages are shown below). I noticed that the error message says:
"Missing message for key title.login"
I checked the MessageResources.properties file in the c:/tomcal installation directory/webapps/struts/WEB-INF/classes/test/struts
and it looks to me that title.login is there.
I am unable to find the problem and please help.
This is the content of the MessageResources.properties file:

This is what I got after I entered
http://localhost:8080/struts/jsp/LoginView.jsp
in my browser:
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the MessageResources file properly set up in the web.xml file?
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried two ways of saving the contents of MessageResources.properties
1. in the text field of Save As, I typed:
"MessageResources.properties"
2. in the text field of Save As, I typed:
"MessageResources.properties.txt"
nonetheless, I got the same error message: HTTP Status 500
The web.xml file is located in the c:\tomcat installation directiory\webapps\struts\WEB-INF directory. This is the contents of the web.xml file:
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file has to be named: MessageResources.properties and it has to be located in the test/struts directory.
If everything seems to be where it is then try removing the title.login from Login.jsp and running again. If it now tells "Missing Message" for the next tag (which I suspect it will) then the problem is that it isn't finding your MessageResources.properties file.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The MessageResources.properties is located in the c:\tomcat installation directory\webapps\struts\WEB-INF\classes\test\struts directory.
Sorry, I do not fully understand your suggestion. I see this statement:
<HEAD><TITLE><struts:message key="title.login" /></TITLE></HEAD>
in the LoginView.jsp file. What does the statement look like if you want me to remove title.login?
[ February 22, 2003: Message edited by: JiaPei Jen ]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<HEAD><TITLE>Login Screen</TITLE></HEAD>
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After I deleted title.login and re-ran the example, I got this HTTP Status 500:

You are right, the MessageResources.properties file cannot be found. Nonetheless, that file "is in the right directory".
I think the problem may be that the MessageResources.properties was not saved with the right extension. I can download that file again, but .......... I feel very embarrassed to say that I must learn how to save MessageResources.properties in the test.struts directory.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try going to the directory and renaming the file correctly if it has the wrong extension.
Remember that any time you change the MessageResources file you need to restart Tomcat.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to save the MessageResources.properties file several times. Each time, I shut down and re-start the Tomcat to run the Login example.
I simply get HTTP Status 500. The MessageResources.properties simply cannot be found.
I do not know what to do. Now, it seems to be difficult. I know the problem but cannot correct the problem.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything looks OK. The only things I can think of is that the file is not correctly named or the contents of the file are wrong.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked at the name of the file again and again, it is
MessageResources.properties
And I copy and paste the contents of that file below:

I really do not know what to do.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this thread:
http://www.coderanch.com/t/46371/Struts/struts-installation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic