File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Upload Excel using IO and servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload Excel using IO and servlet" Watch "Upload Excel using IO and servlet" New topic
Author

Upload Excel using IO and servlet

Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi All,

I'm having a difficulty in uploading a Excel file from my standalone java client to server using servlet.At the server side servlet throws

"I/O exception:Is not in GZIP format" {Thrown by GZIPInputStream}

Note:It is thrown exactly at "in = new GZIPInputStream( in );" (line in the servlet code).I've no clue how this exception is thrown and why uploading of file is not appening.Will be great help if you all ready to help me to address the issue.Thanks in advance

My client code
---------------



servlet code is
===================

Chandan Ghosh
Greenhorn

Joined: Jun 13, 2005
Posts: 21
Hey,

I just run your code using HttpClient 3.1. and it working absolutely fine. I didnt get any such exceptions....

I changed nothing except the url of the post method action.


Thanks & Regards,<br />Chandan Ghosh<br />SCJP1.4
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Chandan,

Thanks for your prompt reply and testing the code.I'm also using commons-httpclient-3.1.jar in my client projects class path.I've copy and pasted the exact exception i'm getting at the server this might give if at all some thin is wrong at my servlet end..Please suggest....

[8/23/08 22:18:04:944 SGT] 00000030 FileRepositor A ADMR0010I: Document cells/MYD332SD1SNode01Cell/applications/ECHO_magellan_srv_ear.ear/deployments/ECHO_magellan_srv_ear/deployment.xml is modified.

[8/23/08 22:18:37:507 SGT] 00000025 ServletWrappe I SRVE0242I: [ECHO_magellan_srv_ear] [/ECHO_magellan_srv_web] [UploadZipServlet]: Initialization successful.

[8/23/08 22:18:43:366 SGT] 00000025 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: UploadZipServlet. Exception thrown : java.io.IOException: Not in GZIP format

at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:156)

at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java)

at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java)

at com.scb.web.download.UploadZipServlet.doPost(UploadZipServlet.java)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)

at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)

at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)

at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)

at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi All,


I'm still having trouble in uploading the Excel file to load to the server.Do we have to do any server specific setting(like MIME etc..) for the server to accept GZIP files.....I'm not sure where the problem is...

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Upload Excel using IO and servlet
 
Similar Threads
Record count
how to show html page
Struts FormFile to java.io.File
Translate CharSet of InputStream
How to attach a certificate to a socket and send a https POST request?