在Linux下使用JAI的文件存储保存JPG-Image

时间:2012-11-12 14:56:34

标签: java image-processing jai

我正在尝试解决作业,我应该为图像处理任务实现Pipes& Filters-Architecture。但我在Linux下的JAI-Framework有问题(ArchLinux,具体而言)。

我正在使用fileload加载一个Image:

_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-Image: http://i.stack.imgur.com/dDILk.png

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

2 个答案:

答案 0 :(得分:2)

我花了一天时间在这个问题上寻找答案。 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

希望这会有所帮助。当你遇到这个错误时,这可能会节省你的时间

答案 1 :(得分:1)

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