Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


Mark Tseng 2.Apr.12 06:13 PM a Web browser
Applications Development All Releases iSeries



My Java Agent is on Domino R8.5.2 at Iseries V6R1 , import jcommon-1.0.16.jar and jfreechart-1.0.13.jar.
I could run JfreeChart Java Agent on Notes Client or Domino Designer, it will show me Pie Chart or Bar chart and ChartUtilities.saveChartAsJPEG to local drive c:\. Please Refer Code 1.
I got some problems
1. Can not run this java agent on web, it will show me in the Log
2012/04/02 02:45:07 PM HTTP JVM: Exception in thread "Launcher: JavaAgent"
2012/04/02 02:45:07 PM HTTP JVM: java.lang.NoClassDefFoundError: org.jfree.data.general.PieDataset
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.J9VMInternals.verifyImpl(Native Method)
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.J9VMInternals.newInstanceImpl(Native Method)
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.Class.newInstance(Class.java:1325)
2012/04/02 02:45:07 PM HTTP JVM: at lotus.domino.AgentInfo.newInstance(Unknown Source)
2012/04/02 02:45:07 PM HTTP JVM: at lotus.domino.AgentLauncher.run(Unknown Source)
2012/04/02 02:45:07 PM HTTP JVM: at lotus.domino.NotesThread.run(Unknown Source)
2012/04/02 02:45:07 PM HTTP JVM: Caused by:
2012/04/02 02:45:07 PM HTTP JVM: java.lang.ClassNotFoundException: org.jfree.data.general.PieDataset
2012/04/02 02:45:07 PM HTTP JVM: at lotus.domino.AgentLoader.loadClass(Unknown Source)
2012/04/02 02:45:07 PM HTTP JVM: at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
2. If I replaced ("c:/JFreeBarChart.jpg") to ("/WMtemp/JFreeBarChart.jpg"), then I run this code with Domino Designer. It can not save Chart to Iseries(AS400 V6R1), it will catch exception “Problem occurred creating chart “ to Java Console.
Have Anyone idea to fix it ?
Thanks in advance.
Michael
Code 1:
import lotus.domino.*;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartUtilities;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.ui.RefineryUtilities;
import java.io.File;
import org.jfree.chart.plot.*;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
System.out.println("Start Java Chart");

Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
DefaultPieDataset data = new DefaultPieDataset();
data.setValue("Cat 1", 10);
data.setValue("Cat 2", 20);
data.setValue("Cat 3", 30);
data.setValue("Cat 4", 40);

// create a chart...
JFreeChart chart = ChartFactory.createPieChart3D(
"Sample Pie Chart",
data,
true, // Legend
true, // Tooltips
true // URLs
);

PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setLabelGenerator(new CustomPieSectionLabelGenerator());

ChartFrame frame = new ChartFrame("First Chart Title", chart);

frame.pack();
RefineryUtilities.centerFrameOnScreen(frame); //center
frame.setVisible(true);

BufferedImage image = chart.createBufferedImage(500,300);

JPanel panel = new JPanel();
panel.add(new JLabel(new ImageIcon(image)));

try {
System.out.println("Write to JPG File");

File file = new File("c:/JFreeBarChart.jpg");
ChartUtilities.saveChartAsJPEG(file, chart, 500, 300);

} catch (Exception e) {
System.err.println("Problem occurred creating chart.");
}

System.out.println("End Java Chart");

} catch(Exception e) {
e.printStackTrace();
}
}
}








  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow