创建异常:java.lang.NoClassDefFoundError:org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage(初始化失败)

时间:2015-01-02 15:41:13

标签: java noclassdeffounderror docx4j

我在linux服务器上遇到以下错误。在我的本地机器上工作得很好。

  

创建异常:java.lang.NoClassDefFoundError:   org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage   (初始化失败)at   java.lang.J9VMInternals.initialize(J9VMInternals.java:140)at at   com.common.cmd.htmltodoc.newImage(htmltodoc.java:3932)

  public static P newImage( WordprocessingMLPackage wordMLPackage, byte[] bytes, 
            String filenameHint, String altText, int id1, int id2) throws Exception {

        BinaryPartAbstractImage imagePart = BinaryPartAbstractImage.createImagePart(wordMLPackage, bytes);
        Inline inline = imagePart.createImageInline(filenameHint, altText, id1, id2, false);

        ObjectFactory factory = new ObjectFactory();

        P  p = factory.createP();
        R  run = factory.createR();

        p.getParagraphContent().add(run);        
        Drawing drawing = factory.createDrawing();      
        run.getRunContent().add(drawing);       
        drawing.getAnchorOrInline().add(inline);

        return p;
    }

这是我用于使用docx4j将图像绘制成单词的代码。

0 个答案:

没有答案