my dog learned polymorphism*
The moose likes Struts and the fly likes How to use Struts 2 with JFreeChart? 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 "How to use Struts 2 with JFreeChart?" Watch "How to use Struts 2 with JFreeChart?" New topic
Author

How to use Struts 2 with JFreeChart?

Peter Mest
Ranch Hand

Joined: Aug 14, 2009
Posts: 30
0 vote down star


Firstly, I went here ( http://code.google.com/p/struts2-examples/downloads/list and I downloaded Hello_World_Struts2_Mvn.zip) and I run that example.

After that, I went here (http://struts.apache.org/2.x/docs/jfreechart-plugin.html), I add the dependencies for commons-lang-2.5.jar, jcommon-1.0.16.jar and jfreechart-1.0.13.jar and I modify the example downloaded from code.google.com to see how JFreeChart is working, but I receive this error:


At the line 36 in struts.xml is the this code (the code from struts2 website):


What I'm doing wrong?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you extending a package that defines the chart result, or defining it yourself?
Peter Mest
Ranch Hand

Joined: Aug 14, 2009
Posts: 30
David Newton wrote:Are you extending a package that defines the chart result, or defining it yourself?


Yes, this was the problem, I didn't put the action in a package which extends the jfreechart-default.

But the problem is not solved... :|

When I pressed the link associated with the action which generates the chart, I receive this error:


My struts.xml file:


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, the problem was solved--you just have a different problem now :)

Make sure devMode is turned on, possibly set your log level to DEBUG, check the log for errors on startup, and when you hit the action.

What libraries are you deploying?
Peter Mest
Ranch Hand

Joined: Aug 14, 2009
Posts: 30
commons-lang-2.5.jar -> This is for the example on the webpage
jcommon-1.0.16.jar
jfreechart-1.0.13.jar
struts2-jfreechart-plugin-2.1.8.1.jar -> This I forgot to add first time.

Now, in Eclipse I receive this exception



I think I you'll give up solving this problem... using Eclipse :). I just imported the project in IDEA (without doing anything else) and the chart is working :banghead: .



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Without knowing how you were handling Maven dependencies in Eclipse, or how you were running/testing/etc. it'll be tough to help--but glad it works somewhere.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Struts 2 with JFreeChart?
 
Similar Threads
Maven + Tiles + Struts2
Struts2-json plugin not serializing action class to json
struts.xml problem in struts2
struts2-maven File not found exception problem
Exception in Struts2