• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use Struts 2 with JFreeChart?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic