I am new to struts2, jsp, servlets and all this java web technology. I was hoping to find some help here. I deployed a simple struts2 application. I get this exception:
I'm pretty sure my web.xml and struts.xml are correctly set up as the error began after creating an object. I use the execute()-method of an action to let a static method construct an object and want to print out a string from that object, and in an offline application this works fine, therefore the error has to lie in struts or servlets somehow (and I just don't get it). The code from the action looks like this:
Shown error on website:
Does anybody see my noob mistake? Something about servlets perhaps, that I might have not seen? If you need additional info please let me know.
Update: I got a working HelloWorld-Struts2-System, so I don't search for a Struts-Setup-Walkthrough. [ July 23, 2008: Message edited by: Tom Dallas ]
Try deploying and running the struts-blank-2.0.11.war file that comes with the download. If that works, then use struts-blank as the basis for a new project and plug in your action class and configuration entries and see if that fixes it.
Okay, I did that, moved the code diectly into the struts2-blank-app-helloworld.java and tried to set a string to the message. Struts2 is up and running, but I don't get the object instantiated. The only (not very positive) change is that I don't get the error messages now anymore and that the console doesn't print system.out.prints anymore.
I just don't get it. Can anybody try to help? :-)
Update: Do I need an import somewhere here?
Update: Now I come closer to the problem: "org.apache.catalina.core.StandardWrapperValve invoke" throws the Exception.
In the documentation of this class it says it does the folowing: "Invoke the servlet we are managing, respecting the rules regarding servlet lifecycle and SingleThreadModel support."
Okay guys, for which attributes of my class do I need setter and getter? Only for those that I define here (did that) or also for every field that I get from my superclass (this would be a lot)? Isn't the lifecycle-management implemented by ActionSupport? [ July 25, 2008: Message edited by: Tom Dallas ]
Joined: Jul 23, 2008
Finally the error became clear and it had nothing to do with Struts2, but with missing jars for imported classes. Sorry to have bothered you ... please someone delete this thread .
I swear I'll be looking for my own mistakes more closely before making such a request again! :-(