Hi,
I’ve tried it with Aspose.Words.jdk16.jar in both the /WEB-INF/lib/ directory (where the webapp classloader finds it), and where the common server-wide classloader will find it, with the same result. The code DOES work as expected with an old version of Aspose Words (2.6.0).At the bottom of the stack trace it suggests it’s caused by an ‘UnsupportedCharsetException’. I’m not specifying UTF-7 anywhere (the document itself contains only ASCII characters). Has something changed in the HTML import code with regards to character sets, or is this a red herring?Thanks, and if there’s any additional information that would be useful please let me know.Steve======= HTMLTitleBody======= web.xml (lives in /WEB-INF/web.xml)<?xml version="1.0" encoding="UTF-8"?>ExampleAsposeImportAsposeImportAsposeImport/servlet======= CODEimport javax.servlet.http.;import javax.servlet.;import java.io.;import com.aspose.words.;public class AsposeImport extends HttpServlet {public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{PrintWriter out = res.getWriter();try{Document d = new Document("/home/steve/test.doc");out.println(“Loaded doc ok”);}catch (Exception e) { out.println(“Exception from doc (Words): " + e.toString()); }try{Document d = new Document(”/home/steve/simple.html");out.println(“Created html”);}catch (Exception e) { out.println(“Exception from html (Words): " + e.toString()); }out.close();}public static void main(String[] args){System.out.println(“MAIN”);try{Document d = new Document(”/home/steve/test.doc");System.out.println(“Loaded doc ok”);}catch (Exception e) { System.out.println(“Exception (doc): " + e.toString()); }try{Document d = new Document(”/home/steve/simple.html");System.out.println(“Created html”);}catch (Exception e) { System.out.println("Exception (html): " + e.toString()); }}}========== STACKTRACEcom.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.Document.a(Document.java:1371)
at com.aspose.words.Document.b(Document.java:1358)
at com.aspose.words.Document.a(Document.java:1246)
at com.aspose.words.Document.(Document.java:143)
at com.aspose.words.Document.(Document.java:117)
at AsposeImport.doGet(AsposeImport.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.IllegalStateException: java.nio.charset.UnsupportedCharsetException: UTF-7
at asposewobfuscated.kj.Pc(Encoding.java:475)
at asposewobfuscated.kj.OY(Encoding.java:237)
at asposewobfuscated.kj.af(Encoding.java:453)
at com.aspose.words.iy.nW(FileFormatDetector.java:246)
at com.aspose.words.iy.g(FileFormatDetector.java:38)
at com.aspose.words.Document.b(Document.java:1262)
… 23 more
Caused by: java.nio.charset.UnsupportedCharsetException: UTF-7
at java.nio.charset.Charset.forName(Charset.java:506)
at asposewobfuscated.kj.Pc(Encoding.java:471)
… 28 more