3

我正在尝试解决一个家庭作业,其中我应该为图像处理任务实现一个 Pipes&Filters-Architecture。但是我对 Linux 下的 JAI-Framework 有问题(具体来说是 ArchLinux)。

我正在使用文件加载加载图像:

_image = JAI.create("fileload", file);

后来我想将图像保存到一个单独的位置:

JAI.create("filestore", _image, _filename, "JPEG");

我只是复制了相关行,这是我迄今为止的整个 JAI 特定代码。但是当我执行我的程序时,我收到以下错误:

Error: One factory fails for the operation "jpeg"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:144)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:799)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.JAI.createNS(JAI.java:1099)
    at javax.media.jai.JAI.create(JAI.java:973)
    at javax.media.jai.JAI.create(JAI.java:1621)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.storeFile(ImageSink.java:37)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:58)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:16)
    at at.fhv.students.rotter.systemarchitectures.pipesfilters.Pipe.write(Pipe.java:70)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.write(ImageSource.java:77)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.run(ImageSource.java:84)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.Program.main(Program.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:43)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 50 more
Error: One factory fails for the operation "stream"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:144)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:799)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.JAI.createNS(JAI.java:1099)
    at javax.media.jai.JAI.create(JAI.java:973)
    at javax.media.jai.JAI.create(JAI.java:1621)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.storeFile(ImageSink.java:37)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:58)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:16)
    at at.fhv.students.rotter.systemarchitectures.pipesfilters.Pipe.write(Pipe.java:70)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.write(ImageSource.java:77)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.run(ImageSource.java:84)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.Program.main(Program.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "jpeg"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
    ... 38 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 41 more
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:43)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 50 more
Error: One factory fails for the operation "fileload"
Occurs in: javax.media.jai.ThreadSafeOperationRegistry
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:799)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.JAI.createNS(JAI.java:1099)
    at javax.media.jai.JAI.create(JAI.java:973)
    at javax.media.jai.JAI.create(JAI.java:1621)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.storeFile(ImageSink.java:37)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:58)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:16)
    at at.fhv.students.rotter.systemarchitectures.pipesfilters.Pipe.write(Pipe.java:70)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.write(ImageSource.java:77)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.run(ImageSource.java:84)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.Program.main(Program.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "stream"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:144)
    ... 29 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 32 more
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "jpeg"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
    ... 38 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 41 more
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:43)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 50 more
Exception in thread "main" javax.media.jai.util.ImagingException: All factories fail for the operation "fileload"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:799)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.JAI.createNS(JAI.java:1099)
    at javax.media.jai.JAI.create(JAI.java:973)
    at javax.media.jai.JAI.create(JAI.java:1621)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.storeFile(ImageSink.java:37)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:58)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:16)
    at at.fhv.students.rotter.systemarchitectures.pipesfilters.Pipe.write(Pipe.java:70)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.write(ImageSource.java:77)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.run(ImageSource.java:84)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.Program.main(Program.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 23 more
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "stream"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:144)
    ... 29 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 32 more
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "jpeg"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
    ... 38 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 41 more
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:43)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 50 more
Caused by:
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:799)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getRendering(RenderedOp.java:888)
    at javax.media.jai.JAI.createNS(JAI.java:1099)
    at javax.media.jai.JAI.create(JAI.java:973)
    at javax.media.jai.JAI.create(JAI.java:1621)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.storeFile(ImageSink.java:37)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:58)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSink.write(ImageSink.java:16)
    at at.fhv.students.rotter.systemarchitectures.pipesfilters.Pipe.write(Pipe.java:70)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.write(ImageSource.java:77)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.ImageSource.run(ImageSource.java:84)
    at at.fhv.students.rotter.systemarchitectures.imageprocessing.Program.main(Program.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "stream"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.FileLoadRIF.create(FileLoadRIF.java:144)
    ... 29 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 32 more
Caused by: javax.media.jai.util.ImagingException: All factories fail for the operation "jpeg"
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687)
    at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
    at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
    at com.sun.media.jai.opimage.StreamRIF.create(StreamRIF.java:102)
    ... 38 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
    at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
    ... 41 more
Caused by: java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException
    at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
    at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
    at com.sun.media.jai.opimage.JPEGRIF.create(JPEGRIF.java:43)
    ... 47 more
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.ImageFormatException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 50 more

有人有想法吗?

更新:我已经测试了一下,发现加载 bmp-Images 有时有效。然后我尝试在 DisplayJAI 中显示图像,而不是将其写入文件。这适用于以下 bmp 图像:http: //i.stack.imgur.com/dDILk.png

但它不适用于以下图像(我使用 gimp 从 jpg 转换为 bmp):http: //i.stack.imgur.com/xQWQa.png

4

2 回答 2

3

我花了一天时间寻找这个问题的答案。JAI 重要的是您使用的 Java JDK 的版本。OpenJDK 不适用于它。您需要 Oracle Java JDK。

获取和安装的说明在这里:https ://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

或者,对于那些使用 Ubuntu 的人,这里是快速说明:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

希望这可以帮助。当您遇到此错误时,也许这会节省您的时间

于 2015-02-18T11:10:24.060 回答
1

最后我找到了解决方案:我还必须将 ext 文件夹中的 mlibwrapper.jar-File 添加到项目中......

于 2013-02-14T16:38:42.433 回答