File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Struts 2 with JFreeChart?

 
Peter Mest
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you extending a package that defines the chart result, or defining it yourself?
 
Peter Mest
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic