Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

javax.servlet.ServletException: java.util.zip.ZipException: zip file is empty #2

Closed
yucigou opened this issue Nov 27, 2017 · 6 comments
Assignees
Labels

Comments

@yucigou
Copy link

yucigou commented Nov 27, 2017

I followed the readme file of this docker. I built the image and started the container. All seemed fine.
Then I tried to test it with the follow command (which is from the read me file at https://github.com/TEIC/oxgarage):

$ curl  -o test.docx -F upload=@test.xml http://localhost:8080/ege-webservice/Conversions/TEI%3Atext%3Axml/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100  137k    0     0  100  137k      0    99k  0:00:01  0:00:01 --:--:--   99k

But I got errors in the log saying:

13:33:17,200                   INFO TEIConverter:148 - 2017/11/27 13:33:17: Converting FROM:  Documents:TEI P5 XML Document:TEI,text/xml TO Documents:Microsoft Word (.docx):docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document WITH profile null
Exception in thread "Thread-13" java.lang.NoSuchMethodError: net.sf.saxon.Configuration.setProcessor(Ljava/lang/Object;)V
	at net.sf.saxon.s9api.Processor.<init>(Processor.java:60)
	at org.tei.utils.SaxonProcFactory.getProcessor(SaxonProcFactory.java:21)
	at pl.psnc.dl.ege.tei.TEIConverter.convertDocument(TEIConverter.java:231)
	at pl.psnc.dl.ege.tei.TEIConverter.convert(TEIConverter.java:153)
	at pl.psnc.dl.ege.component.NamedConverter.convert(NamedConverter.java:44)
	at pl.psnc.dl.ege.ConversionPerformer.run(ConversionPerformer.java:44)
	at java.lang.Thread.run(Thread.java:748)
2017-11-27 13:33:17.261:WARN:oejs.HttpChannel:qtp636718812-17: /ege-webservice/Conversions/TEI%3Atext%3Axml/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document
javax.servlet.ServletException: javax.servlet.ServletException: java.util.zip.ZipException: zip file is empty
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:561)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:243)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597)
	at java.lang.Thread.run(Thread.java:748)
Caused by: 
javax.servlet.ServletException: java.util.zip.ZipException: zip file is empty
	at pl.psnc.dl.ege.webapp.servlet.ConversionServlet.doPost(ConversionServlet.java:280)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:833)

Any ideas please? Thanks.

@peterstadler peterstadler self-assigned this Nov 27, 2017
@peterstadler
Copy link
Owner

I can confirm the issue (but strangely only on one of my machines). Looking into this …

@egh
Copy link

egh commented Nov 30, 2017

The .war file comes with 2 versions of saxon - I assume this could be part of the problem:

 $ jar tvf ege-webservice.war | grep -i saxon
 inflated: WEB-INF/lib/Saxon-HE-9.4.jar
 inflated: WEB-INF/lib/saxon-8.7.jar

@yucigou
Copy link
Author

yucigou commented Dec 6, 2017

Now I have got it up running. The issue should be related to the web container image. Instead of using jetty:alpine, I use tomcat:7-jre8 instead. I tried some other web container images too, such as tomcat:8-jre8 and tomcat:9-jre8, and none of these would work. So tomcat:7-jre8 is the only container that works for me for the moment.

And the conflict between the two versions of saxon seems not the root cause of this issue. I solved the conflict as @egh pointed, but the issued remained. The issue was not solved until I tried using the tomcat:7-jre8 image.

@peterstadler
Copy link
Owner

The image works for me but for one machine which is behind a proxy. Is that by chance your setup as well?

peterstadler added a commit to TEIC/oxgarage that referenced this issue Jan 18, 2018
@hcayless
Copy link

There's a subtle classpath issue that causes this error. I ran into it while working on adding XSLT 3.0 support (using my Mac laptop). The version of Jing-Trang OxGarage gets from Maven has a dependency on Saxon 8.7. So you end up with a saxon-8.7.jar and a Saxon-HE-9.8.0-7.jar. On a Linux system, with a case-sensitive filesystem (which is the default), Jar files are loaded in lexicographic order, so Saxon-HE-9.8.0-7.jar comes first and wins. Mac HFS+ filesystems are by default case-insensitive, so saxon-8.7.jar is loaded first and your net.sf.saxon.Configuration is the one from Saxon 8.7, which indeed lacks a setProcessor(java.lang.Object) method.

A quick and dirty solution is to rename saxon-8.7.jar (in ege-webservice/WEB-INF/lib) to something like Zsaxon-8.7.jar. Using a case-sensitive filesystem also works, obviously. Longer term, maybe we should look at whether there's anything we can do about the transitive dependency on the old version of Saxon.

peterstadler added a commit to TEIC/oxgarage that referenced this issue Jan 18, 2018
@peterstadler
Copy link
Owner

For the time being I switched to Tomcat7 as suggested by @yucigou and it works nicely – many thanks for the hint!

NB: I did that change in the Docker image at https://hub.docker.com/r/teic/oxgarage/ which is based on the GitHub repo at https://github.com/TEIC/oxgarage. I will tear down this repo here, so please continue to report any issues there, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants