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 Struts2 Newbie needs a hint or two Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Newbie needs a hint or two" Watch "Struts2 Newbie needs a hint or two" New topic
Author

Struts2 Newbie needs a hint or two

Tom Dallas
Greenhorn

Joined: Jul 23, 2008
Posts: 14
Hello there!

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:

Eclipse-Console:

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.

Greetings, Akku

--

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 ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Tom Dallas
Greenhorn

Joined: Jul 23, 2008
Posts: 14
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 ]
Tom Dallas
Greenhorn

Joined: Jul 23, 2008
Posts: 14
Owwwww!

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! :-(
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Newbie needs a hint or two
 
Similar Threads
object backed data transfer in struts2
Struts2 annotation in JBoss 4.0.5.GA
Struts2 Helloworld Problem
Getting an exception in Hibernate as I try to integrate Struts2 and Hibernate3
How to handle java.lang.NullPointerException in Struts2?..