Are you getting some header information in there? This error is generated when the first 8 bytes of the file don't match the "Magic Number Identifier" that is at the top of all XLS files. So if I had to guess I'd say either you've somehow reversed the byte order (which doesn't make sense) or you simply captured header information or other bytes at the top of the stream.
-Andy On Tue, 2002-04-02 at 07:21, J�rgen Molderings wrote: > I'm new to POI and try to create a POIFSFileSystem resp. a HSSFWorkbook from > a ByteArrayInputStream. The reason for not using a xls File is, that the > user could upload a valid xls file through a servlet in an application server, > which passes the content of this uploaded file in a byte[] to the ExcelFile > Parser. If I run this application I get the following exception: > > java.io.IOException: Invalid header signature; read 3255307777713450285, > expected -2226271756974174256 > at > org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:124) > at > org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:120) > at de.d2vodafone.apps.vpn.ExcelParser.<init>(ExcelParser.java:78) > at > de.d2vodafone.apps.vpn.SmartUpload.processXlsFile(SmartUpload.java:29) > at > de.vodafone._jsp._upload._DoUpload._jspService(_DoUpload.java:122) > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:106) > at > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:124) > at > >weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:507) > at > >weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:481) > at > >weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:252) > at > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364) > at > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252) > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129) > > If I save the uploaded file temporary in the application server's file > system and read the file through a FileInputStream, everything works ok. > > Where is my mistake ?? > > TIA > > Juergen > > -- > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net > -- http://www.superlinksoftware.com http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound Document format to java http://developer.java.sun.com/developer/bugParade/bugs/4487555.html - fix java generics! The avalanche has already started. It is too late for the pebbles to vote. -Ambassador Kosh
