0

I'm new on java, and I try to resize an image.

When I try to load the image in the buffer with this code:

File file = new File( fileName ); 
BufferedImage image = ImageIO.read( file );

The System has thrown this exception:

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)

I'm on linux system (ubuntu 13.04 64 bit) and this script run on simple tomcat servlet, I have seen other question about it but i think the problem is in VM.

Have you an idea?? .. thanks so much I hope in a response Best regards Andrea

Andrea Catania
  • 1,361
  • 3
  • 21
  • 37
  • It seem that you jdk is not correct. Try to reinstall jdk using `apt-get install`. And use the default JDK on ubuntu – lichengwu Nov 26 '13 at 15:36
  • possible duplicate of [Can't find/install libXtst.so.6?](http://stackoverflow.com/questions/17355863/cant-find-install-libxtst-so-6) – Bludzee Nov 26 '13 at 16:02

2 Answers2

0

Do you have the library libXtst installed on your system?

$ locate libXtst

If not, execute this in a terminal:

$ sudo apt-get update
$ sudo apt-get install libxtst6

then try again.

Bludzee
  • 2,733
  • 5
  • 38
  • 46
0

I have resolved it with this:

sudo apt-get install libxtst6:i386
Pang
  • 9,564
  • 146
  • 81
  • 122
Andrea Catania
  • 1,361
  • 3
  • 21
  • 37
  • 1
    I'm glad this solved your issue. Don't forget to mark your question resolved (select this answer of yours). – Bludzee Nov 26 '13 at 21:45