File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem Running Struts Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem Running Struts Example" Watch "Problem Running Struts Example" New topic
Author

Problem Running Struts Example

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I am not sure if this is a Tomcat Problem or a problem with my configuration of STRUTS & Tomcat so if this needs to be moved, please do so.
I was attempting to run the example that Thomas Paul had on the newsletter about STRUTS from March 2002. I believe that I did everything correct and I am getting this error message.

If this mess makes any sense with anyone, could you please help me.
Thank you


GenRocket - Experts at Building Test Data
Ravi Veera
Ranch Hand

Joined: Jun 23, 2001
Posts: 127

Seems like you don't have the resource file in the proper place. Either that or you are missing an entry in the web.xml file,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, I have the MessageResources.properties file in the struts\WEB-INF\classes\test\struts folder. And the Web.XML file I just copied and pasted from the <Listing 1> and it is in the struts\WEB-INF folder. So I think everything is there.
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
try the ApplicationResource.properties file...
also look at this thread: Why use Struts?
I keep fighting it, so now I at least find some of these..
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Ha, I am inclined to agree with Ken on this topic. I think I would rather program my own logic and try and debug it than try and debug logic that someone else planned out for me.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Gregg Bolinger:
Ha, I am inclined to agree with Ken on this topic. I think I would rather program my own logic and try and debug it than try and debug logic that someone else planned out for me.

I see. So you don't code in Java since you wouldn't want to have to debug a JVM.


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

Ok ok. Good point. I am still getting that error from above though if anyone can suggest anything else.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Also, the documents say to put the war files in the webapps folder of my container. Why do we need to do this, and more importantly, why DON'T we need to do this for the example that Thomas Paul provided. Or am I needing to do that and Thomas was just assuming we read STRUT'S install instructions.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Looks like title.login is missing from the MessageResources.properties file!
add this line:
title.login=Login Screen
[ September 17, 2002: Message edited by: Thomas Paul ]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Gregg Bolinger:
Also, the documents say to put the war files in the webapps folder of my container.
The war files are for the Struts examples. You don't need them to run my example.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks Thomas. Fixed that problem. Now it says:
Cannot retrieve definition for form bean null.
Looks like I have some research to do. Oh well, what is better than a fun night of reading and debugging.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Mkae sure you have these lines in your struts-config.xml file.
<!-- ========== Form Bean Definitions ============ -->
<form-beans>
<form-bean name="login" type="test.struts.LoginForm" />
</form-beans>
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I received the same null error. The struts-config.xml does contain the proper form beans definition.


Matthew Phillips
Ken Robinson
Ranch Hand

Joined: Jul 25, 2002
Posts: 52
Originally posted by Gregg Bolinger:
Ha, I am inclined to agree with Ken on this topic. I think I would rather program my own logic and try and debug it than try and debug logic that someone else planned out for me.

Again, my point is missed.
My point is that the J2EE API is itself a framework. You have not yet reached the point where you can implement your application specific logic becuase you are still installing/learning/understanding the 'framework' you have chosen.
I feel that if one fully understands the JSDK functionality provided directly from SUN (and implemented by all vendords) and one fully understands STRUTS, they will see very, very little is added for the cost required.
Take a few minutes and layout how you would do a few pages in STRUTS. Then take a few minutes and layout how you would do the same pages using the JSDK. You will see that regardless of what you use, the same exact application specific logic will make up the vast majority of your work (I put the number at 95%+, however I'm sure that will be debated here).
[ September 19, 2002: Message edited by: Ken Robinson ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Hey Ken, we get it by now. You feel you gain nothing by using STRUTS. If you are not convinced by now that STRUTS is a useful tool, I don't think you ever will be. I didn't miss your point. You have a lot of points. You have a lot of valid points for your opinion. As do Thomas and everyone else for theirs. I think the horse is dead now.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Ken, I have written hundreds (if not thousands) of servlets and JSPs. I have written applications without Struts. I have written applications with Struts. I like Struts. I think Struts allows you to easily write well distributed applications in an Model 2 architecture. You disagree. Fine. I think we have now officially beaten this to death.
Ken Robinson
Ranch Hand

Joined: Jul 25, 2002
Posts: 52
Geesh, getting brutal here.
Something I said was not used in the context I had intended. When that happens I like to clarify what I meant.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I found the cause of the form bean null error. Later in the tutorial there is an updated struts-config.xml and an ActionForm class. Adding these takes care of that error. There is now a new error. There is now a null pointer exception in the LoginBean. It appears that the userId variable is not being set.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I found a couple of mistakes in the example and they have been corrected. If you start from the top and get the current listings it should work.
If you have trouble with Tomcat not seeing your properties files, remove the struts.jar from the jre/lib/ext file and put it somewhere else in your classpath.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem Running Struts Example
 
Similar Threads
Can not run Struts example in Tomcat
Class not found..
Tomcat installation problems!
Help with Struts
Novice Session Question