我是java的新手,我尝试调整图片大小。
当我尝试使用以下代码在缓冲区中加载图像时:
File file = new File( fileName );
BufferedImage image = ImageIO.read( file );
系统抛出了这个异常:
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
root cause
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/jdk1.7.0_45/jre/lib/i386/xawt/libmawt.so: libXtst.so.6: cannot open shared object file: No such file or directory
java.lang.ClassLoader$NativeLibrary.load(Native Method)
java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
java.lang.Runtime.load0(Runtime.java:795)
java.lang.System.load(System.java:1062)
java.lang.ClassLoader$NativeLibrary.load(Native Method)
java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1872)
java.lang.Runtime.loadLibrary0(Runtime.java:849)
java.lang.System.loadLibrary(System.java:1088)
sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
java.security.AccessController.doPrivileged(Native Method)
java.awt.Toolkit.loadLibraries(Toolkit.java:1646)
java.awt.Toolkit.<clinit>(Toolkit.java:1668)
sun.awt.AppContext$2.run(AppContext.java:271)
sun.awt.AppContext$2.run(AppContext.java:260)
java.security.AccessController.doPrivileged(Native Method)
sun.awt.AppContext.initMainAppContext(AppContext.java:260)
sun.awt.AppContext.access$200(AppContext.java:133)
sun.awt.AppContext$3.run(AppContext.java:314)
sun.awt.AppContext$3.run(AppContext.java:298)
java.security.AccessController.doPrivileged(Native Method)
sun.awt.AppContext.getAppContext(AppContext.java:297)
javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:154)
javax.imageio.ImageIO.<clinit>(ImageIO.java:65)
andreacatania.Load.doGet(Load.java:45)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
我在linux系统上(ubuntu 13.04 64位)并且这个脚本在简单的tomcat servlet上运行,我已经看到了其他问题,但我认为问题出在VM中。
你有个主意吗? ..非常感谢,我希望在回复中 最好的问候Andrea
答案 0 :(得分:0)
您的系统上是否安装了库libXtst?
$ locate libXtst
如果没有,请在终端中执行:
$ sudo apt-get update
$ sudo apt-get install libxtst6
然后再试一次。
答案 1 :(得分:0)
我已经解决了这个问题:
sudo apt-get install libxtst6:i386