• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Cewolf and database?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I am using Cewolf for my charts which is working like a charm but now I am facing a problem in drawing an example of a chart with data from a database (which is a Sybase system) and i can't really see why my code is not working. Any help would be very appreciated.
There is my code java:




There is my web.xml:



And there is my jsp:


I am getting this error when i run this example:

java.lang.NoClassDefDoundError raised:
org/jfree/data/DefaultPieDataset



Anyone has an idea please as i don't have a clue why it's not working?

Regards.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Does this code actually compile? If so, something is seriously screwed up, because none of these classes is in the org.jfree.data package. Where did you get the idea that they are? I suppose there could be really old JFree versions where the package structure was different, but those would have to be ancient versions indeed; certainly not the ones shipped with cewolf for the last 4 years or so.
 
michael stoker
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf anf thank you for your remark.

Yes it does compile without any errors. I am using Jfreechart-1.0.13 so i am not sure if it's actually an old version. But i have been using it before starting with cewolf and it worked fine for me. Do you think that's the reason why i am getting this error? Which version of Jfreechart do you advice me to use please?
Also, i have tried to change the web.xml to add the parameters of the driver for the Sybase database but i am getting an error saying now :

The value for the useBean class attribute de.laures.cewolf.example.PageViewCountData is invalid.



Yet i haven't even changed it so i am very confused concerning the case of a database.

Do you know any good example of a chart with data taken from a database that i can use as example please since the ones i have found on the net give me the same error?

Regards.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JFreeChart 10.13 is indeed current, yet I doubt that that's what you're using - it does not have those classes in the org.jfree.data package: http://www.jfree.org/jfreechart/api/javadoc/index.html. It seems that you are not compiling and running against the same set of libraries.

I recommend to use the versions that come as part of the cewolfexample web app. Those are the ones I test cewolf against, and what's more, the newer JFreeChart/JCommon versions are known to have at least one bug that impacts cewolf.

I'm not sure what you're saying (or doing) with the whole DB access issue. Where does "de.laures.cewolf.example.PageViewCountData" come from - where and how are you using that? And what do you mean by "change the web.xml to add the parameters of the driver" - which piece of code is supposed to pick those up from web.xml, and how?
 
michael stoker
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will check again about this Jfreechart thing but i can tell you this is the only one i have on my computer and the only one i have added as a jar on my project and it has always worked that way so i don't really know.

About the database point, it's confused i know and i am sorry as i am also very confused in how to fix the different parameters to connect to the database. I tried to follow your tutorial here: http://cewolf.sourceforge.net/new/tutorial/step3.html
It says about the web.xml that we need to add the ressource-reference for the connection instances, which i have done like this :



Then i haven't changed anything else and it gave me the above error and i don't know where "de.laures.cewolf.example.PageViewCountData" comes from as i haven't even used that.
Is it then an error on my web.xml?

Regards.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must have used "de.laures.cewolf.example.PageViewCountData" in the JSP page (that wouldn't be a surprise if you followed the tutorial because the tutorial uses that class), and apparently the class not present in the classpath (which is the WEB-INF/classes directory); that's not surprising either, because in the code you posted above the class was named "examples.BarChart".

The resource-ref in the tutorial looks very different from the one in your web.xml; that's not how it works. Start by going through the Tomcat documentation on data sources: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources, and then modify your <Context> (probably in server.xml) accordingly.

Tackle these problems one at a time, you're only confusing yourself by solving both simultaneously.
 
michael stoker
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for your response. My jsp file is the one above and i checked again, i haven't used that class, only at first to try the normal graph on your tutorial to see how cewolf works which worked perfectly but then i replaced it with the new code above.
Ok about the ressource-reference, i just thought that because i am using a Sybase Database (not mysql), i had to specify the port as this is what i normally use to get connected to the database.
I am going to try those changes.

Regards and thank you again.
 
michael stoker
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made the changes following the links you gave me like this:

web.xml




My jsp file:




And my java code:



And now i get this error:

The value for the useBean class attribute examples.EmployeesByDeptAndYear is invalid.



Why is it invalid please?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The Context element does not go into the web.xml file; see the Tomcat documentation: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

The value for the useBean class attribute examples.EmployeesByDeptAndYear is invalid.

Why is it invalid please?


The class you posted is named "EmployeesByDeptAndQtr", not "EmployeesByDeptAndYear".
 
michael stoker
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aahhhhh Ulf THANK YOU so so so so much, i didn't see that i kept the old class too and forgot to change it, silly me. Thank you very very much, its working perfectly fine!! I didn't even have to change the web.xml.
You have made my day, i am so released now.
I will come to post a final screenshot of my charts and tables with all my codes for other people to use it too.

Thank you again Ulf, you are a GENIUS

Very best regards from France.
reply
    Bookmark Topic Watch Topic
  • New Topic