我正在使用此版本的OpenJDK在Ubuntu上构建PDF this version:
java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
运行测试时出现以下异常:
javax.imageio.IIOException: Invalid argument to native writeImage
展开:
-------------------------------------------------------------------------------
Test set: org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest
-------------------------------------------------------------------------------
Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.804 sec <<< FAILURE! - in org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest
testCreateFromImageINT_ARGB(org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest) Time elapsed: 0.387 sec <<< ERROR!
javax.imageio.IIOException: Invalid argument to native writeImage
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1058)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:360)
at javax.imageio.ImageWriter.write(ImageWriter.java:615)
at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
at javax.imageio.ImageIO.write(ImageIO.java:1578)
at org.apache.pdfbox.pdmodel.graphics.image.ValidateXImage.validate(ValidateXImage.java:63)
at org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest.testCreateFromImageINT_ARGB(JPEGFactoryTest.java:141)
testCreateFromImage4BYTE_ABGR(org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest) Time elapsed: 0.147 sec <<< ERROR!
javax.imageio.IIOException: Invalid argument to native writeImage
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1058)
at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:360)
at javax.imageio.ImageWriter.write(ImageWriter.java:615)
at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
at javax.imageio.ImageIO.write(ImageIO.java:1578)
at org.apache.pdfbox.pdmodel.graphics.image.ValidateXImage.validate(ValidateXImage.java:63)
at org.apache.pdfbox.pdmodel.graphics.image.JPEGFactoryTest.testCreateFromImage4BYTE_ABGR(JPEGFactoryTest.java:182)
Searching档案尚未曝光。
答案 0 :(得分:1)
显然,OpenJDK没有原生JPEG编码器。获取Oracle JDK,然后尝试使用以下命令构建:
JAVA_HOME="/path/to/oracle/jdk" mvn clean compile