Tag: tomcat

在TomCat上运行的POI导致加载程序约束违规

我正在尝试使用Apache POI生成XSLX,但在尝试运行TomCat应用程序时出现此错误: HTTP Status 500 – javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument.copy()Lorg/apache/xmlbeans/XmlObject;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/apache/poi/POIXMLProperties, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/openxmlformats/schemas/officeDocument/x2006/extendedProperties/PropertiesDocument, have different Class objects for the type ts.schemas.officeDocument.x2006.extendedProperties.PropertiesDocument.copy()Lorg/apache/xmlbeans/XmlObject; used in the signature 我正在使用POI 3.15。 POI JARs存储在通用的Tomcat7 / […]

tomcat / CGI和python3无法使用win32com打开Excel文件

我有一个PY3脚本,它使用Win32COM来实例化一个新的Excel实例,并试图打开一个现有的.xlsx文件 – 在Windows上通过Tomcat / CGI调用时失败: sys.stdout.write("Content-Type: text/html\n\n") excel = DispatchEx('Excel.Application') dir = r'C:\temp' s = 'test.xlsx' sfile = os.path.join(dir, s) try: wbS = excel.Workbooks.Open(sfile) except pythoncom.com_error as error: print("exception details: {0}".format(error)) exit(1) 操作失败: exception details: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', "Microsoft Excel cannot access the file 'C:\\temp\\test.xlsx'. There are several possible reasons:\n\n• The file […]

GWT / Apache POI下载Servlet:下载时文件名不正确

我有一个使用Apache POI创builddynamicExcel电子表格的servlet。 我可以创build电子表格就好了。 但是,当我使用Google Chrome和Tomcat服务器时,下载的文件不能反映正确的文件名。 而是用servlet的名称replace文件名。 所以,例如,我想下载一个文件“dr_3.xlsx”,它会下载一个名为“excelService”(servlet名称)的文件。 所有的内容都是正确的,只是文件名是错误的。 只有在Tomcat服务器上使用Google Chrome时,才会出现此错误。 当使用Firefox + Tomcat , Chrome + Jetty , Firefox + Jetty和IE(eww) + Tomcat时,它的性能会如预期的那样。 这是doGet()方法的代码: protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { int id = Integer.parseInt(req.getParameter("id")); int BUFFER = 1024 * 100; resp.setContentType( "application/octet-stream" ); resp.setHeader( "Content-Disposition:", String.format("attachment; filename=\"%s\"", "dr_" + […]

在webapp中使用JExcel Api时,Tomcat 7在启动时崩溃

我正在尝试使用JExcel Api在一个特定的servlet被调用时将数据从一个数据库导出到一个Excelsheet中,但是当启动Tomcat时,我得到了多个exception。 这是eclipse给出的错误信息: Nov 01, 2012 10:57:14 AM org.apache.catalina.core.ContainerBase startInternal SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/web]] at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:785) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) […]

JSP生成Excel电子表格(XLS)进行下载

我有我在JSP中开发的这个应用程序,我希望从XLS(MS Excel格式)的数据库中导出一些数据。 是否有可能在tomcat下编写一个文件,就像它是一个普通的Java应用程序,然后生成一个链接到这个文件? 或者我需要使用特定的API吗? 这样做的时候我会有权限问题吗?

Apache POI输出问题

我有一个Apache POI的问题。 我在处理完相关数据后试图返回一个文件。 当我将文件返回到浏览器(包括IE8 / 9,Firefox)时,浏览器会返回一个垃圾字符。 这只发生在Excel文件很大并且进程已经运行了2分钟以上的情况下。 否则,它返回一个文件,我可以在Excel中打开。 任何帮助表示赞赏,谢谢。 response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".xls\""); OutputStream out = null; try { out = new BufferedOutputStream(response.getOutputStream()); wb.write(out); out.flush(); } catch (IOException ex) { ex.printStackTrace(); }