Dear [email protected],

    I am enjoying and am grateful for iText. It offers
me a wonderfully rich set of features. The set of
examples in the tutorial is beautifully done.

    I am registered with iText.

    I am having problems with the NoSuchMethodError.
I have read the discussion of this error in your FAQ.
I will try to give you as much information as I can.

    This letter appears in my email. I did not want to
    attach a large .zip file. So I am sending you that
    zip file via MagicVortex.

o   A program EventMon which used to run using iText both inside
    Eclipse and as an independent .jar file now runs
    only inside Eclipse. As a .jar file I always get
    NoSuchMethodError. I cannot pinpoint any change
    I made that would account for the failure.
   
o   To create a .jar file I use the build.xml included
    in this zip file. I use it with Ant inside Eclipse.
   
o   My application is called EventMon. I have created
    EventMon inside Eclipse and EventMon.jar where in
    each attempt both forms used either Java 1.5.0_01
    or 1.4.2_06 . You can specify to both Eclipse and to
    Ant which versions to use. I made sure they
    matched in each attempt.
   
    In each attempt the Eclipse version runs, but the
    EventMon.jar gets NoSuchMethod.
   
o   In creating EventMon and EventMon.jar I used two
    approaches:
   
    EXTERIOR LIBRARY: I put itext-1.3.jar in the build
    path for Eclipse and in the classpath for the .jar.
    Eclipse works, .jar fails.
   
    [I have also tried iText.jar with the same results]
   
    INTERIOR LIBRARY: I got the source for iText and
    made it a part of the EventMon project in Eclipse.
    I removed all references to itext-1.3.jar from
    Eclipse and from build.xml.
    Eclipse runs, .jar fails.
   
o   Sanity Check: I placed into PdfContentByte.java the following:

    -------------------------------------------------------------

    public java.awt.Graphics2D createGraphics(float width, float height) {
    System.out.println("HELLO FROM PdfContentByte createGraphics(float,float)");
        return new PdfGraphics2D(this, width, height, null, false, false, 0);
    }

    -------------------------------------------------------------

    I have the following code in EventMon:
   
    -------------------------------------------------------------

        float w = ReportConstants.stdWidthPts;  // 8*72
        float h = ReportConstants.stdHeightPts; // 11*72
        cb = writer.getDirectContent();
        NDbOut.println("startPageUsingDefaults cb = " +
        ( (cb==null) ? "null" : "not null") );
        tp = cb.createTemplate(w, h);
        NDbOut.println("startPageUsingDefaults tp = " +
        ( (tp==null) ? "null" : "not null") +
        ", w=" + w + ", h=" + h);
        try {
        // PdfTemplate extends PdfContentByte
        // which has createGraphics(float,float)
        g2 = tp.createGraphics(w, h);
        //g2 = cb.createGraphics(w, h);
        } catch (Error e) {
        g2 = null;
        NDbOut.println
    ("startPageUsingDefaults got error at createGraphics:" +
    "\n" + e.getMessage());
        e.printStackTrace();
        }
        NDbOut.println("startPageUsingDefaults g2 = " + g2);
   
    -------------------------------------------------------------

    When I run under Eclipse with stdout to the console I
    successfully see:
   
startPageUsingDefaults document.newPage() succeeded
startPageUsingDefaults cb = not null
startPageUsingDefaults tp = not null, w=576.0, h=792.0
HELLO FROM PdfContentByte createGraphics(float,float)
startPageUsingDefaults g2 = com.lowagie.text.pdf.PdfGraphics2D[font=java.awt.Font[family=Dialog,name=sanserif,style=plain,size=12],color=java.awt.Color[r=0,g=0,b=0]]
       
    In this zip I have included this SuccessfulConsoleOutput. But it
    is huge and the important part is above.

    -------------------------------------------------------------

    When I run EventMon.jar while generating the same log I
    unfortunately see:
   
startPageUsingDefaults document.newPage() succeeded
startPageUsingDefaults cb = not null
startPageUsingDefaults tp = not null, w=576.0, h=792.0
startPageUsingDefaults got error at createGraphics:
com.lowagie.text.pdf.PdfTemplate.createGraphics(FF)Ljava/awt/Graphics2D;
java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfTemplate.createGraphics(FF)Ljava/awt/Graphics2D;
at com.nemon.DesignReport.api.RDB.startPageUsingDefaults(RDB.java:552)
at com.nemon.DesignReport.designReport.IndividualReportDesign.createPdfReport(IndividualReportDesign.java:25)
at com.nemon.DesignReport.designReport.ReportRunner.main(ReportRunner.java:205)
at com.nemon.EventMon.reports.ReportChooser.actionPerformed(ReportChooser.java:528)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
    .... etc
startPageUsingDefaults g2 = null

    As a result of catching the above error I again get another
    NoSuchMethodError later on:
   
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError:
    com.lowagie.text.pdf.BaseFont.getAscentPoint(Ljava/lang/String;F)F
at com.nemon.EventMon.reports.ReportColumn.drawFromReportColumn(ReportColumn.java:132)
at com.nemon.DesignReport.api.RDBoxer.addColumn(RDBoxer.java:157)
at com.nemon.DesignReport.api.RDBoxer.addColumn(RDBoxer.java:92)

    These examples may be found in the included EventMon.log.

    -------------------------------------------------------------

o   I have included EventMon.jar in this zip file.  It is now large
    because it includes iText.  The manifest inside this jar file is  
   
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
Main-Class: com.nemon.EventMon.gui.EventMon
Class-Path: jars/mysql-connector-java-3.1.8-bin.jar jars/NDbOut.jar
   
    As I mentioned above, I used to also put some flavor of itext.jar
    into this manifest: Eclipse runs, jar fails.
   
CONCLUSION:

    Anything you could suggest to get me past this stopping point
    would be gratefully appreciated.
   
    I have already subscribed to iText.
   
Sincerely,
Tony (Anthony C.) Hughes
[EMAIL PROTECTED]
  
   
   
   

------------------------------------------------------------------------------
Tony Hughes
296 Payson Road
Belmont, MA 02478
617-489-3560
http://members.bellatlantic.net/~anthony.c.hughes/resume.html
http://members.bellatlantic.net/~anthony.c.hughes/javaresume.html

Reply via email to