Java图片处理ImageIO.read()问题

环境:

weblogic8.1,RedHat5(64bit),JDK1.4

 

在对图片进行读取ImageIO.read()并缩放时,出现如下错误:

 

启动后首次使用报错:

 

javax.faces.FacesException: Error calling action method of component with id billform1:saveUpload
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
        at javax.faces.component.UICommand.broadcast(UICommand.java:106)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
        at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:312)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
        at cn.ccb.foundation.web.SupFacesServlet.service(SupFacesServlet.java:155)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.foundation.web.ErrorFilter.doFilter(ErrorFilter.java:47)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.zjtsrmbp.security.web.UrlAccessFilter.doFilter(UrlAccessFilter.java:112)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.zjtsrmbp.common.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:79)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{BillAttachModify.saveImage}
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
        ... 29 more
Caused by: java.lang.UnsatisfiedLinkError: /home/mw/weblogic/bea/jrockit81sp6_142_10/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory

UnsatisfiedLinkError   jre/lib/i386/libawt.so: libXp.so wrong ELF class: ELFCLASS64

        at java.lang.ClassLoader$NativeLibrary.load(Ljava.lang.String;)V(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Ljava.lang.Class;Ljava.io.File;)Z(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Ljava.lang.Class;Ljava.lang.String;Z)V(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
        at java.lang.System.loadLibrary(Ljava.lang.String;)V(Unknown Source)
        at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
        at java.awt.image.ColorModel.loadLibraries(ColorModel.java:188)
        at java.awt.image.ColorModel.(ColorModel.java:196)
        at javax.imageio.ImageTypeSpecifier$Packed.(ImageTypeSpecifier.java:275)
        at javax.imageio.ImageTypeSpecifier.createPacked(ImageTypeSpecifier.java:327)
        at javax.imageio.ImageTypeSpecifier.(ImageTypeSpecifier.java:63)
        at com.sun.imageio.plugins.jpeg.JPEGImageReader.(JPEGImageReader.java:191)
        at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:89)
        at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:296)
        at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:488)
        at javax.imageio.ImageIO.read(ImageIO.java:1381)
        at javax.imageio.ImageIO.read(ImageIO.java:1306)
        at cn.ccb.zjtsrmbp.common.util.ImageZipUtil.zipImageFile(ImageZipUtil.java:62)
        at cn.ccb.zjtsrmbp.genbill.web.bb.BillAttachModify.saveImage(BillAttachModify.java:200)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)


之后报错:
javax.faces.FacesException: Error calling action method of component with id billform1:saveUpload
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
        at javax.faces.component.UICommand.broadcast(UICommand.java:106)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
        at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:312)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
        at cn.ccb.foundation.web.SupFacesServlet.service(SupFacesServlet.java:155)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.foundation.web.ErrorFilter.doFilter(ErrorFilter.java:47)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.zjtsrmbp.security.web.UrlAccessFilter.doFilter(UrlAccessFilter.java:112)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.zjtsrmbp.common.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:79)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{BillAttachModify.saveImage}
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
        ... 29 more
Caused by: java.lang.NoClassDefFoundError: com/sun/imageio/plugins/jpeg/JPEGImageReader
        at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:89)
        at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:296)
        at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:488)
        at javax.imageio.ImageIO.read(ImageIO.java:1381)
        at javax.imageio.ImageIO.read(ImageIO.java:1306)
        at cn.ccb.zjtsrmbp.common.util.ImageZipUtil.zipImageFile(ImageZipUtil.java:62)
        at cn.ccb.zjtsrmbp.genbill.web.bb.BillAttachModify.saveImage(BillAttachModify.java:200)
        at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
        at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
        at javax.faces.component.UICommand.broadcast(UICommand.java:106)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
        at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
        at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:312)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
        at cn.ccb.foundation.web.SupFacesServlet.service(SupFacesServlet.java:155)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at cn.ccb.foundation.web.ErrorFilter.doFilter(ErrorFilter.java:47)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
        at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)

 

主要信息:

java.lang.UnsatisfiedLinkError: /home/mw/weblogic/bea/jrockit81sp6_142_10/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory

UnsatisfiedLinkError   jre/lib/i386/libawt.so: libXp.so wrong ELF class: ELFCLASS64

 

原因:
有些程序运行在64位机时,需要连接32位环境下的库。

 

解决办法:
libXp-1.0.0-8.1.el5.i386.rpm
jdk1.4以前版本:需要安装 XFree86和XFree86-Xvfb ,加入 export DISPLAY=hostdomain:0.0

 

你可能感兴趣的:(软件开发)