各位大佬,求帮忙。stream-参数值的类()不是参数“stream”的参数类()的实例。

描述:用simpleimage-1.2.0.jar包缩小文件的品质,出现异常

异常:stream-参数值的类(io.bytearraysecablestreamwrap)不是参数“stream”的参数类(com.sun.media.jai.codec.seecablestream)的实例。

代码:

fileName_shrink = CNUuid+"-min"+"."+extensionName;   //b-min.png   

String fileDir_shrink = getRequest().getServletContext().getRealPath("")+"/upload"+path+"/"+fileName_shrink;        

inStream = new FileInputStream(fileDir);

 ImageWrapper imageWrapper = ImageReadHelper.read(inStream);

Thumbnails.of(imageWrapper.getAsBufferedImages()).size(200,200).outputQuality(1).toFile(fileDir_shrink);

报错信息:

com.alibaba.simpleimage.SimpleImageException: com.alibaba.simpleimage.SimpleImageException: java.lang.IllegalArgumentException: Stream - Parameter value`s class (com.alibaba.simpleimage.io.ByteArraySeekableStreamWrap) is not an instance of the parameter class (com.sun.media.jai.codec.SeekableStream) for parameter "stream".

at com.alibaba.simpleimage.util.ImageReadHelper.read(ImageReadHelper.java:71)

at cn.soft.admin.controller.CNCommonPageController.uploadShrink(CNCommonPageController.java:130)

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:606)

at com.jfinal.aop.Invocation.invoke(Invocation.java:73)

at cn.soft.admin.interceptors.CNAdminInterceptor.intercept(CNAdminInterceptor.java:21)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at cn.soft.sys.interceptor.CNSessionInViewInterceptor.intercept(CNSessionInViewInterceptor.java:25)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:78)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

at org.eclipse.jetty.server.Server.handle(Server.java:365)

at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)

at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)

at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

at java.lang.Thread.run(Thread.java:745)

Caused by: com.alibaba.simpleimage.SimpleImageException: java.lang.IllegalArgumentException: Stream - Parameter value`s class (com.alibaba.simpleimage.io.ByteArraySeekableStreamWrap) is not an instance of the parameter class (com.sun.media.jai.codec.SeekableStream) for parameter "stream".

at com.alibaba.simpleimage.util.ImageReadHelper.readGeneral(ImageReadHelper.java:158)

at com.alibaba.simpleimage.util.ImageReadHelper.read(ImageReadHelper.java:69)

... 35 more

Caused by: java.lang.IllegalArgumentException: Stream - Parameter value`s class (com.alibaba.simpleimage.io.ByteArraySeekableStreamWrap) is not an instance of the parameter class (com.sun.media.jai.codec.SeekableStream) for parameter "stream".

at javax.media.jai.JAI.createNS(JAI.java:1091)

at javax.media.jai.JAI.create(JAI.java:977)

at javax.media.jai.JAI.create(JAI.java:1399)

at com.alibaba.simpleimage.util.ImageReadHelper.readGeneral(ImageReadHelper.java:152)

... 36 more


JFinal-3.4 action report -------- 2019-05-03 17:04:19 --------------------------

Url         : POST /admin/commonPage/uploadShrink

Controller  : cn.soft.admin.controller.CNCommonPageController.(CNCommonPageController.java:1)

Method      : uploadShrink

Interceptor : cn.soft.sys.interceptor.CNSessionInViewInterceptor.(CNSessionInViewInterceptor.java:1)

              cn.soft.admin.interceptors.CNAdminInterceptor.(CNAdminInterceptor.java:1)

Parameter   : name=有容乃大   平雕实木复合  unitUuid=  id=866  brand=富士达  categoryUuid=  imgList=  model=有容乃大  testPath=  classificationUuid=  remarks=  


评论区

热门反馈

扫码入社