You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jorge Moya <jo...@gmail.com> on 2010/06/08 18:37:19 UTC

openxml4j InvalidFormatException

Ok guys, I'm trying to extract the information of an .xlsx document using
POI API and the ss.usermodel (using an app I made), however when I tried to
upload the file to the server, it returned me these errors on the server's
tomcat console:

org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read
content t
ypes part !
        at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
ntTypeManager.java:107)
        at
org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
pContentTypeManager.java:56)
        at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
136)
        at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)

        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
        at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
va:63)
        at com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
        at com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
        at
com.msights.core.validation.ValidationModule.run(ValidationModule.jav
a:154)
        at java.lang.Thread.run(Thread.java:595)

Any idea of what's happening? Uploading .XLS files work fine. Extracting
info on my local machine works fine, as well.

Re: openxml4j InvalidFormatException

Posted by Fernando Hernandez <fh...@msights.com>.
MSB <markbrdsly <at> tiscali.co.uk> writes:

> 
> 
> The other thought I had today whilst putting an extra keen edge onto an axe
> was this;
> 
> 1. Have the Excel workbook file on your PC and try to process that file
> using the POI code.
> 2. If that works, upload the file to the server and try to process it there
> using the same code base.
> 
> If that fails then there has to be a problem with the file which was
> introduced by the procees of copying the file to the server and it is one
> that POI is not able to circunvent. It seems from the error message you
> posted that it is not possible for the POI core code to locate a specific
> part of the zip file as it is either unpacking it or as it trying to locate
> that part whilst parsing the xml.
> 
> The only other thing I tought that you could do is to look into the file
> using a tool such as WinRAR. That way, you will be able to see if the
> various files and folders are presnet and in the locations they should
> occupy.
> 
> Do not know if this will help at all - and I must admit to being a little
> stumpled myself - but as it had been a while since anyone posted in response
> to your original message, I wanted to try and keep the discussion going
> forward.
> 
> Yours
> 
> Mark B
> 
> Jorge Moya wrote:
> > 
> > I've verified and the file is functional. I'm really clueless, atm.
> > 
> > On Thu, Jun 10, 2010 at 1:53 AM, MSB <markbrdsly <at> tiscali.co.uk> wrote:
> > 
> >>
> >> Is it possible that the structure of the file is being mangled somehow?
> >> Have
> >> you tried to open the file using Excel after it has been ftp'd into the
> >> folder on your server?
> >>
> >> Yours
> >>
> >> Mark B
> >>
> >>
> >> Jorge Moya wrote:
> >> >
> >> > I'm sorry for spam, but I menat it breaks when it tries to extract the
> >> > info
> >> > from the file.
> >> >
> >> > Thanks in advance.
> >> >


Hi,

I'm a colleague of Jorge's and as a follow up, I want to share with you all what 
the result/fix of this issue was. 

There is already a ticket on bugzilla in the POI project(see 
https://issues.apache.org/bugzilla/show_bug.cgi?id=49449), but still I want to 
share the results on this.

The problem was indeed with the xerces jars. It looks like the geronimo-stax jar 
that needs POI to run XLSX files, in a specific webapp in Tomcat 5.5, made 
conflict with the xerces jar in the endorsed folder. The fix was to move those 
jars in the endorsed folder to the common lib folder and do not override any  
Tomcat's XML parser (see http://tomcat.apache.org/tomcat-5.5-doc/RELEASE-
NOTES.txt)

Thank you all for your help on this issue.

Fernando



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by MSB <ma...@tiscali.co.uk>.
The other thought I had today whilst putting an extra keen edge onto an axe
was this;

1. Have the Excel workbook file on your PC and try to process that file
using the POI code.
2. If that works, upload the file to the server and try to process it there
using the same code base.

If that fails then there has to be a problem with the file which was
introduced by the procees of copying the file to the server and it is one
that POI is not able to circunvent. It seems from the error message you
posted that it is not possible for the POI core code to locate a specific
part of the zip file as it is either unpacking it or as it trying to locate
that part whilst parsing the xml.

The only other thing I tought that you could do is to look into the file
using a tool such as WinRAR. That way, you will be able to see if the
various files and folders are presnet and in the locations they should
occupy.

Do not know if this will help at all - and I must admit to being a little
stumpled myself - but as it had been a while since anyone posted in response
to your original message, I wanted to try and keep the discussion going
forward.

Yours

Mark B


Jorge Moya wrote:
> 
> I've verified and the file is functional. I'm really clueless, atm.
> 
> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
> 
>>
>> Is it possible that the structure of the file is being mangled somehow?
>> Have
>> you tried to open the file using Excel after it has been ftp'd into the
>> folder on your server?
>>
>> Yours
>>
>> Mark B
>>
>>
>> Jorge Moya wrote:
>> >
>> > I'm sorry for spam, but I menat it breaks when it tries to extract the
>> > info
>> > from the file.
>> >
>> > Thanks in advance.
>> >
>> > On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
>> >
>> >> What do you mean, exactly? I'm uploading the files through an FTP
>> server,
>> >> and after upload I execute the validation of my app which proceed to
>> >> extract
>> >> the information from a designated folder, but it breaks when it tries
>> to
>> >> upload the file with mentioned errors.
>> >>
>> >>
>> >> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>> >> <df...@jmlafferty.com>wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> You should write the uploaded file to your temporary file and then
>> read
>> >>> it
>> >>> in.
>> >>>
>> >>> OOXML files are zip files and are not accessed non-serailly. The user
>> >>> might stop transfer or the network connection might break.
>> >>>
>> >>> Regards,
>> >>> Dave
>> >>>
>> >>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>> >>>
>> >>> > Ok guys, I'm trying to extract the information of an .xlsx document
>> >>> using
>> >>> > POI API and the ss.usermodel (using an app I made), however when I
>> >>> tried
>> >>> to
>> >>> > upload the file to the server, it returned me these errors on the
>> >>> server's
>> >>> > tomcat console:
>> >>> >
>> >>> > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
>> read
>> >>> > content t
>> >>> > ypes part !
>> >>> >        at
>> >>> >
>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>> >>> > ntTypeManager.java:107)
>> >>> >        at
>> >>> >
>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>> >>> > pContentTypeManager.java:56)
>> >>> >        at
>> >>> >
>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>> >>> > 136)
>> >>> >        at
>> >>> >
>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>> >>> >
>> >>> >        at
>> >>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>> >>> >        at
>> >>> >
>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>> >>> > va:63)
>> >>> >        at
>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>> >>> >        at
>> >>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>> >>> >        at
>> >>> >
>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>> >>> > a:154)
>> >>> >        at java.lang.Thread.run(Thread.java:595)
>> >>> >
>> >>> > Any idea of what's happening? Uploading .XLS files work fine.
>> >>> Extracting
>> >>> > info on my local machine works fine, as well.
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>
>> >>>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>> Sent from the POI - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28844532.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Nick Burch <ni...@alfresco.com>.
On Thu, 17 Jun 2010, Jorge Moya wrote:
> One last question, actually: Do you guys have any idea why xercesImpl 
> and xercesImpl.2.9.0 are causing a conflict with POI and .xlsx data? If 
> both files are stored in the endorsed folder, it'll state the "can't 
> find file" error, but if I remove any of the two, it'll extract the 
> info..

POI doesn't do the XML parsing directly (well, not if you use the 
usermodel - eventusermodel may do some...). We delegate all the work down 
to XmlBeans for the xml parsing. You might want to look at the xmlbeans 
documentation on different xml parsers, endorsed libs and such

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
One last question, actually: Do you guys have any idea why xercesImpl and
xercesImpl.2.9.0 are causing a conflict with POI and .xlsx data? If both
files are stored in the endorsed folder, it'll state the "can't find file"
error, but if I remove any of the two, it'll extract the info..
unfortunately, apparently the other part of the webapp needs 'em so I can
get one thing to work and the other one fails. So I'm kind of stuck.

Any ideas?

On Wed, Jun 16, 2010 at 12:47 PM, David Fisher <df...@jmlafferty.com>wrote:

> You are welcome. Glad that you tracked it down. I don't have a good answer
> to how to avoid what you went through.
>
> I've added a bugzilla entry to request a better and more informative
> message when the unusable parser situation is encountered.
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=49449
>
> Thanks,
> Dave
>
> On Jun 16, 2010, at 10:06 AM, Jorge Moya wrote:
>
> > Ok, I'm back.
> >
> > I think I'm on to something.. I checked the endorsed folder and found
> > several .jar files. I've experimented and I've found the .jar that is
> giving
> > me the problem is xercesImpl.jar. If I remove that one, my code now reads
> > and extracts the information, unfortunately I need that .jar for the
> other
> > part of the webservice (not sure which, since I have only updated the
> excel
> > loader process) to effectively upload the information. Guess I just need
> to
> > find a way around (or update the process).
> >
> > Thanks guys.
> >
> > On Tue, Jun 15, 2010 at 10:26 AM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >
> >> You are welcome. I was working on a reply last Friday when work took me
> >> elsewhere.
> >>
> >> You got to the correct place. Here is a clue in the release notes for
> >> Tomcat:
> >>
> >>> To override the XML parser implementation or interfaces, use the
> endorsed
> >>> mechanism of the JVM. The default configuration defines JARs located in
> >>> "common/endorsed" as endorsed.
> >>
> >> You might be able to get help locating which of the many jars is
> changing
> >> the parser from the tomcat user list.
> >>
> >> http://tomcat.apache.org/
> >>
> >> Regards,
> >> Dave
> >>
> >>
> >> On Jun 15, 2010, at 8:19 AM, Jorge Moya wrote:
> >>
> >>> I just wanted to say that I've figured this is, effectively like you
> >> said,
> >>> an issue with the libraries and the current configuration of Tomcat on
> >> the
> >>> server environment. Coincidentally, I finally tried Tomcat in my local
> >>> environment and it functions the way it should on the particular
> >> situation.
> >>> Guess it's just a matter of time and patience on figuring out which
> >>> webservice (and it's libraries) are conflicting with the xml ones.
> >>>
> >>> Thanks for the assistance.
> >>>
> >>> On Fri, Jun 11, 2010 at 1:55 PM, Jorge Moya <jo...@gmail.com> wrote:
> >>>
> >>>> I did restart the Tomcat.
> >>>>
> >>>> Java version is 1.5.0_18-b02
> >>>> Windows version is Windows Server 2003 SP2
> >>>>
> >>>> Libraries:
> >>>> *http://bit.ly/casaPs*
> >>>> Shared only has cewcanative.jar
> >>>>
> >>>> Tomcast effectively has access to the directory (why can it
> successfully
> >>>> extract .xls files?).
> >>>>
> >>>> My local environment has less .jars than on the server, it's windows
> xp,
> >>>> and I'm testing the app using an ant build. (or by running a simple
> java
> >>>> .class)
> >>>>
> >>>> Hope this helps. I really appreciate all the help I've received so
> far.
> >>>>
> >>>> Thanks in advance.
> >>>>
> >>>> On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <
> dfisher@jmlafferty.com
> >>> wrote:
> >>>>
> >>>>> When you removed the jars, did you restart Tomcat?
> >>>>>
> >>>>> What version of Java is running on your Windows server and what
> version
> >> of
> >>>>> Windows?
> >>>>>
> >>>>> Can you list all of the jars in tomcat/common/lib and
> >> tomcat/shared/lib?
> >>>>>
> >>>>> Does your Tomcat server have proper access rights to the temporary
> >>>>> directory? Could there be a locking issue?
> >>>>>
> >>>>> How is your local environment different from your server?
> >>>>>
> >>>>> THere ought to be someone at your job who understands your Tomcat
> >> server.
> >>>>> Is there an internal resource? As you see I suspect that your problem
> >> is
> >>>>> really a Tomcat configuration issue. There is a very active Tomcat
> User
> >> list
> >>>>> - http://tomcat.apache.org/lists.html#tomcat-users
> >>>>>
> >>>>> Regards,
> >>>>> Dave
> >>>>>
> >>>>> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
> >>>>>
> >>>>>> I've tried removing the extra .jars and it still won't work. I just
> >>>>> don't
> >>>>>> get it.
> >>>>>>
> >>>>>> On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <
> dfisher@jmlafferty.com
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Glad to help.
> >>>>>>>
> >>>>>>>> Closest-named classes I could find under common\lib are:
> >>>>>>>>
> >>>>>>>> xbean-2.2.0.jar
> >>>>>>>> stax-api-1.0.1.jar
> >>>>>>>> axis2-xmlbeans-1.3.jar
> >>>>>>>
> >>>>>>> Those are not normal to a standard Tomcat 5.5. These are probably
> >>>>>>> conflicting in some strange way (the tomcat classloader is strange
> >> and
> >>>>> is
> >>>>>>> simplified in Tomcat 6.) They were probably added because they are
> >>>>> required
> >>>>>>> by some other webapps on the server.
> >>>>>>>
> >>>>>>> Can you take these out temporarily and restart your tomcat server?
> >>>>>>>
> >>>>>>> Or does someone else own that asset? If so they will need to help
> >> you.
> >>>>>>>
> >>>>>>> They might work better in shared\lib but that is really a guess and
> >> the
> >>>>>>> issue may be with the other non-POI apps on that server.
> >>>>>>>
> >>>>>>> Regards,
> >>>>>>> Dave
> >>>>>>>
> >>>>>>>
> >>>>>>>>
> >>>>>>>> Tomcat version: 5.5.20
> >>>>>>>>
> >>>>>>>> Tomcat is not initialized with -Djava.awt.headless=true
> >>>>>>>>
> >>>>>>>> Sorry to keep you guys on the same issue.. it's just that I'm new
> >> with
> >>>>>>> POI
> >>>>>>>> and tomcat (intern), and I'm trying to update the webapp.
> >>>>>>>>
> >>>>>>>> Thanks in advance.
> >>>>>>>>
> >>>>>>>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <
> >> dfisher@jmlafferty.com
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> Here a few things that I would check.
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> >>>>>>>>>>
> >>>>>>>>>> Including:
> >>>>>>>>>> poi-3.6
> >>>>>>>>>> poi-contrib-3.6
> >>>>>>>>>> poi-ooxml-3.6
> >>>>>>>>>> poi-scratchpad 3.6
> >>>>>>>>>> ooxml-schemas-1.0
> >>>>>>>>>> xmlbeans-2.3.0
> >>>>>>>>>> dom4j-1.6.1
> >>>>>>>>>> geronimo-stax
> >>>>>>>>>
> >>>>>>>>> (I just saw you conversation with Nick in the earlier thread.)
> >>>>>>>>>
> >>>>>>>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are
> there
> >>>>>>> other
> >>>>>>>>> versions of any of these Jars?
> >>>>>>>>>
> >>>>>>>>>> Java version: 1.5
> >>>>>>>>>> Tomcat: 5.5
> >>>>>>>>>
> >>>>>>>>> Which Tomcat 5.5? The current version is 5.5.29.
> >>>>>>>>>
> >>>>>>>>> Is your Tomcat started with -Djava.awt.headless=true?
> >>>>>>>>>
> >>>>>>>>> Regards,
> >>>>>>>>> Dave
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
> >>>>> dfisher@jmlafferty.com
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>>> Yes, this file was created using Excel 2007. The file was
> >>>>> originally
> >>>>>>> an
> >>>>>>>>>>>> .xls, and I migrated it to .xlsx (however, I have tried
> >> uploading
> >>>>>>> both
> >>>>>>>>>>> new
> >>>>>>>>>>>> and modified .xls files and it won't budge).
> >>>>>>>>>>>>
> >>>>>>>>>>>> Per request, I unzipped the .xlsx files and the reported
> >> structure
> >>>>> is
> >>>>>>>>>>> this:
> >>>>>>>>>>>>
> >>>>>>>>>>>> _rels Folder
> >>>>>>>>>>>> docProps Folder
> >>>>>>>>>>>> xl Folder
> >>>>>>>>>>>> [Content_Types].xml
> >>>>>>>>>>>
> >>>>>>>>>>> What's in this file?
> >>>>>>>>>>>
> >>>>>>>>>>>> Inside the xl folder I found the following files:
> >>>>>>>>>>>>
> >>>>>>>>>>>> _rels Folder
> >>>>>>>>>>>> printerSettings Folder
> >>>>>>>>>>>> theme folder
> >>>>>>>>>>>> worksheets folder
> >>>>>>>>>>>> sharedStrings.xml
> >>>>>>>>>>>> styles.xml
> >>>>>>>>>>>> workbook.xml
> >>>>>>>>>>>>
> >>>>>>>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
> >>>>>>>>>>>>
> >>>>>>>>>>>> I'll post my code (where it breaks) and see if there's
> something
> >>>>> with
> >>>>>>>>> the
> >>>>>>>>>>>> code (although that wouldn't make sense, since it works
> >> perfectly
> >>>>>>> fine
> >>>>>>>>> in
> >>>>>>>>>>>> this machine -- with both .xls and .xlsx files).
> >>>>>>>>>>>
> >>>>>>>>>>> What versions of Java are you running where it works?
> >>>>>>>>>>>
> >>>>>>>>>>> What version of Tomcat does your server use? Where are the POI
> >> jars
> >>>>> in
> >>>>>>>>> your
> >>>>>>>>>>> Tomcat installation?
> >>>>>>>>>>>
> >>>>>>>>>>> Regards,
> >>>>>>>>>>> Dave
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> public void loadFile(File oFileToLoad) throws
> >>>>> FileNotFoundException,
> >>>>>>>>>>>> LoaderException, ValidationException {
> >>>>>>>>>>>>   Workbook oWorkgroup;
> >>>>>>>>>>>>
> >>>>>>>>>>>>   m_oFileName = oFileToLoad;
> >>>>>>>>>>>>   try {
> >>>>>>>>>>>>    //LOG.Log("ExcelFile - Loading file name: " +
> >>>>>>>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >>>>>>>>>>>>    m_oIn = new FileInputStream(m_oFileName);
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>       oWorkgroup = WorkbookFactory.create(m_oIn);
> >>>>>>>>>>>>
> >>>>>>>>>>>>     if (oWorkgroup.getNumberOfSheets() == 0) {
> >>>>>>>>>>>>         // page not found throw exception
> >>>>>>>>>>>>         throw new LoaderException("Excel document does not
> >>>>> contain
> >>>>>>>>> a
> >>>>>>>>>>>> workbook");
> >>>>>>>>>>>>     }
> >>>>>>>>>>>>
> >>>>>>>>>>>>     m_oSheet = oWorkgroup.getSheetAt(0);
> >>>>>>>>>>>>
> >>>>>>>>>>>>     m_nTotalRows = getTotalRows();
> >>>>>>>>>>>>
> >>>>>>>>>>>>    //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> >>>>>>>>>>>> LOG.LOG_TYPE_TRACE);
> >>>>>>>>>>>>   } catch(OldExcelFormatException e){
> >>>>>>>>>>>>    throw new ValidationException("This is an Excel 95 File, we
> >>>>> can
> >>>>>>>>>>>> process only Excel 97-2007. ",
> >>>>>>>>>>>>    1, ValidationException.EXCEL_95_ERROR);
> >>>>>>>>>>>>
> >>>>>>>>>>>>   }catch (IOException ioe) {
> >>>>>>>>>>>>    //LOG.LogErrors(ioe);
> >>>>>>>>>>>>    ioe.printStackTrace();
> >>>>>>>>>>>>    throw new LoaderException("Exception reading the excel
> >>>>>>>>>>> document");
> >>>>>>>>>>>>
> >>>>>>>>>>>>   } catch (InvalidFormatException e) {
> >>>>>>>>>>>>    // Catch created for Workbook.create method. Unspecified.
> >>>>>>>>>>>>
> >>>>>>>>>>>> e.printStackTrace();
> >>>>>>>>>>>> }
> >>>>>>>>>>>> }
> >>>>>>>>>>>>
> >>>>>>>>>>>> Any thoughts?
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
> >>>>>>> dfisher@jmlafferty.com
> >>>>>>>>>>>> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Was this file created with Excel or another application like
> >>>>>>>>> OpenOffice?
> >>>>>>>>>>>>> What version of that application?
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Try unzipping the xlsx file and reporting the structure.
> These
> >>>>> OOXML
> >>>>>>>>>>> files
> >>>>>>>>>>>>> are really zipped up directories of xml files. I suspect that
> >>>>> there
> >>>>>>> is
> >>>>>>>>>>>>> something in your content type that POI does not understand.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Is this a file that you can share? If so, then I would
> suggest
> >>>>> that
> >>>>>>>>> you
> >>>>>>>>>>>>> create a bugzilla entry so that a developer can take a look
> >> when
> >>>>>>> they
> >>>>>>>>>>> have
> >>>>>>>>>>>>> time.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Regards,
> >>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> I've verified and the file is functional. I'm really
> clueless,
> >>>>> atm.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <
> >> markbrdsly@tiscali.co.uk>
> >>>>>>>>> wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Is it possible that the structure of the file is being
> >> mangled
> >>>>>>>>>>> somehow?
> >>>>>>>>>>>>>>> Have
> >>>>>>>>>>>>>>> you tried to open the file using Excel after it has been
> >> ftp'd
> >>>>>>> into
> >>>>>>>>>>> the
> >>>>>>>>>>>>>>> folder on your server?
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Yours
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Mark B
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Jorge Moya wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
> >>>>>>> extract
> >>>>>>>>>>> the
> >>>>>>>>>>>>>>>> info
> >>>>>>>>>>>>>>>> from the file.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Thanks in advance.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <
> >> jomoya@gmail.com
> >>>>>>
> >>>>>>>>>>> wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> What do you mean, exactly? I'm uploading the files
> through
> >> an
> >>>>>>> FTP
> >>>>>>>>>>>>>>> server,
> >>>>>>>>>>>>>>>>> and after upload I execute the validation of my app which
> >>>>>>> proceed
> >>>>>>>>> to
> >>>>>>>>>>>>>>>>> extract
> >>>>>>>>>>>>>>>>> the information from a designated folder, but it breaks
> >> when
> >>>>> it
> >>>>>>>>>>> tries
> >>>>>>>>>>>>> to
> >>>>>>>>>>>>>>>>> upload the file with mentioned errors.
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>>>>>>>>>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> You should write the uploaded file to your temporary
> file
> >>>>> and
> >>>>>>>>> then
> >>>>>>>>>>>>> read
> >>>>>>>>>>>>>>>>>> it
> >>>>>>>>>>>>>>>>>> in.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> OOXML files are zip files and are not accessed
> >> non-serailly.
> >>>>>>> The
> >>>>>>>>>>> user
> >>>>>>>>>>>>>>>>>> might stop transfer or the network connection might
> break.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Regards,
> >>>>>>>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an
> >> .xlsx
> >>>>>>>>>>> document
> >>>>>>>>>>>>>>>>>> using
> >>>>>>>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made),
> >> however
> >>>>>>> when
> >>>>>>>>> I
> >>>>>>>>>>>>>>>>>> tried
> >>>>>>>>>>>>>>>>>> to
> >>>>>>>>>>>>>>>>>>> upload the file to the server, it returned me these
> >> errors
> >>>>> on
> >>>>>>>>> the
> >>>>>>>>>>>>>>>>>> server's
> >>>>>>>>>>>>>>>>>>> tomcat console:
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>>
> >> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
> >>>>>>>>> Can't
> >>>>>>>>>>>>>>> read
> >>>>>>>>>>>>>>>>>>> content t
> >>>>>>>>>>>>>>>>>>> ypes part !
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>>>>>>>>>>>>> ntTypeManager.java:107)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>>>>>>>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>>>>>>>>>>>>> 136)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>
> >>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>>>>>>>>>>>>> va:63)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>
> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>
> >>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>>>>>>>>>>>> at
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>>>>>>>>>>>>> a:154)
> >>>>>>>>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
> >>>>> fine.
> >>>>>>>>>>>>>>>>>> Extracting
> >>>>>>>>>>>>>>>>>>> info on my local machine works fine, as well.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>>>>>>> For additional commands, e-mail:
> user-help@poi.apache.org
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> --
> >>>>>>>>>>>>>>> View this message in context:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>>>>>>>>>>>>> Sent from the POI - User mailing list archive at
> Nabble.com.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>
> >>>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
You are welcome. Glad that you tracked it down. I don't have a good answer to how to avoid what you went through.

I've added a bugzilla entry to request a better and more informative message when the unusable parser situation is encountered.

https://issues.apache.org/bugzilla/show_bug.cgi?id=49449

Thanks,
Dave

On Jun 16, 2010, at 10:06 AM, Jorge Moya wrote:

> Ok, I'm back.
> 
> I think I'm on to something.. I checked the endorsed folder and found
> several .jar files. I've experimented and I've found the .jar that is giving
> me the problem is xercesImpl.jar. If I remove that one, my code now reads
> and extracts the information, unfortunately I need that .jar for the other
> part of the webservice (not sure which, since I have only updated the excel
> loader process) to effectively upload the information. Guess I just need to
> find a way around (or update the process).
> 
> Thanks guys.
> 
> On Tue, Jun 15, 2010 at 10:26 AM, David Fisher <df...@jmlafferty.com>wrote:
> 
>> You are welcome. I was working on a reply last Friday when work took me
>> elsewhere.
>> 
>> You got to the correct place. Here is a clue in the release notes for
>> Tomcat:
>> 
>>> To override the XML parser implementation or interfaces, use the endorsed
>>> mechanism of the JVM. The default configuration defines JARs located in
>>> "common/endorsed" as endorsed.
>> 
>> You might be able to get help locating which of the many jars is changing
>> the parser from the tomcat user list.
>> 
>> http://tomcat.apache.org/
>> 
>> Regards,
>> Dave
>> 
>> 
>> On Jun 15, 2010, at 8:19 AM, Jorge Moya wrote:
>> 
>>> I just wanted to say that I've figured this is, effectively like you
>> said,
>>> an issue with the libraries and the current configuration of Tomcat on
>> the
>>> server environment. Coincidentally, I finally tried Tomcat in my local
>>> environment and it functions the way it should on the particular
>> situation.
>>> Guess it's just a matter of time and patience on figuring out which
>>> webservice (and it's libraries) are conflicting with the xml ones.
>>> 
>>> Thanks for the assistance.
>>> 
>>> On Fri, Jun 11, 2010 at 1:55 PM, Jorge Moya <jo...@gmail.com> wrote:
>>> 
>>>> I did restart the Tomcat.
>>>> 
>>>> Java version is 1.5.0_18-b02
>>>> Windows version is Windows Server 2003 SP2
>>>> 
>>>> Libraries:
>>>> *http://bit.ly/casaPs*
>>>> Shared only has cewcanative.jar
>>>> 
>>>> Tomcast effectively has access to the directory (why can it successfully
>>>> extract .xls files?).
>>>> 
>>>> My local environment has less .jars than on the server, it's windows xp,
>>>> and I'm testing the app using an ant build. (or by running a simple java
>>>> .class)
>>>> 
>>>> Hope this helps. I really appreciate all the help I've received so far.
>>>> 
>>>> Thanks in advance.
>>>> 
>>>> On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <dfisher@jmlafferty.com
>>> wrote:
>>>> 
>>>>> When you removed the jars, did you restart Tomcat?
>>>>> 
>>>>> What version of Java is running on your Windows server and what version
>> of
>>>>> Windows?
>>>>> 
>>>>> Can you list all of the jars in tomcat/common/lib and
>> tomcat/shared/lib?
>>>>> 
>>>>> Does your Tomcat server have proper access rights to the temporary
>>>>> directory? Could there be a locking issue?
>>>>> 
>>>>> How is your local environment different from your server?
>>>>> 
>>>>> THere ought to be someone at your job who understands your Tomcat
>> server.
>>>>> Is there an internal resource? As you see I suspect that your problem
>> is
>>>>> really a Tomcat configuration issue. There is a very active Tomcat User
>> list
>>>>> - http://tomcat.apache.org/lists.html#tomcat-users
>>>>> 
>>>>> Regards,
>>>>> Dave
>>>>> 
>>>>> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
>>>>> 
>>>>>> I've tried removing the extra .jars and it still won't work. I just
>>>>> don't
>>>>>> get it.
>>>>>> 
>>>>>> On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <dfisher@jmlafferty.com
>>>>>> wrote:
>>>>>> 
>>>>>>> Glad to help.
>>>>>>> 
>>>>>>>> Closest-named classes I could find under common\lib are:
>>>>>>>> 
>>>>>>>> xbean-2.2.0.jar
>>>>>>>> stax-api-1.0.1.jar
>>>>>>>> axis2-xmlbeans-1.3.jar
>>>>>>> 
>>>>>>> Those are not normal to a standard Tomcat 5.5. These are probably
>>>>>>> conflicting in some strange way (the tomcat classloader is strange
>> and
>>>>> is
>>>>>>> simplified in Tomcat 6.) They were probably added because they are
>>>>> required
>>>>>>> by some other webapps on the server.
>>>>>>> 
>>>>>>> Can you take these out temporarily and restart your tomcat server?
>>>>>>> 
>>>>>>> Or does someone else own that asset? If so they will need to help
>> you.
>>>>>>> 
>>>>>>> They might work better in shared\lib but that is really a guess and
>> the
>>>>>>> issue may be with the other non-POI apps on that server.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Dave
>>>>>>> 
>>>>>>> 
>>>>>>>> 
>>>>>>>> Tomcat version: 5.5.20
>>>>>>>> 
>>>>>>>> Tomcat is not initialized with -Djava.awt.headless=true
>>>>>>>> 
>>>>>>>> Sorry to keep you guys on the same issue.. it's just that I'm new
>> with
>>>>>>> POI
>>>>>>>> and tomcat (intern), and I'm trying to update the webapp.
>>>>>>>> 
>>>>>>>> Thanks in advance.
>>>>>>>> 
>>>>>>>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <
>> dfisher@jmlafferty.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>> 
>>>>>>>>> Here a few things that I would check.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
>>>>>>>>>> 
>>>>>>>>>> Including:
>>>>>>>>>> poi-3.6
>>>>>>>>>> poi-contrib-3.6
>>>>>>>>>> poi-ooxml-3.6
>>>>>>>>>> poi-scratchpad 3.6
>>>>>>>>>> ooxml-schemas-1.0
>>>>>>>>>> xmlbeans-2.3.0
>>>>>>>>>> dom4j-1.6.1
>>>>>>>>>> geronimo-stax
>>>>>>>>> 
>>>>>>>>> (I just saw you conversation with Nick in the earlier thread.)
>>>>>>>>> 
>>>>>>>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
>>>>>>> other
>>>>>>>>> versions of any of these Jars?
>>>>>>>>> 
>>>>>>>>>> Java version: 1.5
>>>>>>>>>> Tomcat: 5.5
>>>>>>>>> 
>>>>>>>>> Which Tomcat 5.5? The current version is 5.5.29.
>>>>>>>>> 
>>>>>>>>> Is your Tomcat started with -Djava.awt.headless=true?
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Dave
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
>>>>> dfisher@jmlafferty.com
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>>> Yes, this file was created using Excel 2007. The file was
>>>>> originally
>>>>>>> an
>>>>>>>>>>>> .xls, and I migrated it to .xlsx (however, I have tried
>> uploading
>>>>>>> both
>>>>>>>>>>> new
>>>>>>>>>>>> and modified .xls files and it won't budge).
>>>>>>>>>>>> 
>>>>>>>>>>>> Per request, I unzipped the .xlsx files and the reported
>> structure
>>>>> is
>>>>>>>>>>> this:
>>>>>>>>>>>> 
>>>>>>>>>>>> _rels Folder
>>>>>>>>>>>> docProps Folder
>>>>>>>>>>>> xl Folder
>>>>>>>>>>>> [Content_Types].xml
>>>>>>>>>>> 
>>>>>>>>>>> What's in this file?
>>>>>>>>>>> 
>>>>>>>>>>>> Inside the xl folder I found the following files:
>>>>>>>>>>>> 
>>>>>>>>>>>> _rels Folder
>>>>>>>>>>>> printerSettings Folder
>>>>>>>>>>>> theme folder
>>>>>>>>>>>> worksheets folder
>>>>>>>>>>>> sharedStrings.xml
>>>>>>>>>>>> styles.xml
>>>>>>>>>>>> workbook.xml
>>>>>>>>>>>> 
>>>>>>>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
>>>>>>>>>>>> 
>>>>>>>>>>>> I'll post my code (where it breaks) and see if there's something
>>>>> with
>>>>>>>>> the
>>>>>>>>>>>> code (although that wouldn't make sense, since it works
>> perfectly
>>>>>>> fine
>>>>>>>>> in
>>>>>>>>>>>> this machine -- with both .xls and .xlsx files).
>>>>>>>>>>> 
>>>>>>>>>>> What versions of Java are you running where it works?
>>>>>>>>>>> 
>>>>>>>>>>> What version of Tomcat does your server use? Where are the POI
>> jars
>>>>> in
>>>>>>>>> your
>>>>>>>>>>> Tomcat installation?
>>>>>>>>>>> 
>>>>>>>>>>> Regards,
>>>>>>>>>>> Dave
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> public void loadFile(File oFileToLoad) throws
>>>>> FileNotFoundException,
>>>>>>>>>>>> LoaderException, ValidationException {
>>>>>>>>>>>>   Workbook oWorkgroup;
>>>>>>>>>>>> 
>>>>>>>>>>>>   m_oFileName = oFileToLoad;
>>>>>>>>>>>>   try {
>>>>>>>>>>>>    //LOG.Log("ExcelFile - Loading file name: " +
>>>>>>>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>>>>>>>>>>>>    m_oIn = new FileInputStream(m_oFileName);
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>       oWorkgroup = WorkbookFactory.create(m_oIn);
>>>>>>>>>>>> 
>>>>>>>>>>>>     if (oWorkgroup.getNumberOfSheets() == 0) {
>>>>>>>>>>>>         // page not found throw exception
>>>>>>>>>>>>         throw new LoaderException("Excel document does not
>>>>> contain
>>>>>>>>> a
>>>>>>>>>>>> workbook");
>>>>>>>>>>>>     }
>>>>>>>>>>>> 
>>>>>>>>>>>>     m_oSheet = oWorkgroup.getSheetAt(0);
>>>>>>>>>>>> 
>>>>>>>>>>>>     m_nTotalRows = getTotalRows();
>>>>>>>>>>>> 
>>>>>>>>>>>>    //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>>>>>>>>>>>> LOG.LOG_TYPE_TRACE);
>>>>>>>>>>>>   } catch(OldExcelFormatException e){
>>>>>>>>>>>>    throw new ValidationException("This is an Excel 95 File, we
>>>>> can
>>>>>>>>>>>> process only Excel 97-2007. ",
>>>>>>>>>>>>    1, ValidationException.EXCEL_95_ERROR);
>>>>>>>>>>>> 
>>>>>>>>>>>>   }catch (IOException ioe) {
>>>>>>>>>>>>    //LOG.LogErrors(ioe);
>>>>>>>>>>>>    ioe.printStackTrace();
>>>>>>>>>>>>    throw new LoaderException("Exception reading the excel
>>>>>>>>>>> document");
>>>>>>>>>>>> 
>>>>>>>>>>>>   } catch (InvalidFormatException e) {
>>>>>>>>>>>>    // Catch created for Workbook.create method. Unspecified.
>>>>>>>>>>>> 
>>>>>>>>>>>> e.printStackTrace();
>>>>>>>>>>>> }
>>>>>>>>>>>> }
>>>>>>>>>>>> 
>>>>>>>>>>>> Any thoughts?
>>>>>>>>>>>> 
>>>>>>>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
>>>>>>> dfisher@jmlafferty.com
>>>>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Was this file created with Excel or another application like
>>>>>>>>> OpenOffice?
>>>>>>>>>>>>> What version of that application?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Try unzipping the xlsx file and reporting the structure. These
>>>>> OOXML
>>>>>>>>>>> files
>>>>>>>>>>>>> are really zipped up directories of xml files. I suspect that
>>>>> there
>>>>>>> is
>>>>>>>>>>>>> something in your content type that POI does not understand.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Is this a file that you can share? If so, then I would suggest
>>>>> that
>>>>>>>>> you
>>>>>>>>>>>>> create a bugzilla entry so that a developer can take a look
>> when
>>>>>>> they
>>>>>>>>>>> have
>>>>>>>>>>>>> time.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> Dave
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>>>>>>>>>>>>> 
>>>>>>>>>>>>>> I've verified and the file is functional. I'm really clueless,
>>>>> atm.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <
>> markbrdsly@tiscali.co.uk>
>>>>>>>>> wrote:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Is it possible that the structure of the file is being
>> mangled
>>>>>>>>>>> somehow?
>>>>>>>>>>>>>>> Have
>>>>>>>>>>>>>>> you tried to open the file using Excel after it has been
>> ftp'd
>>>>>>> into
>>>>>>>>>>> the
>>>>>>>>>>>>>>> folder on your server?
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Yours
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Mark B
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Jorge Moya wrote:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
>>>>>>> extract
>>>>>>>>>>> the
>>>>>>>>>>>>>>>> info
>>>>>>>>>>>>>>>> from the file.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Thanks in advance.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <
>> jomoya@gmail.com
>>>>>> 
>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through
>> an
>>>>>>> FTP
>>>>>>>>>>>>>>> server,
>>>>>>>>>>>>>>>>> and after upload I execute the validation of my app which
>>>>>>> proceed
>>>>>>>>> to
>>>>>>>>>>>>>>>>> extract
>>>>>>>>>>>>>>>>> the information from a designated folder, but it breaks
>> when
>>>>> it
>>>>>>>>>>> tries
>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>> upload the file with mentioned errors.
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>>>>>>>>>>>>> <df...@jmlafferty.com>wrote:
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> You should write the uploaded file to your temporary file
>>>>> and
>>>>>>>>> then
>>>>>>>>>>>>> read
>>>>>>>>>>>>>>>>>> it
>>>>>>>>>>>>>>>>>> in.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> OOXML files are zip files and are not accessed
>> non-serailly.
>>>>>>> The
>>>>>>>>>>> user
>>>>>>>>>>>>>>>>>> might stop transfer or the network connection might break.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an
>> .xlsx
>>>>>>>>>>> document
>>>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made),
>> however
>>>>>>> when
>>>>>>>>> I
>>>>>>>>>>>>>>>>>> tried
>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>>> upload the file to the server, it returned me these
>> errors
>>>>> on
>>>>>>>>> the
>>>>>>>>>>>>>>>>>> server's
>>>>>>>>>>>>>>>>>>> tomcat console:
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> 
>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
>>>>>>>>> Can't
>>>>>>>>>>>>>>> read
>>>>>>>>>>>>>>>>>>> content t
>>>>>>>>>>>>>>>>>>> ypes part !
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>>>>>>>>>>>>> ntTypeManager.java:107)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>>>>>>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>>>>>>>>>>>>> 136)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>>>>>>>>>>>>> va:63)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>> 
>>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>>>>>>>>>>>>> a:154)
>>>>>>>>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:595)
>>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
>>>>> fine.
>>>>>>>>>>>>>>>>>> Extracting
>>>>>>>>>>>>>>>>>>> info on my local machine works fine, as well.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>> 
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>>>>>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>> 
>>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
Ok, I'm back.

I think I'm on to something.. I checked the endorsed folder and found
several .jar files. I've experimented and I've found the .jar that is giving
me the problem is xercesImpl.jar. If I remove that one, my code now reads
and extracts the information, unfortunately I need that .jar for the other
part of the webservice (not sure which, since I have only updated the excel
loader process) to effectively upload the information. Guess I just need to
find a way around (or update the process).

Thanks guys.

On Tue, Jun 15, 2010 at 10:26 AM, David Fisher <df...@jmlafferty.com>wrote:

> You are welcome. I was working on a reply last Friday when work took me
> elsewhere.
>
> You got to the correct place. Here is a clue in the release notes for
> Tomcat:
>
> > To override the XML parser implementation or interfaces, use the endorsed
> > mechanism of the JVM. The default configuration defines JARs located in
> > "common/endorsed" as endorsed.
>
> You might be able to get help locating which of the many jars is changing
> the parser from the tomcat user list.
>
> http://tomcat.apache.org/
>
> Regards,
> Dave
>
>
> On Jun 15, 2010, at 8:19 AM, Jorge Moya wrote:
>
> > I just wanted to say that I've figured this is, effectively like you
> said,
> > an issue with the libraries and the current configuration of Tomcat on
> the
> > server environment. Coincidentally, I finally tried Tomcat in my local
> > environment and it functions the way it should on the particular
> situation.
> > Guess it's just a matter of time and patience on figuring out which
> > webservice (and it's libraries) are conflicting with the xml ones.
> >
> > Thanks for the assistance.
> >
> > On Fri, Jun 11, 2010 at 1:55 PM, Jorge Moya <jo...@gmail.com> wrote:
> >
> >> I did restart the Tomcat.
> >>
> >> Java version is 1.5.0_18-b02
> >> Windows version is Windows Server 2003 SP2
> >>
> >> Libraries:
> >> *http://bit.ly/casaPs*
> >> Shared only has cewcanative.jar
> >>
> >> Tomcast effectively has access to the directory (why can it successfully
> >> extract .xls files?).
> >>
> >> My local environment has less .jars than on the server, it's windows xp,
> >> and I'm testing the app using an ant build. (or by running a simple java
> >> .class)
> >>
> >> Hope this helps. I really appreciate all the help I've received so far.
> >>
> >> Thanks in advance.
> >>
> >> On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >>
> >>> When you removed the jars, did you restart Tomcat?
> >>>
> >>> What version of Java is running on your Windows server and what version
> of
> >>> Windows?
> >>>
> >>> Can you list all of the jars in tomcat/common/lib and
> tomcat/shared/lib?
> >>>
> >>> Does your Tomcat server have proper access rights to the temporary
> >>> directory? Could there be a locking issue?
> >>>
> >>> How is your local environment different from your server?
> >>>
> >>> THere ought to be someone at your job who understands your Tomcat
> server.
> >>> Is there an internal resource? As you see I suspect that your problem
> is
> >>> really a Tomcat configuration issue. There is a very active Tomcat User
> list
> >>> - http://tomcat.apache.org/lists.html#tomcat-users
> >>>
> >>> Regards,
> >>> Dave
> >>>
> >>> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
> >>>
> >>>> I've tried removing the extra .jars and it still won't work. I just
> >>> don't
> >>>> get it.
> >>>>
> >>>> On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <dfisher@jmlafferty.com
> >>>> wrote:
> >>>>
> >>>>> Glad to help.
> >>>>>
> >>>>>> Closest-named classes I could find under common\lib are:
> >>>>>>
> >>>>>> xbean-2.2.0.jar
> >>>>>> stax-api-1.0.1.jar
> >>>>>> axis2-xmlbeans-1.3.jar
> >>>>>
> >>>>> Those are not normal to a standard Tomcat 5.5. These are probably
> >>>>> conflicting in some strange way (the tomcat classloader is strange
> and
> >>> is
> >>>>> simplified in Tomcat 6.) They were probably added because they are
> >>> required
> >>>>> by some other webapps on the server.
> >>>>>
> >>>>> Can you take these out temporarily and restart your tomcat server?
> >>>>>
> >>>>> Or does someone else own that asset? If so they will need to help
> you.
> >>>>>
> >>>>> They might work better in shared\lib but that is really a guess and
> the
> >>>>> issue may be with the other non-POI apps on that server.
> >>>>>
> >>>>> Regards,
> >>>>> Dave
> >>>>>
> >>>>>
> >>>>>>
> >>>>>> Tomcat version: 5.5.20
> >>>>>>
> >>>>>> Tomcat is not initialized with -Djava.awt.headless=true
> >>>>>>
> >>>>>> Sorry to keep you guys on the same issue.. it's just that I'm new
> with
> >>>>> POI
> >>>>>> and tomcat (intern), and I'm trying to update the webapp.
> >>>>>>
> >>>>>> Thanks in advance.
> >>>>>>
> >>>>>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <
> dfisher@jmlafferty.com
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> Here a few things that I would check.
> >>>>>>>
> >>>>>>>
> >>>>>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> >>>>>>>>
> >>>>>>>> Including:
> >>>>>>>> poi-3.6
> >>>>>>>> poi-contrib-3.6
> >>>>>>>> poi-ooxml-3.6
> >>>>>>>> poi-scratchpad 3.6
> >>>>>>>> ooxml-schemas-1.0
> >>>>>>>> xmlbeans-2.3.0
> >>>>>>>> dom4j-1.6.1
> >>>>>>>> geronimo-stax
> >>>>>>>
> >>>>>>> (I just saw you conversation with Nick in the earlier thread.)
> >>>>>>>
> >>>>>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
> >>>>> other
> >>>>>>> versions of any of these Jars?
> >>>>>>>
> >>>>>>>> Java version: 1.5
> >>>>>>>> Tomcat: 5.5
> >>>>>>>
> >>>>>>> Which Tomcat 5.5? The current version is 5.5.29.
> >>>>>>>
> >>>>>>> Is your Tomcat started with -Djava.awt.headless=true?
> >>>>>>>
> >>>>>>> Regards,
> >>>>>>> Dave
> >>>>>>>
> >>>>>>>
> >>>>>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
> >>> dfisher@jmlafferty.com
> >>>>>>>> wrote:
> >>>>>>>>
> >>>>>>>>>> Yes, this file was created using Excel 2007. The file was
> >>> originally
> >>>>> an
> >>>>>>>>>> .xls, and I migrated it to .xlsx (however, I have tried
> uploading
> >>>>> both
> >>>>>>>>> new
> >>>>>>>>>> and modified .xls files and it won't budge).
> >>>>>>>>>>
> >>>>>>>>>> Per request, I unzipped the .xlsx files and the reported
> structure
> >>> is
> >>>>>>>>> this:
> >>>>>>>>>>
> >>>>>>>>>> _rels Folder
> >>>>>>>>>> docProps Folder
> >>>>>>>>>> xl Folder
> >>>>>>>>>> [Content_Types].xml
> >>>>>>>>>
> >>>>>>>>> What's in this file?
> >>>>>>>>>
> >>>>>>>>>> Inside the xl folder I found the following files:
> >>>>>>>>>>
> >>>>>>>>>> _rels Folder
> >>>>>>>>>> printerSettings Folder
> >>>>>>>>>> theme folder
> >>>>>>>>>> worksheets folder
> >>>>>>>>>> sharedStrings.xml
> >>>>>>>>>> styles.xml
> >>>>>>>>>> workbook.xml
> >>>>>>>>>>
> >>>>>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
> >>>>>>>>>>
> >>>>>>>>>> I'll post my code (where it breaks) and see if there's something
> >>> with
> >>>>>>> the
> >>>>>>>>>> code (although that wouldn't make sense, since it works
> perfectly
> >>>>> fine
> >>>>>>> in
> >>>>>>>>>> this machine -- with both .xls and .xlsx files).
> >>>>>>>>>
> >>>>>>>>> What versions of Java are you running where it works?
> >>>>>>>>>
> >>>>>>>>> What version of Tomcat does your server use? Where are the POI
> jars
> >>> in
> >>>>>>> your
> >>>>>>>>> Tomcat installation?
> >>>>>>>>>
> >>>>>>>>> Regards,
> >>>>>>>>> Dave
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> public void loadFile(File oFileToLoad) throws
> >>> FileNotFoundException,
> >>>>>>>>>> LoaderException, ValidationException {
> >>>>>>>>>>    Workbook oWorkgroup;
> >>>>>>>>>>
> >>>>>>>>>>    m_oFileName = oFileToLoad;
> >>>>>>>>>>    try {
> >>>>>>>>>>     //LOG.Log("ExcelFile - Loading file name: " +
> >>>>>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >>>>>>>>>>     m_oIn = new FileInputStream(m_oFileName);
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>        oWorkgroup = WorkbookFactory.create(m_oIn);
> >>>>>>>>>>
> >>>>>>>>>>      if (oWorkgroup.getNumberOfSheets() == 0) {
> >>>>>>>>>>          // page not found throw exception
> >>>>>>>>>>          throw new LoaderException("Excel document does not
> >>> contain
> >>>>>>> a
> >>>>>>>>>> workbook");
> >>>>>>>>>>      }
> >>>>>>>>>>
> >>>>>>>>>>      m_oSheet = oWorkgroup.getSheetAt(0);
> >>>>>>>>>>
> >>>>>>>>>>      m_nTotalRows = getTotalRows();
> >>>>>>>>>>
> >>>>>>>>>>     //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> >>>>>>>>>> LOG.LOG_TYPE_TRACE);
> >>>>>>>>>>    } catch(OldExcelFormatException e){
> >>>>>>>>>>     throw new ValidationException("This is an Excel 95 File, we
> >>> can
> >>>>>>>>>> process only Excel 97-2007. ",
> >>>>>>>>>>     1, ValidationException.EXCEL_95_ERROR);
> >>>>>>>>>>
> >>>>>>>>>>    }catch (IOException ioe) {
> >>>>>>>>>>     //LOG.LogErrors(ioe);
> >>>>>>>>>>     ioe.printStackTrace();
> >>>>>>>>>>     throw new LoaderException("Exception reading the excel
> >>>>>>>>> document");
> >>>>>>>>>>
> >>>>>>>>>>    } catch (InvalidFormatException e) {
> >>>>>>>>>>     // Catch created for Workbook.create method. Unspecified.
> >>>>>>>>>>
> >>>>>>>>>> e.printStackTrace();
> >>>>>>>>>> }
> >>>>>>>>>> }
> >>>>>>>>>>
> >>>>>>>>>> Any thoughts?
> >>>>>>>>>>
> >>>>>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
> >>>>> dfisher@jmlafferty.com
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Was this file created with Excel or another application like
> >>>>>>> OpenOffice?
> >>>>>>>>>>> What version of that application?
> >>>>>>>>>>>
> >>>>>>>>>>> Try unzipping the xlsx file and reporting the structure. These
> >>> OOXML
> >>>>>>>>> files
> >>>>>>>>>>> are really zipped up directories of xml files. I suspect that
> >>> there
> >>>>> is
> >>>>>>>>>>> something in your content type that POI does not understand.
> >>>>>>>>>>>
> >>>>>>>>>>> Is this a file that you can share? If so, then I would suggest
> >>> that
> >>>>>>> you
> >>>>>>>>>>> create a bugzilla entry so that a developer can take a look
> when
> >>>>> they
> >>>>>>>>> have
> >>>>>>>>>>> time.
> >>>>>>>>>>>
> >>>>>>>>>>> Regards,
> >>>>>>>>>>> Dave
> >>>>>>>>>>>
> >>>>>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> I've verified and the file is functional. I'm really clueless,
> >>> atm.
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <
> markbrdsly@tiscali.co.uk>
> >>>>>>> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Is it possible that the structure of the file is being
> mangled
> >>>>>>>>> somehow?
> >>>>>>>>>>>>> Have
> >>>>>>>>>>>>> you tried to open the file using Excel after it has been
> ftp'd
> >>>>> into
> >>>>>>>>> the
> >>>>>>>>>>>>> folder on your server?
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Yours
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Mark B
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Jorge Moya wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
> >>>>> extract
> >>>>>>>>> the
> >>>>>>>>>>>>>> info
> >>>>>>>>>>>>>> from the file.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Thanks in advance.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <
> jomoya@gmail.com
> >>>>
> >>>>>>>>> wrote:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through
> an
> >>>>> FTP
> >>>>>>>>>>>>> server,
> >>>>>>>>>>>>>>> and after upload I execute the validation of my app which
> >>>>> proceed
> >>>>>>> to
> >>>>>>>>>>>>>>> extract
> >>>>>>>>>>>>>>> the information from a designated folder, but it breaks
> when
> >>> it
> >>>>>>>>> tries
> >>>>>>>>>>> to
> >>>>>>>>>>>>>>> upload the file with mentioned errors.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>>>>>>>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> You should write the uploaded file to your temporary file
> >>> and
> >>>>>>> then
> >>>>>>>>>>> read
> >>>>>>>>>>>>>>>> it
> >>>>>>>>>>>>>>>> in.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> OOXML files are zip files and are not accessed
> non-serailly.
> >>>>> The
> >>>>>>>>> user
> >>>>>>>>>>>>>>>> might stop transfer or the network connection might break.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Regards,
> >>>>>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an
> .xlsx
> >>>>>>>>> document
> >>>>>>>>>>>>>>>> using
> >>>>>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made),
> however
> >>>>> when
> >>>>>>> I
> >>>>>>>>>>>>>>>> tried
> >>>>>>>>>>>>>>>> to
> >>>>>>>>>>>>>>>>> upload the file to the server, it returned me these
> errors
> >>> on
> >>>>>>> the
> >>>>>>>>>>>>>>>> server's
> >>>>>>>>>>>>>>>>> tomcat console:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
> >>>>>>> Can't
> >>>>>>>>>>>>> read
> >>>>>>>>>>>>>>>>> content t
> >>>>>>>>>>>>>>>>> ypes part !
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>>>>>>>>>>> ntTypeManager.java:107)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>>>>>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>>>>>>>>>>> 136)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>
> >>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>>>>>>>>>>> va:63)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>
> >>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>>>>>>>>>>  at
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>>>>>>>>>>> a:154)
> >>>>>>>>>>>>>>>>>  at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
> >>> fine.
> >>>>>>>>>>>>>>>> Extracting
> >>>>>>>>>>>>>>>>> info on my local machine works fine, as well.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>
> >>> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> --
> >>>>>>>>>>>>> View this message in context:
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>
> >>>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>>>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>> ---------------------------------------------------------------------
> >>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>
> >>>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>> For additional commands, e-mail: user-help@poi.apache.org
> >>>
> >>>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
You are welcome. I was working on a reply last Friday when work took me elsewhere.

You got to the correct place. Here is a clue in the release notes for Tomcat:

> To override the XML parser implementation or interfaces, use the endorsed
> mechanism of the JVM. The default configuration defines JARs located in 
> "common/endorsed" as endorsed.

You might be able to get help locating which of the many jars is changing the parser from the tomcat user list.

http://tomcat.apache.org/

Regards,
Dave


On Jun 15, 2010, at 8:19 AM, Jorge Moya wrote:

> I just wanted to say that I've figured this is, effectively like you said,
> an issue with the libraries and the current configuration of Tomcat on the
> server environment. Coincidentally, I finally tried Tomcat in my local
> environment and it functions the way it should on the particular situation.
> Guess it's just a matter of time and patience on figuring out which
> webservice (and it's libraries) are conflicting with the xml ones.
> 
> Thanks for the assistance.
> 
> On Fri, Jun 11, 2010 at 1:55 PM, Jorge Moya <jo...@gmail.com> wrote:
> 
>> I did restart the Tomcat.
>> 
>> Java version is 1.5.0_18-b02
>> Windows version is Windows Server 2003 SP2
>> 
>> Libraries:
>> *http://bit.ly/casaPs*
>> Shared only has cewcanative.jar
>> 
>> Tomcast effectively has access to the directory (why can it successfully
>> extract .xls files?).
>> 
>> My local environment has less .jars than on the server, it's windows xp,
>> and I'm testing the app using an ant build. (or by running a simple java
>> .class)
>> 
>> Hope this helps. I really appreciate all the help I've received so far.
>> 
>> Thanks in advance.
>> 
>> On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <df...@jmlafferty.com>wrote:
>> 
>>> When you removed the jars, did you restart Tomcat?
>>> 
>>> What version of Java is running on your Windows server and what version of
>>> Windows?
>>> 
>>> Can you list all of the jars in tomcat/common/lib and tomcat/shared/lib?
>>> 
>>> Does your Tomcat server have proper access rights to the temporary
>>> directory? Could there be a locking issue?
>>> 
>>> How is your local environment different from your server?
>>> 
>>> THere ought to be someone at your job who understands your Tomcat server.
>>> Is there an internal resource? As you see I suspect that your problem is
>>> really a Tomcat configuration issue. There is a very active Tomcat User list
>>> - http://tomcat.apache.org/lists.html#tomcat-users
>>> 
>>> Regards,
>>> Dave
>>> 
>>> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
>>> 
>>>> I've tried removing the extra .jars and it still won't work. I just
>>> don't
>>>> get it.
>>>> 
>>>> On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <dfisher@jmlafferty.com
>>>> wrote:
>>>> 
>>>>> Glad to help.
>>>>> 
>>>>>> Closest-named classes I could find under common\lib are:
>>>>>> 
>>>>>> xbean-2.2.0.jar
>>>>>> stax-api-1.0.1.jar
>>>>>> axis2-xmlbeans-1.3.jar
>>>>> 
>>>>> Those are not normal to a standard Tomcat 5.5. These are probably
>>>>> conflicting in some strange way (the tomcat classloader is strange and
>>> is
>>>>> simplified in Tomcat 6.) They were probably added because they are
>>> required
>>>>> by some other webapps on the server.
>>>>> 
>>>>> Can you take these out temporarily and restart your tomcat server?
>>>>> 
>>>>> Or does someone else own that asset? If so they will need to help you.
>>>>> 
>>>>> They might work better in shared\lib but that is really a guess and the
>>>>> issue may be with the other non-POI apps on that server.
>>>>> 
>>>>> Regards,
>>>>> Dave
>>>>> 
>>>>> 
>>>>>> 
>>>>>> Tomcat version: 5.5.20
>>>>>> 
>>>>>> Tomcat is not initialized with -Djava.awt.headless=true
>>>>>> 
>>>>>> Sorry to keep you guys on the same issue.. it's just that I'm new with
>>>>> POI
>>>>>> and tomcat (intern), and I'm trying to update the webapp.
>>>>>> 
>>>>>> Thanks in advance.
>>>>>> 
>>>>>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <dfisher@jmlafferty.com
>>>>>> wrote:
>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> Here a few things that I would check.
>>>>>>> 
>>>>>>> 
>>>>>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
>>>>>>>> 
>>>>>>>> Including:
>>>>>>>> poi-3.6
>>>>>>>> poi-contrib-3.6
>>>>>>>> poi-ooxml-3.6
>>>>>>>> poi-scratchpad 3.6
>>>>>>>> ooxml-schemas-1.0
>>>>>>>> xmlbeans-2.3.0
>>>>>>>> dom4j-1.6.1
>>>>>>>> geronimo-stax
>>>>>>> 
>>>>>>> (I just saw you conversation with Nick in the earlier thread.)
>>>>>>> 
>>>>>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
>>>>> other
>>>>>>> versions of any of these Jars?
>>>>>>> 
>>>>>>>> Java version: 1.5
>>>>>>>> Tomcat: 5.5
>>>>>>> 
>>>>>>> Which Tomcat 5.5? The current version is 5.5.29.
>>>>>>> 
>>>>>>> Is your Tomcat started with -Djava.awt.headless=true?
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Dave
>>>>>>> 
>>>>>>> 
>>>>>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
>>> dfisher@jmlafferty.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>>> Yes, this file was created using Excel 2007. The file was
>>> originally
>>>>> an
>>>>>>>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading
>>>>> both
>>>>>>>>> new
>>>>>>>>>> and modified .xls files and it won't budge).
>>>>>>>>>> 
>>>>>>>>>> Per request, I unzipped the .xlsx files and the reported structure
>>> is
>>>>>>>>> this:
>>>>>>>>>> 
>>>>>>>>>> _rels Folder
>>>>>>>>>> docProps Folder
>>>>>>>>>> xl Folder
>>>>>>>>>> [Content_Types].xml
>>>>>>>>> 
>>>>>>>>> What's in this file?
>>>>>>>>> 
>>>>>>>>>> Inside the xl folder I found the following files:
>>>>>>>>>> 
>>>>>>>>>> _rels Folder
>>>>>>>>>> printerSettings Folder
>>>>>>>>>> theme folder
>>>>>>>>>> worksheets folder
>>>>>>>>>> sharedStrings.xml
>>>>>>>>>> styles.xml
>>>>>>>>>> workbook.xml
>>>>>>>>>> 
>>>>>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
>>>>>>>>>> 
>>>>>>>>>> I'll post my code (where it breaks) and see if there's something
>>> with
>>>>>>> the
>>>>>>>>>> code (although that wouldn't make sense, since it works perfectly
>>>>> fine
>>>>>>> in
>>>>>>>>>> this machine -- with both .xls and .xlsx files).
>>>>>>>>> 
>>>>>>>>> What versions of Java are you running where it works?
>>>>>>>>> 
>>>>>>>>> What version of Tomcat does your server use? Where are the POI jars
>>> in
>>>>>>> your
>>>>>>>>> Tomcat installation?
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Dave
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> public void loadFile(File oFileToLoad) throws
>>> FileNotFoundException,
>>>>>>>>>> LoaderException, ValidationException {
>>>>>>>>>>    Workbook oWorkgroup;
>>>>>>>>>> 
>>>>>>>>>>    m_oFileName = oFileToLoad;
>>>>>>>>>>    try {
>>>>>>>>>>     //LOG.Log("ExcelFile - Loading file name: " +
>>>>>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>>>>>>>>>>     m_oIn = new FileInputStream(m_oFileName);
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>        oWorkgroup = WorkbookFactory.create(m_oIn);
>>>>>>>>>> 
>>>>>>>>>>      if (oWorkgroup.getNumberOfSheets() == 0) {
>>>>>>>>>>          // page not found throw exception
>>>>>>>>>>          throw new LoaderException("Excel document does not
>>> contain
>>>>>>> a
>>>>>>>>>> workbook");
>>>>>>>>>>      }
>>>>>>>>>> 
>>>>>>>>>>      m_oSheet = oWorkgroup.getSheetAt(0);
>>>>>>>>>> 
>>>>>>>>>>      m_nTotalRows = getTotalRows();
>>>>>>>>>> 
>>>>>>>>>>     //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>>>>>>>>>> LOG.LOG_TYPE_TRACE);
>>>>>>>>>>    } catch(OldExcelFormatException e){
>>>>>>>>>>     throw new ValidationException("This is an Excel 95 File, we
>>> can
>>>>>>>>>> process only Excel 97-2007. ",
>>>>>>>>>>     1, ValidationException.EXCEL_95_ERROR);
>>>>>>>>>> 
>>>>>>>>>>    }catch (IOException ioe) {
>>>>>>>>>>     //LOG.LogErrors(ioe);
>>>>>>>>>>     ioe.printStackTrace();
>>>>>>>>>>     throw new LoaderException("Exception reading the excel
>>>>>>>>> document");
>>>>>>>>>> 
>>>>>>>>>>    } catch (InvalidFormatException e) {
>>>>>>>>>>     // Catch created for Workbook.create method. Unspecified.
>>>>>>>>>> 
>>>>>>>>>> e.printStackTrace();
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> Any thoughts?
>>>>>>>>>> 
>>>>>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
>>>>> dfisher@jmlafferty.com
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Was this file created with Excel or another application like
>>>>>>> OpenOffice?
>>>>>>>>>>> What version of that application?
>>>>>>>>>>> 
>>>>>>>>>>> Try unzipping the xlsx file and reporting the structure. These
>>> OOXML
>>>>>>>>> files
>>>>>>>>>>> are really zipped up directories of xml files. I suspect that
>>> there
>>>>> is
>>>>>>>>>>> something in your content type that POI does not understand.
>>>>>>>>>>> 
>>>>>>>>>>> Is this a file that you can share? If so, then I would suggest
>>> that
>>>>>>> you
>>>>>>>>>>> create a bugzilla entry so that a developer can take a look when
>>>>> they
>>>>>>>>> have
>>>>>>>>>>> time.
>>>>>>>>>>> 
>>>>>>>>>>> Regards,
>>>>>>>>>>> Dave
>>>>>>>>>>> 
>>>>>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> I've verified and the file is functional. I'm really clueless,
>>> atm.
>>>>>>>>>>>> 
>>>>>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Is it possible that the structure of the file is being mangled
>>>>>>>>> somehow?
>>>>>>>>>>>>> Have
>>>>>>>>>>>>> you tried to open the file using Excel after it has been ftp'd
>>>>> into
>>>>>>>>> the
>>>>>>>>>>>>> folder on your server?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Yours
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Mark B
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Jorge Moya wrote:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
>>>>> extract
>>>>>>>>> the
>>>>>>>>>>>>>> info
>>>>>>>>>>>>>> from the file.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks in advance.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jomoya@gmail.com
>>>> 
>>>>>>>>> wrote:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through an
>>>>> FTP
>>>>>>>>>>>>> server,
>>>>>>>>>>>>>>> and after upload I execute the validation of my app which
>>>>> proceed
>>>>>>> to
>>>>>>>>>>>>>>> extract
>>>>>>>>>>>>>>> the information from a designated folder, but it breaks when
>>> it
>>>>>>>>> tries
>>>>>>>>>>> to
>>>>>>>>>>>>>>> upload the file with mentioned errors.
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>>>>>>>>>>> <df...@jmlafferty.com>wrote:
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> You should write the uploaded file to your temporary file
>>> and
>>>>>>> then
>>>>>>>>>>> read
>>>>>>>>>>>>>>>> it
>>>>>>>>>>>>>>>> in.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly.
>>>>> The
>>>>>>>>> user
>>>>>>>>>>>>>>>> might stop transfer or the network connection might break.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>>> Dave
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
>>>>>>>>> document
>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however
>>>>> when
>>>>>>> I
>>>>>>>>>>>>>>>> tried
>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>> upload the file to the server, it returned me these errors
>>> on
>>>>>>> the
>>>>>>>>>>>>>>>> server's
>>>>>>>>>>>>>>>>> tomcat console:
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
>>>>>>> Can't
>>>>>>>>>>>>> read
>>>>>>>>>>>>>>>>> content t
>>>>>>>>>>>>>>>>> ypes part !
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>>>>>>>>>>> ntTypeManager.java:107)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>>>>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>>>>>>>>>>> 136)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>> 
>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>>>>>>>>>>> va:63)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>> 
>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>>>>>>>>>>> a:154)
>>>>>>>>>>>>>>>>>  at java.lang.Thread.run(Thread.java:595)
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
>>> fine.
>>>>>>>>>>>>>>>> Extracting
>>>>>>>>>>>>>>>>> info on my local machine works fine, as well.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> --
>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>> 
>>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>>>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>> 
>>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>> 
>>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
I just wanted to say that I've figured this is, effectively like you said,
an issue with the libraries and the current configuration of Tomcat on the
server environment. Coincidentally, I finally tried Tomcat in my local
environment and it functions the way it should on the particular situation.
Guess it's just a matter of time and patience on figuring out which
webservice (and it's libraries) are conflicting with the xml ones.

Thanks for the assistance.

On Fri, Jun 11, 2010 at 1:55 PM, Jorge Moya <jo...@gmail.com> wrote:

> I did restart the Tomcat.
>
> Java version is 1.5.0_18-b02
> Windows version is Windows Server 2003 SP2
>
> Libraries:
> *http://bit.ly/casaPs*
> Shared only has cewcanative.jar
>
> Tomcast effectively has access to the directory (why can it successfully
> extract .xls files?).
>
> My local environment has less .jars than on the server, it's windows xp,
> and I'm testing the app using an ant build. (or by running a simple java
> .class)
>
> Hope this helps. I really appreciate all the help I've received so far.
>
> Thanks in advance.
>
> On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <df...@jmlafferty.com>wrote:
>
>> When you removed the jars, did you restart Tomcat?
>>
>> What version of Java is running on your Windows server and what version of
>> Windows?
>>
>> Can you list all of the jars in tomcat/common/lib and tomcat/shared/lib?
>>
>> Does your Tomcat server have proper access rights to the temporary
>> directory? Could there be a locking issue?
>>
>> How is your local environment different from your server?
>>
>> THere ought to be someone at your job who understands your Tomcat server.
>> Is there an internal resource? As you see I suspect that your problem is
>> really a Tomcat configuration issue. There is a very active Tomcat User list
>> - http://tomcat.apache.org/lists.html#tomcat-users
>>
>> Regards,
>> Dave
>>
>> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
>>
>> > I've tried removing the extra .jars and it still won't work. I just
>> don't
>> > get it.
>> >
>> > On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <dfisher@jmlafferty.com
>> >wrote:
>> >
>> >> Glad to help.
>> >>
>> >>> Closest-named classes I could find under common\lib are:
>> >>>
>> >>> xbean-2.2.0.jar
>> >>> stax-api-1.0.1.jar
>> >>> axis2-xmlbeans-1.3.jar
>> >>
>> >> Those are not normal to a standard Tomcat 5.5. These are probably
>> >> conflicting in some strange way (the tomcat classloader is strange and
>> is
>> >> simplified in Tomcat 6.) They were probably added because they are
>> required
>> >> by some other webapps on the server.
>> >>
>> >> Can you take these out temporarily and restart your tomcat server?
>> >>
>> >> Or does someone else own that asset? If so they will need to help you.
>> >>
>> >> They might work better in shared\lib but that is really a guess and the
>> >> issue may be with the other non-POI apps on that server.
>> >>
>> >> Regards,
>> >> Dave
>> >>
>> >>
>> >>>
>> >>> Tomcat version: 5.5.20
>> >>>
>> >>> Tomcat is not initialized with -Djava.awt.headless=true
>> >>>
>> >>> Sorry to keep you guys on the same issue.. it's just that I'm new with
>> >> POI
>> >>> and tomcat (intern), and I'm trying to update the webapp.
>> >>>
>> >>> Thanks in advance.
>> >>>
>> >>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <dfisher@jmlafferty.com
>> >>> wrote:
>> >>>
>> >>>> Hi,
>> >>>>
>> >>>> Here a few things that I would check.
>> >>>>
>> >>>>
>> >>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
>> >>>>>
>> >>>>> Including:
>> >>>>> poi-3.6
>> >>>>> poi-contrib-3.6
>> >>>>> poi-ooxml-3.6
>> >>>>> poi-scratchpad 3.6
>> >>>>> ooxml-schemas-1.0
>> >>>>> xmlbeans-2.3.0
>> >>>>> dom4j-1.6.1
>> >>>>> geronimo-stax
>> >>>>
>> >>>> (I just saw you conversation with Nick in the earlier thread.)
>> >>>>
>> >>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
>> >> other
>> >>>> versions of any of these Jars?
>> >>>>
>> >>>>> Java version: 1.5
>> >>>>> Tomcat: 5.5
>> >>>>
>> >>>> Which Tomcat 5.5? The current version is 5.5.29.
>> >>>>
>> >>>> Is your Tomcat started with -Djava.awt.headless=true?
>> >>>>
>> >>>> Regards,
>> >>>> Dave
>> >>>>
>> >>>>
>> >>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
>> dfisher@jmlafferty.com
>> >>>>> wrote:
>> >>>>>
>> >>>>>>> Yes, this file was created using Excel 2007. The file was
>> originally
>> >> an
>> >>>>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading
>> >> both
>> >>>>>> new
>> >>>>>>> and modified .xls files and it won't budge).
>> >>>>>>>
>> >>>>>>> Per request, I unzipped the .xlsx files and the reported structure
>> is
>> >>>>>> this:
>> >>>>>>>
>> >>>>>>> _rels Folder
>> >>>>>>> docProps Folder
>> >>>>>>> xl Folder
>> >>>>>>> [Content_Types].xml
>> >>>>>>
>> >>>>>> What's in this file?
>> >>>>>>
>> >>>>>>> Inside the xl folder I found the following files:
>> >>>>>>>
>> >>>>>>> _rels Folder
>> >>>>>>> printerSettings Folder
>> >>>>>>> theme folder
>> >>>>>>> worksheets folder
>> >>>>>>> sharedStrings.xml
>> >>>>>>> styles.xml
>> >>>>>>> workbook.xml
>> >>>>>>>
>> >>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
>> >>>>>>>
>> >>>>>>> I'll post my code (where it breaks) and see if there's something
>> with
>> >>>> the
>> >>>>>>> code (although that wouldn't make sense, since it works perfectly
>> >> fine
>> >>>> in
>> >>>>>>> this machine -- with both .xls and .xlsx files).
>> >>>>>>
>> >>>>>> What versions of Java are you running where it works?
>> >>>>>>
>> >>>>>> What version of Tomcat does your server use? Where are the POI jars
>> in
>> >>>> your
>> >>>>>> Tomcat installation?
>> >>>>>>
>> >>>>>> Regards,
>> >>>>>> Dave
>> >>>>>>
>> >>>>>>
>> >>>>>>>
>> >>>>>>> public void loadFile(File oFileToLoad) throws
>> FileNotFoundException,
>> >>>>>>> LoaderException, ValidationException {
>> >>>>>>>     Workbook oWorkgroup;
>> >>>>>>>
>> >>>>>>>     m_oFileName = oFileToLoad;
>> >>>>>>>     try {
>> >>>>>>>      //LOG.Log("ExcelFile - Loading file name: " +
>> >>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>> >>>>>>>      m_oIn = new FileInputStream(m_oFileName);
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>         oWorkgroup = WorkbookFactory.create(m_oIn);
>> >>>>>>>
>> >>>>>>>       if (oWorkgroup.getNumberOfSheets() == 0) {
>> >>>>>>>           // page not found throw exception
>> >>>>>>>           throw new LoaderException("Excel document does not
>> contain
>> >>>> a
>> >>>>>>> workbook");
>> >>>>>>>       }
>> >>>>>>>
>> >>>>>>>       m_oSheet = oWorkgroup.getSheetAt(0);
>> >>>>>>>
>> >>>>>>>       m_nTotalRows = getTotalRows();
>> >>>>>>>
>> >>>>>>>      //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>> >>>>>>> LOG.LOG_TYPE_TRACE);
>> >>>>>>>     } catch(OldExcelFormatException e){
>> >>>>>>>      throw new ValidationException("This is an Excel 95 File, we
>> can
>> >>>>>>> process only Excel 97-2007. ",
>> >>>>>>>      1, ValidationException.EXCEL_95_ERROR);
>> >>>>>>>
>> >>>>>>>     }catch (IOException ioe) {
>> >>>>>>>      //LOG.LogErrors(ioe);
>> >>>>>>>      ioe.printStackTrace();
>> >>>>>>>      throw new LoaderException("Exception reading the excel
>> >>>>>> document");
>> >>>>>>>
>> >>>>>>>     } catch (InvalidFormatException e) {
>> >>>>>>>      // Catch created for Workbook.create method. Unspecified.
>> >>>>>>>
>> >>>>>>> e.printStackTrace();
>> >>>>>>> }
>> >>>>>>> }
>> >>>>>>>
>> >>>>>>> Any thoughts?
>> >>>>>>>
>> >>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
>> >> dfisher@jmlafferty.com
>> >>>>>>> wrote:
>> >>>>>>>
>> >>>>>>>> Was this file created with Excel or another application like
>> >>>> OpenOffice?
>> >>>>>>>> What version of that application?
>> >>>>>>>>
>> >>>>>>>> Try unzipping the xlsx file and reporting the structure. These
>> OOXML
>> >>>>>> files
>> >>>>>>>> are really zipped up directories of xml files. I suspect that
>> there
>> >> is
>> >>>>>>>> something in your content type that POI does not understand.
>> >>>>>>>>
>> >>>>>>>> Is this a file that you can share? If so, then I would suggest
>> that
>> >>>> you
>> >>>>>>>> create a bugzilla entry so that a developer can take a look when
>> >> they
>> >>>>>> have
>> >>>>>>>> time.
>> >>>>>>>>
>> >>>>>>>> Regards,
>> >>>>>>>> Dave
>> >>>>>>>>
>> >>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>> >>>>>>>>
>> >>>>>>>>> I've verified and the file is functional. I'm really clueless,
>> atm.
>> >>>>>>>>>
>> >>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
>> >>>> wrote:
>> >>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> Is it possible that the structure of the file is being mangled
>> >>>>>> somehow?
>> >>>>>>>>>> Have
>> >>>>>>>>>> you tried to open the file using Excel after it has been ftp'd
>> >> into
>> >>>>>> the
>> >>>>>>>>>> folder on your server?
>> >>>>>>>>>>
>> >>>>>>>>>> Yours
>> >>>>>>>>>>
>> >>>>>>>>>> Mark B
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> Jorge Moya wrote:
>> >>>>>>>>>>>
>> >>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
>> >> extract
>> >>>>>> the
>> >>>>>>>>>>> info
>> >>>>>>>>>>> from the file.
>> >>>>>>>>>>>
>> >>>>>>>>>>> Thanks in advance.
>> >>>>>>>>>>>
>> >>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jomoya@gmail.com
>> >
>> >>>>>> wrote:
>> >>>>>>>>>>>
>> >>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through an
>> >> FTP
>> >>>>>>>>>> server,
>> >>>>>>>>>>>> and after upload I execute the validation of my app which
>> >> proceed
>> >>>> to
>> >>>>>>>>>>>> extract
>> >>>>>>>>>>>> the information from a designated folder, but it breaks when
>> it
>> >>>>>> tries
>> >>>>>>>> to
>> >>>>>>>>>>>> upload the file with mentioned errors.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>> >>>>>>>>>>>> <df...@jmlafferty.com>wrote:
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>> Hi,
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> You should write the uploaded file to your temporary file
>> and
>> >>>> then
>> >>>>>>>> read
>> >>>>>>>>>>>>> it
>> >>>>>>>>>>>>> in.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly.
>> >> The
>> >>>>>> user
>> >>>>>>>>>>>>> might stop transfer or the network connection might break.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Regards,
>> >>>>>>>>>>>>> Dave
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
>> >>>>>> document
>> >>>>>>>>>>>>> using
>> >>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however
>> >> when
>> >>>> I
>> >>>>>>>>>>>>> tried
>> >>>>>>>>>>>>> to
>> >>>>>>>>>>>>>> upload the file to the server, it returned me these errors
>> on
>> >>>> the
>> >>>>>>>>>>>>> server's
>> >>>>>>>>>>>>>> tomcat console:
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
>> >>>> Can't
>> >>>>>>>>>> read
>> >>>>>>>>>>>>>> content t
>> >>>>>>>>>>>>>> ypes part !
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>> >>>>>>>>>>>>>> ntTypeManager.java:107)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>> >>>>>>>>>>>>>> pContentTypeManager.java:56)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>> >>>>>>>>>>>>>> 136)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>
>> >> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>> >>>>>>>>>>>>>> va:63)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>
>> >> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>> >>>>>>>>>>>>>>   at
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>> >>>>>>>>>>>>>> a:154)
>> >>>>>>>>>>>>>>   at java.lang.Thread.run(Thread.java:595)
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
>> fine.
>> >>>>>>>>>>>>> Extracting
>> >>>>>>>>>>>>>> info on my local machine works fine, as well.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> --
>> >>>>>>>>>> View this message in context:
>> >>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>> >>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>> ---------------------------------------------------------------------
>> >>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >> ---------------------------------------------------------------------
>> >>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>>>>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>
>> >>>>
>> >>>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >>>> For additional commands, e-mail: user-help@poi.apache.org
>> >>>>
>> >>>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> >> For additional commands, e-mail: user-help@poi.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>

Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
I did restart the Tomcat.

Java version is 1.5.0_18-b02
Windows version is Windows Server 2003 SP2

Libraries:
*http://bit.ly/casaPs*
Shared only has cewcanative.jar

Tomcast effectively has access to the directory (why can it successfully
extract .xls files?).

My local environment has less .jars than on the server, it's windows xp, and
I'm testing the app using an ant build. (or by running a simple java .class)

Hope this helps. I really appreciate all the help I've received so far.

Thanks in advance.

On Fri, Jun 11, 2010 at 12:21 PM, David Fisher <df...@jmlafferty.com>wrote:

> When you removed the jars, did you restart Tomcat?
>
> What version of Java is running on your Windows server and what version of
> Windows?
>
> Can you list all of the jars in tomcat/common/lib and tomcat/shared/lib?
>
> Does your Tomcat server have proper access rights to the temporary
> directory? Could there be a locking issue?
>
> How is your local environment different from your server?
>
> THere ought to be someone at your job who understands your Tomcat server.
> Is there an internal resource? As you see I suspect that your problem is
> really a Tomcat configuration issue. There is a very active Tomcat User list
> - http://tomcat.apache.org/lists.html#tomcat-users
>
> Regards,
> Dave
>
> On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:
>
> > I've tried removing the extra .jars and it still won't work. I just don't
> > get it.
> >
> > On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >
> >> Glad to help.
> >>
> >>> Closest-named classes I could find under common\lib are:
> >>>
> >>> xbean-2.2.0.jar
> >>> stax-api-1.0.1.jar
> >>> axis2-xmlbeans-1.3.jar
> >>
> >> Those are not normal to a standard Tomcat 5.5. These are probably
> >> conflicting in some strange way (the tomcat classloader is strange and
> is
> >> simplified in Tomcat 6.) They were probably added because they are
> required
> >> by some other webapps on the server.
> >>
> >> Can you take these out temporarily and restart your tomcat server?
> >>
> >> Or does someone else own that asset? If so they will need to help you.
> >>
> >> They might work better in shared\lib but that is really a guess and the
> >> issue may be with the other non-POI apps on that server.
> >>
> >> Regards,
> >> Dave
> >>
> >>
> >>>
> >>> Tomcat version: 5.5.20
> >>>
> >>> Tomcat is not initialized with -Djava.awt.headless=true
> >>>
> >>> Sorry to keep you guys on the same issue.. it's just that I'm new with
> >> POI
> >>> and tomcat (intern), and I'm trying to update the webapp.
> >>>
> >>> Thanks in advance.
> >>>
> >>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <dfisher@jmlafferty.com
> >>> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> Here a few things that I would check.
> >>>>
> >>>>
> >>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> >>>>>
> >>>>> Including:
> >>>>> poi-3.6
> >>>>> poi-contrib-3.6
> >>>>> poi-ooxml-3.6
> >>>>> poi-scratchpad 3.6
> >>>>> ooxml-schemas-1.0
> >>>>> xmlbeans-2.3.0
> >>>>> dom4j-1.6.1
> >>>>> geronimo-stax
> >>>>
> >>>> (I just saw you conversation with Nick in the earlier thread.)
> >>>>
> >>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
> >> other
> >>>> versions of any of these Jars?
> >>>>
> >>>>> Java version: 1.5
> >>>>> Tomcat: 5.5
> >>>>
> >>>> Which Tomcat 5.5? The current version is 5.5.29.
> >>>>
> >>>> Is your Tomcat started with -Djava.awt.headless=true?
> >>>>
> >>>> Regards,
> >>>> Dave
> >>>>
> >>>>
> >>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <
> dfisher@jmlafferty.com
> >>>>> wrote:
> >>>>>
> >>>>>>> Yes, this file was created using Excel 2007. The file was
> originally
> >> an
> >>>>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading
> >> both
> >>>>>> new
> >>>>>>> and modified .xls files and it won't budge).
> >>>>>>>
> >>>>>>> Per request, I unzipped the .xlsx files and the reported structure
> is
> >>>>>> this:
> >>>>>>>
> >>>>>>> _rels Folder
> >>>>>>> docProps Folder
> >>>>>>> xl Folder
> >>>>>>> [Content_Types].xml
> >>>>>>
> >>>>>> What's in this file?
> >>>>>>
> >>>>>>> Inside the xl folder I found the following files:
> >>>>>>>
> >>>>>>> _rels Folder
> >>>>>>> printerSettings Folder
> >>>>>>> theme folder
> >>>>>>> worksheets folder
> >>>>>>> sharedStrings.xml
> >>>>>>> styles.xml
> >>>>>>> workbook.xml
> >>>>>>>
> >>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
> >>>>>>>
> >>>>>>> I'll post my code (where it breaks) and see if there's something
> with
> >>>> the
> >>>>>>> code (although that wouldn't make sense, since it works perfectly
> >> fine
> >>>> in
> >>>>>>> this machine -- with both .xls and .xlsx files).
> >>>>>>
> >>>>>> What versions of Java are you running where it works?
> >>>>>>
> >>>>>> What version of Tomcat does your server use? Where are the POI jars
> in
> >>>> your
> >>>>>> Tomcat installation?
> >>>>>>
> >>>>>> Regards,
> >>>>>> Dave
> >>>>>>
> >>>>>>
> >>>>>>>
> >>>>>>> public void loadFile(File oFileToLoad) throws
> FileNotFoundException,
> >>>>>>> LoaderException, ValidationException {
> >>>>>>>     Workbook oWorkgroup;
> >>>>>>>
> >>>>>>>     m_oFileName = oFileToLoad;
> >>>>>>>     try {
> >>>>>>>      //LOG.Log("ExcelFile - Loading file name: " +
> >>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >>>>>>>      m_oIn = new FileInputStream(m_oFileName);
> >>>>>>>
> >>>>>>>
> >>>>>>>         oWorkgroup = WorkbookFactory.create(m_oIn);
> >>>>>>>
> >>>>>>>       if (oWorkgroup.getNumberOfSheets() == 0) {
> >>>>>>>           // page not found throw exception
> >>>>>>>           throw new LoaderException("Excel document does not
> contain
> >>>> a
> >>>>>>> workbook");
> >>>>>>>       }
> >>>>>>>
> >>>>>>>       m_oSheet = oWorkgroup.getSheetAt(0);
> >>>>>>>
> >>>>>>>       m_nTotalRows = getTotalRows();
> >>>>>>>
> >>>>>>>      //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> >>>>>>> LOG.LOG_TYPE_TRACE);
> >>>>>>>     } catch(OldExcelFormatException e){
> >>>>>>>      throw new ValidationException("This is an Excel 95 File, we
> can
> >>>>>>> process only Excel 97-2007. ",
> >>>>>>>      1, ValidationException.EXCEL_95_ERROR);
> >>>>>>>
> >>>>>>>     }catch (IOException ioe) {
> >>>>>>>      //LOG.LogErrors(ioe);
> >>>>>>>      ioe.printStackTrace();
> >>>>>>>      throw new LoaderException("Exception reading the excel
> >>>>>> document");
> >>>>>>>
> >>>>>>>     } catch (InvalidFormatException e) {
> >>>>>>>      // Catch created for Workbook.create method. Unspecified.
> >>>>>>>
> >>>>>>> e.printStackTrace();
> >>>>>>> }
> >>>>>>> }
> >>>>>>>
> >>>>>>> Any thoughts?
> >>>>>>>
> >>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
> >> dfisher@jmlafferty.com
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Was this file created with Excel or another application like
> >>>> OpenOffice?
> >>>>>>>> What version of that application?
> >>>>>>>>
> >>>>>>>> Try unzipping the xlsx file and reporting the structure. These
> OOXML
> >>>>>> files
> >>>>>>>> are really zipped up directories of xml files. I suspect that
> there
> >> is
> >>>>>>>> something in your content type that POI does not understand.
> >>>>>>>>
> >>>>>>>> Is this a file that you can share? If so, then I would suggest
> that
> >>>> you
> >>>>>>>> create a bugzilla entry so that a developer can take a look when
> >> they
> >>>>>> have
> >>>>>>>> time.
> >>>>>>>>
> >>>>>>>> Regards,
> >>>>>>>> Dave
> >>>>>>>>
> >>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>>>>>>>
> >>>>>>>>> I've verified and the file is functional. I'm really clueless,
> atm.
> >>>>>>>>>
> >>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
> >>>> wrote:
> >>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Is it possible that the structure of the file is being mangled
> >>>>>> somehow?
> >>>>>>>>>> Have
> >>>>>>>>>> you tried to open the file using Excel after it has been ftp'd
> >> into
> >>>>>> the
> >>>>>>>>>> folder on your server?
> >>>>>>>>>>
> >>>>>>>>>> Yours
> >>>>>>>>>>
> >>>>>>>>>> Mark B
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Jorge Moya wrote:
> >>>>>>>>>>>
> >>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
> >> extract
> >>>>>> the
> >>>>>>>>>>> info
> >>>>>>>>>>> from the file.
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks in advance.
> >>>>>>>>>>>
> >>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
> >>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through an
> >> FTP
> >>>>>>>>>> server,
> >>>>>>>>>>>> and after upload I execute the validation of my app which
> >> proceed
> >>>> to
> >>>>>>>>>>>> extract
> >>>>>>>>>>>> the information from a designated folder, but it breaks when
> it
> >>>>>> tries
> >>>>>>>> to
> >>>>>>>>>>>> upload the file with mentioned errors.
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>>>>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> You should write the uploaded file to your temporary file and
> >>>> then
> >>>>>>>> read
> >>>>>>>>>>>>> it
> >>>>>>>>>>>>> in.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly.
> >> The
> >>>>>> user
> >>>>>>>>>>>>> might stop transfer or the network connection might break.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Regards,
> >>>>>>>>>>>>> Dave
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
> >>>>>> document
> >>>>>>>>>>>>> using
> >>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however
> >> when
> >>>> I
> >>>>>>>>>>>>> tried
> >>>>>>>>>>>>> to
> >>>>>>>>>>>>>> upload the file to the server, it returned me these errors
> on
> >>>> the
> >>>>>>>>>>>>> server's
> >>>>>>>>>>>>>> tomcat console:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
> >>>> Can't
> >>>>>>>>>> read
> >>>>>>>>>>>>>> content t
> >>>>>>>>>>>>>> ypes part !
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>>>>>>>> ntTypeManager.java:107)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>>>>>>>> 136)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>
> >> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>>>>>>>> va:63)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>
> >> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>>>>>>>   at
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>>>>>>>> a:154)
> >>>>>>>>>>>>>>   at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work
> fine.
> >>>>>>>>>>>>> Extracting
> >>>>>>>>>>>>>> info on my local machine works fine, as well.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>> View this message in context:
> >>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
When you removed the jars, did you restart Tomcat?

What version of Java is running on your Windows server and what version of Windows?

Can you list all of the jars in tomcat/common/lib and tomcat/shared/lib?

Does your Tomcat server have proper access rights to the temporary directory? Could there be a locking issue?

How is your local environment different from your server?

THere ought to be someone at your job who understands your Tomcat server. Is there an internal resource? As you see I suspect that your problem is really a Tomcat configuration issue. There is a very active Tomcat User list - http://tomcat.apache.org/lists.html#tomcat-users

Regards,
Dave

On Jun 11, 2010, at 10:00 AM, Jorge Moya wrote:

> I've tried removing the extra .jars and it still won't work. I just don't
> get it.
> 
> On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <df...@jmlafferty.com>wrote:
> 
>> Glad to help.
>> 
>>> Closest-named classes I could find under common\lib are:
>>> 
>>> xbean-2.2.0.jar
>>> stax-api-1.0.1.jar
>>> axis2-xmlbeans-1.3.jar
>> 
>> Those are not normal to a standard Tomcat 5.5. These are probably
>> conflicting in some strange way (the tomcat classloader is strange and is
>> simplified in Tomcat 6.) They were probably added because they are required
>> by some other webapps on the server.
>> 
>> Can you take these out temporarily and restart your tomcat server?
>> 
>> Or does someone else own that asset? If so they will need to help you.
>> 
>> They might work better in shared\lib but that is really a guess and the
>> issue may be with the other non-POI apps on that server.
>> 
>> Regards,
>> Dave
>> 
>> 
>>> 
>>> Tomcat version: 5.5.20
>>> 
>>> Tomcat is not initialized with -Djava.awt.headless=true
>>> 
>>> Sorry to keep you guys on the same issue.. it's just that I'm new with
>> POI
>>> and tomcat (intern), and I'm trying to update the webapp.
>>> 
>>> Thanks in advance.
>>> 
>>> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <dfisher@jmlafferty.com
>>> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> Here a few things that I would check.
>>>> 
>>>> 
>>>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
>>>>> 
>>>>> Including:
>>>>> poi-3.6
>>>>> poi-contrib-3.6
>>>>> poi-ooxml-3.6
>>>>> poi-scratchpad 3.6
>>>>> ooxml-schemas-1.0
>>>>> xmlbeans-2.3.0
>>>>> dom4j-1.6.1
>>>>> geronimo-stax
>>>> 
>>>> (I just saw you conversation with Nick in the earlier thread.)
>>>> 
>>>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
>> other
>>>> versions of any of these Jars?
>>>> 
>>>>> Java version: 1.5
>>>>> Tomcat: 5.5
>>>> 
>>>> Which Tomcat 5.5? The current version is 5.5.29.
>>>> 
>>>> Is your Tomcat started with -Djava.awt.headless=true?
>>>> 
>>>> Regards,
>>>> Dave
>>>> 
>>>> 
>>>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <dfisher@jmlafferty.com
>>>>> wrote:
>>>>> 
>>>>>>> Yes, this file was created using Excel 2007. The file was originally
>> an
>>>>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading
>> both
>>>>>> new
>>>>>>> and modified .xls files and it won't budge).
>>>>>>> 
>>>>>>> Per request, I unzipped the .xlsx files and the reported structure is
>>>>>> this:
>>>>>>> 
>>>>>>> _rels Folder
>>>>>>> docProps Folder
>>>>>>> xl Folder
>>>>>>> [Content_Types].xml
>>>>>> 
>>>>>> What's in this file?
>>>>>> 
>>>>>>> Inside the xl folder I found the following files:
>>>>>>> 
>>>>>>> _rels Folder
>>>>>>> printerSettings Folder
>>>>>>> theme folder
>>>>>>> worksheets folder
>>>>>>> sharedStrings.xml
>>>>>>> styles.xml
>>>>>>> workbook.xml
>>>>>>> 
>>>>>>> Etcetera. Truth be told, it seems the file is doing all right.
>>>>>>> 
>>>>>>> I'll post my code (where it breaks) and see if there's something with
>>>> the
>>>>>>> code (although that wouldn't make sense, since it works perfectly
>> fine
>>>> in
>>>>>>> this machine -- with both .xls and .xlsx files).
>>>>>> 
>>>>>> What versions of Java are you running where it works?
>>>>>> 
>>>>>> What version of Tomcat does your server use? Where are the POI jars in
>>>> your
>>>>>> Tomcat installation?
>>>>>> 
>>>>>> Regards,
>>>>>> Dave
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> public void loadFile(File oFileToLoad) throws FileNotFoundException,
>>>>>>> LoaderException, ValidationException {
>>>>>>>     Workbook oWorkgroup;
>>>>>>> 
>>>>>>>     m_oFileName = oFileToLoad;
>>>>>>>     try {
>>>>>>>      //LOG.Log("ExcelFile - Loading file name: " +
>>>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>>>>>>>      m_oIn = new FileInputStream(m_oFileName);
>>>>>>> 
>>>>>>> 
>>>>>>>         oWorkgroup = WorkbookFactory.create(m_oIn);
>>>>>>> 
>>>>>>>       if (oWorkgroup.getNumberOfSheets() == 0) {
>>>>>>>           // page not found throw exception
>>>>>>>           throw new LoaderException("Excel document does not contain
>>>> a
>>>>>>> workbook");
>>>>>>>       }
>>>>>>> 
>>>>>>>       m_oSheet = oWorkgroup.getSheetAt(0);
>>>>>>> 
>>>>>>>       m_nTotalRows = getTotalRows();
>>>>>>> 
>>>>>>>      //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>>>>>>> LOG.LOG_TYPE_TRACE);
>>>>>>>     } catch(OldExcelFormatException e){
>>>>>>>      throw new ValidationException("This is an Excel 95 File, we can
>>>>>>> process only Excel 97-2007. ",
>>>>>>>      1, ValidationException.EXCEL_95_ERROR);
>>>>>>> 
>>>>>>>     }catch (IOException ioe) {
>>>>>>>      //LOG.LogErrors(ioe);
>>>>>>>      ioe.printStackTrace();
>>>>>>>      throw new LoaderException("Exception reading the excel
>>>>>> document");
>>>>>>> 
>>>>>>>     } catch (InvalidFormatException e) {
>>>>>>>      // Catch created for Workbook.create method. Unspecified.
>>>>>>> 
>>>>>>> e.printStackTrace();
>>>>>>> }
>>>>>>> }
>>>>>>> 
>>>>>>> Any thoughts?
>>>>>>> 
>>>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
>> dfisher@jmlafferty.com
>>>>>>> wrote:
>>>>>>> 
>>>>>>>> Was this file created with Excel or another application like
>>>> OpenOffice?
>>>>>>>> What version of that application?
>>>>>>>> 
>>>>>>>> Try unzipping the xlsx file and reporting the structure. These OOXML
>>>>>> files
>>>>>>>> are really zipped up directories of xml files. I suspect that there
>> is
>>>>>>>> something in your content type that POI does not understand.
>>>>>>>> 
>>>>>>>> Is this a file that you can share? If so, then I would suggest that
>>>> you
>>>>>>>> create a bugzilla entry so that a developer can take a look when
>> they
>>>>>> have
>>>>>>>> time.
>>>>>>>> 
>>>>>>>> Regards,
>>>>>>>> Dave
>>>>>>>> 
>>>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>>>>>>>> 
>>>>>>>>> I've verified and the file is functional. I'm really clueless, atm.
>>>>>>>>> 
>>>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Is it possible that the structure of the file is being mangled
>>>>>> somehow?
>>>>>>>>>> Have
>>>>>>>>>> you tried to open the file using Excel after it has been ftp'd
>> into
>>>>>> the
>>>>>>>>>> folder on your server?
>>>>>>>>>> 
>>>>>>>>>> Yours
>>>>>>>>>> 
>>>>>>>>>> Mark B
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Jorge Moya wrote:
>>>>>>>>>>> 
>>>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
>> extract
>>>>>> the
>>>>>>>>>>> info
>>>>>>>>>>> from the file.
>>>>>>>>>>> 
>>>>>>>>>>> Thanks in advance.
>>>>>>>>>>> 
>>>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
>>>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> What do you mean, exactly? I'm uploading the files through an
>> FTP
>>>>>>>>>> server,
>>>>>>>>>>>> and after upload I execute the validation of my app which
>> proceed
>>>> to
>>>>>>>>>>>> extract
>>>>>>>>>>>> the information from a designated folder, but it breaks when it
>>>>>> tries
>>>>>>>> to
>>>>>>>>>>>> upload the file with mentioned errors.
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>>>>>>>> <df...@jmlafferty.com>wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> You should write the uploaded file to your temporary file and
>>>> then
>>>>>>>> read
>>>>>>>>>>>>> it
>>>>>>>>>>>>> in.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly.
>> The
>>>>>> user
>>>>>>>>>>>>> might stop transfer or the network connection might break.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>> Dave
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
>>>>>> document
>>>>>>>>>>>>> using
>>>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however
>> when
>>>> I
>>>>>>>>>>>>> tried
>>>>>>>>>>>>> to
>>>>>>>>>>>>>> upload the file to the server, it returned me these errors on
>>>> the
>>>>>>>>>>>>> server's
>>>>>>>>>>>>>> tomcat console:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
>>>> Can't
>>>>>>>>>> read
>>>>>>>>>>>>>> content t
>>>>>>>>>>>>>> ypes part !
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>>>>>>>> ntTypeManager.java:107)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>>>>>>>> 136)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>> 
>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>>>>>>>> va:63)
>>>>>>>>>>>>>>   at
>>>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>> 
>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>>>>>>>   at
>>>>>>>>>>>>>> 
>>>>>>>> 
>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>>>>>>>> a:154)
>>>>>>>>>>>>>>   at java.lang.Thread.run(Thread.java:595)
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
>>>>>>>>>>>>> Extracting
>>>>>>>>>>>>>> info on my local machine works fine, as well.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
I've tried removing the extra .jars and it still won't work. I just don't
get it.

On Thu, Jun 10, 2010 at 1:43 PM, David Fisher <df...@jmlafferty.com>wrote:

> Glad to help.
>
> > Closest-named classes I could find under common\lib are:
> >
> > xbean-2.2.0.jar
> > stax-api-1.0.1.jar
> > axis2-xmlbeans-1.3.jar
>
> Those are not normal to a standard Tomcat 5.5. These are probably
> conflicting in some strange way (the tomcat classloader is strange and is
> simplified in Tomcat 6.) They were probably added because they are required
> by some other webapps on the server.
>
> Can you take these out temporarily and restart your tomcat server?
>
> Or does someone else own that asset? If so they will need to help you.
>
> They might work better in shared\lib but that is really a guess and the
> issue may be with the other non-POI apps on that server.
>
> Regards,
> Dave
>
>
> >
> > Tomcat version: 5.5.20
> >
> > Tomcat is not initialized with -Djava.awt.headless=true
> >
> > Sorry to keep you guys on the same issue.. it's just that I'm new with
> POI
> > and tomcat (intern), and I'm trying to update the webapp.
> >
> > Thanks in advance.
> >
> > On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >
> >> Hi,
> >>
> >> Here a few things that I would check.
> >>
> >>
> >> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> >>>
> >>> Including:
> >>> poi-3.6
> >>> poi-contrib-3.6
> >>> poi-ooxml-3.6
> >>> poi-scratchpad 3.6
> >>> ooxml-schemas-1.0
> >>> xmlbeans-2.3.0
> >>> dom4j-1.6.1
> >>> geronimo-stax
> >>
> >> (I just saw you conversation with Nick in the earlier thread.)
> >>
> >> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there
> other
> >> versions of any of these Jars?
> >>
> >>> Java version: 1.5
> >>> Tomcat: 5.5
> >>
> >> Which Tomcat 5.5? The current version is 5.5.29.
> >>
> >> Is your Tomcat started with -Djava.awt.headless=true?
> >>
> >> Regards,
> >> Dave
> >>
> >>
> >>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <dfisher@jmlafferty.com
> >>> wrote:
> >>>
> >>>>> Yes, this file was created using Excel 2007. The file was originally
> an
> >>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading
> both
> >>>> new
> >>>>> and modified .xls files and it won't budge).
> >>>>>
> >>>>> Per request, I unzipped the .xlsx files and the reported structure is
> >>>> this:
> >>>>>
> >>>>> _rels Folder
> >>>>> docProps Folder
> >>>>> xl Folder
> >>>>> [Content_Types].xml
> >>>>
> >>>> What's in this file?
> >>>>
> >>>>> Inside the xl folder I found the following files:
> >>>>>
> >>>>> _rels Folder
> >>>>> printerSettings Folder
> >>>>> theme folder
> >>>>> worksheets folder
> >>>>> sharedStrings.xml
> >>>>> styles.xml
> >>>>> workbook.xml
> >>>>>
> >>>>> Etcetera. Truth be told, it seems the file is doing all right.
> >>>>>
> >>>>> I'll post my code (where it breaks) and see if there's something with
> >> the
> >>>>> code (although that wouldn't make sense, since it works perfectly
> fine
> >> in
> >>>>> this machine -- with both .xls and .xlsx files).
> >>>>
> >>>> What versions of Java are you running where it works?
> >>>>
> >>>> What version of Tomcat does your server use? Where are the POI jars in
> >> your
> >>>> Tomcat installation?
> >>>>
> >>>> Regards,
> >>>> Dave
> >>>>
> >>>>
> >>>>>
> >>>>> public void loadFile(File oFileToLoad) throws FileNotFoundException,
> >>>>> LoaderException, ValidationException {
> >>>>>      Workbook oWorkgroup;
> >>>>>
> >>>>>      m_oFileName = oFileToLoad;
> >>>>>      try {
> >>>>>       //LOG.Log("ExcelFile - Loading file name: " +
> >>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >>>>>       m_oIn = new FileInputStream(m_oFileName);
> >>>>>
> >>>>>
> >>>>>          oWorkgroup = WorkbookFactory.create(m_oIn);
> >>>>>
> >>>>>        if (oWorkgroup.getNumberOfSheets() == 0) {
> >>>>>            // page not found throw exception
> >>>>>            throw new LoaderException("Excel document does not contain
> >> a
> >>>>> workbook");
> >>>>>        }
> >>>>>
> >>>>>        m_oSheet = oWorkgroup.getSheetAt(0);
> >>>>>
> >>>>>        m_nTotalRows = getTotalRows();
> >>>>>
> >>>>>       //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> >>>>> LOG.LOG_TYPE_TRACE);
> >>>>>      } catch(OldExcelFormatException e){
> >>>>>       throw new ValidationException("This is an Excel 95 File, we can
> >>>>> process only Excel 97-2007. ",
> >>>>>       1, ValidationException.EXCEL_95_ERROR);
> >>>>>
> >>>>>      }catch (IOException ioe) {
> >>>>>       //LOG.LogErrors(ioe);
> >>>>>       ioe.printStackTrace();
> >>>>>       throw new LoaderException("Exception reading the excel
> >>>> document");
> >>>>>
> >>>>>      } catch (InvalidFormatException e) {
> >>>>>       // Catch created for Workbook.create method. Unspecified.
> >>>>>
> >>>>> e.printStackTrace();
> >>>>> }
> >>>>>  }
> >>>>>
> >>>>> Any thoughts?
> >>>>>
> >>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <
> dfisher@jmlafferty.com
> >>>>> wrote:
> >>>>>
> >>>>>> Was this file created with Excel or another application like
> >> OpenOffice?
> >>>>>> What version of that application?
> >>>>>>
> >>>>>> Try unzipping the xlsx file and reporting the structure. These OOXML
> >>>> files
> >>>>>> are really zipped up directories of xml files. I suspect that there
> is
> >>>>>> something in your content type that POI does not understand.
> >>>>>>
> >>>>>> Is this a file that you can share? If so, then I would suggest that
> >> you
> >>>>>> create a bugzilla entry so that a developer can take a look when
> they
> >>>> have
> >>>>>> time.
> >>>>>>
> >>>>>> Regards,
> >>>>>> Dave
> >>>>>>
> >>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>>>>>
> >>>>>>> I've verified and the file is functional. I'm really clueless, atm.
> >>>>>>>
> >>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
> >> wrote:
> >>>>>>>
> >>>>>>>>
> >>>>>>>> Is it possible that the structure of the file is being mangled
> >>>> somehow?
> >>>>>>>> Have
> >>>>>>>> you tried to open the file using Excel after it has been ftp'd
> into
> >>>> the
> >>>>>>>> folder on your server?
> >>>>>>>>
> >>>>>>>> Yours
> >>>>>>>>
> >>>>>>>> Mark B
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Jorge Moya wrote:
> >>>>>>>>>
> >>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to
> extract
> >>>> the
> >>>>>>>>> info
> >>>>>>>>> from the file.
> >>>>>>>>>
> >>>>>>>>> Thanks in advance.
> >>>>>>>>>
> >>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
> >>>> wrote:
> >>>>>>>>>
> >>>>>>>>>> What do you mean, exactly? I'm uploading the files through an
> FTP
> >>>>>>>> server,
> >>>>>>>>>> and after upload I execute the validation of my app which
> proceed
> >> to
> >>>>>>>>>> extract
> >>>>>>>>>> the information from a designated folder, but it breaks when it
> >>>> tries
> >>>>>> to
> >>>>>>>>>> upload the file with mentioned errors.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hi,
> >>>>>>>>>>>
> >>>>>>>>>>> You should write the uploaded file to your temporary file and
> >> then
> >>>>>> read
> >>>>>>>>>>> it
> >>>>>>>>>>> in.
> >>>>>>>>>>>
> >>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly.
> The
> >>>> user
> >>>>>>>>>>> might stop transfer or the network connection might break.
> >>>>>>>>>>>
> >>>>>>>>>>> Regards,
> >>>>>>>>>>> Dave
> >>>>>>>>>>>
> >>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
> >>>> document
> >>>>>>>>>>> using
> >>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however
> when
> >> I
> >>>>>>>>>>> tried
> >>>>>>>>>>> to
> >>>>>>>>>>>> upload the file to the server, it returned me these errors on
> >> the
> >>>>>>>>>>> server's
> >>>>>>>>>>>> tomcat console:
> >>>>>>>>>>>>
> >>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
> >> Can't
> >>>>>>>> read
> >>>>>>>>>>>> content t
> >>>>>>>>>>>> ypes part !
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>>>>>> ntTypeManager.java:107)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>>>>>> 136)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>>>>>
> >>>>>>>>>>>>    at
> >>>>>>>>>>>
> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>>>>>> va:63)
> >>>>>>>>>>>>    at
> >>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>
> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>>>>>    at
> >>>>>>>>>>>>
> >>>>>>
> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>>>>>> a:154)
> >>>>>>>>>>>>    at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>>>>>
> >>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
> >>>>>>>>>>> Extracting
> >>>>>>>>>>>> info on my local machine works fine, as well.
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> View this message in context:
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
Glad to help.

> Closest-named classes I could find under common\lib are:
> 
> xbean-2.2.0.jar
> stax-api-1.0.1.jar
> axis2-xmlbeans-1.3.jar

Those are not normal to a standard Tomcat 5.5. These are probably conflicting in some strange way (the tomcat classloader is strange and is simplified in Tomcat 6.) They were probably added because they are required by some other webapps on the server.

Can you take these out temporarily and restart your tomcat server?

Or does someone else own that asset? If so they will need to help you.

They might work better in shared\lib but that is really a guess and the issue may be with the other non-POI apps on that server.

Regards,
Dave


> 
> Tomcat version: 5.5.20
> 
> Tomcat is not initialized with -Djava.awt.headless=true
> 
> Sorry to keep you guys on the same issue.. it's just that I'm new with POI
> and tomcat (intern), and I'm trying to update the webapp.
> 
> Thanks in advance.
> 
> On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <df...@jmlafferty.com>wrote:
> 
>> Hi,
>> 
>> Here a few things that I would check.
>> 
>> 
>> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
>>> 
>>> Including:
>>> poi-3.6
>>> poi-contrib-3.6
>>> poi-ooxml-3.6
>>> poi-scratchpad 3.6
>>> ooxml-schemas-1.0
>>> xmlbeans-2.3.0
>>> dom4j-1.6.1
>>> geronimo-stax
>> 
>> (I just saw you conversation with Nick in the earlier thread.)
>> 
>> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there other
>> versions of any of these Jars?
>> 
>>> Java version: 1.5
>>> Tomcat: 5.5
>> 
>> Which Tomcat 5.5? The current version is 5.5.29.
>> 
>> Is your Tomcat started with -Djava.awt.headless=true?
>> 
>> Regards,
>> Dave
>> 
>> 
>>> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <dfisher@jmlafferty.com
>>> wrote:
>>> 
>>>>> Yes, this file was created using Excel 2007. The file was originally an
>>>>> .xls, and I migrated it to .xlsx (however, I have tried uploading both
>>>> new
>>>>> and modified .xls files and it won't budge).
>>>>> 
>>>>> Per request, I unzipped the .xlsx files and the reported structure is
>>>> this:
>>>>> 
>>>>> _rels Folder
>>>>> docProps Folder
>>>>> xl Folder
>>>>> [Content_Types].xml
>>>> 
>>>> What's in this file?
>>>> 
>>>>> Inside the xl folder I found the following files:
>>>>> 
>>>>> _rels Folder
>>>>> printerSettings Folder
>>>>> theme folder
>>>>> worksheets folder
>>>>> sharedStrings.xml
>>>>> styles.xml
>>>>> workbook.xml
>>>>> 
>>>>> Etcetera. Truth be told, it seems the file is doing all right.
>>>>> 
>>>>> I'll post my code (where it breaks) and see if there's something with
>> the
>>>>> code (although that wouldn't make sense, since it works perfectly fine
>> in
>>>>> this machine -- with both .xls and .xlsx files).
>>>> 
>>>> What versions of Java are you running where it works?
>>>> 
>>>> What version of Tomcat does your server use? Where are the POI jars in
>> your
>>>> Tomcat installation?
>>>> 
>>>> Regards,
>>>> Dave
>>>> 
>>>> 
>>>>> 
>>>>> public void loadFile(File oFileToLoad) throws FileNotFoundException,
>>>>> LoaderException, ValidationException {
>>>>>      Workbook oWorkgroup;
>>>>> 
>>>>>      m_oFileName = oFileToLoad;
>>>>>      try {
>>>>>       //LOG.Log("ExcelFile - Loading file name: " +
>>>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>>>>>       m_oIn = new FileInputStream(m_oFileName);
>>>>> 
>>>>> 
>>>>>          oWorkgroup = WorkbookFactory.create(m_oIn);
>>>>> 
>>>>>        if (oWorkgroup.getNumberOfSheets() == 0) {
>>>>>            // page not found throw exception
>>>>>            throw new LoaderException("Excel document does not contain
>> a
>>>>> workbook");
>>>>>        }
>>>>> 
>>>>>        m_oSheet = oWorkgroup.getSheetAt(0);
>>>>> 
>>>>>        m_nTotalRows = getTotalRows();
>>>>> 
>>>>>       //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>>>>> LOG.LOG_TYPE_TRACE);
>>>>>      } catch(OldExcelFormatException e){
>>>>>       throw new ValidationException("This is an Excel 95 File, we can
>>>>> process only Excel 97-2007. ",
>>>>>       1, ValidationException.EXCEL_95_ERROR);
>>>>> 
>>>>>      }catch (IOException ioe) {
>>>>>       //LOG.LogErrors(ioe);
>>>>>       ioe.printStackTrace();
>>>>>       throw new LoaderException("Exception reading the excel
>>>> document");
>>>>> 
>>>>>      } catch (InvalidFormatException e) {
>>>>>       // Catch created for Workbook.create method. Unspecified.
>>>>> 
>>>>> e.printStackTrace();
>>>>> }
>>>>>  }
>>>>> 
>>>>> Any thoughts?
>>>>> 
>>>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <dfisher@jmlafferty.com
>>>>> wrote:
>>>>> 
>>>>>> Was this file created with Excel or another application like
>> OpenOffice?
>>>>>> What version of that application?
>>>>>> 
>>>>>> Try unzipping the xlsx file and reporting the structure. These OOXML
>>>> files
>>>>>> are really zipped up directories of xml files. I suspect that there is
>>>>>> something in your content type that POI does not understand.
>>>>>> 
>>>>>> Is this a file that you can share? If so, then I would suggest that
>> you
>>>>>> create a bugzilla entry so that a developer can take a look when they
>>>> have
>>>>>> time.
>>>>>> 
>>>>>> Regards,
>>>>>> Dave
>>>>>> 
>>>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>>>>>> 
>>>>>>> I've verified and the file is functional. I'm really clueless, atm.
>>>>>>> 
>>>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
>> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> Is it possible that the structure of the file is being mangled
>>>> somehow?
>>>>>>>> Have
>>>>>>>> you tried to open the file using Excel after it has been ftp'd into
>>>> the
>>>>>>>> folder on your server?
>>>>>>>> 
>>>>>>>> Yours
>>>>>>>> 
>>>>>>>> Mark B
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Jorge Moya wrote:
>>>>>>>>> 
>>>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to extract
>>>> the
>>>>>>>>> info
>>>>>>>>> from the file.
>>>>>>>>> 
>>>>>>>>> Thanks in advance.
>>>>>>>>> 
>>>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> What do you mean, exactly? I'm uploading the files through an FTP
>>>>>>>> server,
>>>>>>>>>> and after upload I execute the validation of my app which proceed
>> to
>>>>>>>>>> extract
>>>>>>>>>> the information from a designated folder, but it breaks when it
>>>> tries
>>>>>> to
>>>>>>>>>> upload the file with mentioned errors.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>>>>>> <df...@jmlafferty.com>wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hi,
>>>>>>>>>>> 
>>>>>>>>>>> You should write the uploaded file to your temporary file and
>> then
>>>>>> read
>>>>>>>>>>> it
>>>>>>>>>>> in.
>>>>>>>>>>> 
>>>>>>>>>>> OOXML files are zip files and are not accessed non-serailly. The
>>>> user
>>>>>>>>>>> might stop transfer or the network connection might break.
>>>>>>>>>>> 
>>>>>>>>>>> Regards,
>>>>>>>>>>> Dave
>>>>>>>>>>> 
>>>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
>>>> document
>>>>>>>>>>> using
>>>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however when
>> I
>>>>>>>>>>> tried
>>>>>>>>>>> to
>>>>>>>>>>>> upload the file to the server, it returned me these errors on
>> the
>>>>>>>>>>> server's
>>>>>>>>>>>> tomcat console:
>>>>>>>>>>>> 
>>>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
>> Can't
>>>>>>>> read
>>>>>>>>>>>> content t
>>>>>>>>>>>> ypes part !
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>>>>>> ntTypeManager.java:107)
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>>>>>> 136)
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>>>>>> 
>>>>>>>>>>>>    at
>>>>>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>>>>>> va:63)
>>>>>>>>>>>>    at
>>>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>>>>>    at
>>>>>>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>>>>>    at
>>>>>>>>>>>> 
>>>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>>>>>> a:154)
>>>>>>>>>>>>    at java.lang.Thread.run(Thread.java:595)
>>>>>>>>>>>> 
>>>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
>>>>>>>>>>> Extracting
>>>>>>>>>>>> info on my local machine works fine, as well.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> 
>>>>>> 
>>>> 
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
Closest-named classes I could find under common\lib are:

xbean-2.2.0.jar
stax-api-1.0.1.jar
axis2-xmlbeans-1.3.jar

Tomcat version: 5.5.20

Tomcat is not initialized with -Djava.awt.headless=true

Sorry to keep you guys on the same issue.. it's just that I'm new with POI
and tomcat (intern), and I'm trying to update the webapp.

Thanks in advance.

On Thu, Jun 10, 2010 at 1:01 PM, David Fisher <df...@jmlafferty.com>wrote:

> Hi,
>
> Here a few things that I would check.
>
>
> POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> >
> > Including:
> > poi-3.6
> > poi-contrib-3.6
> > poi-ooxml-3.6
> > poi-scratchpad 3.6
> > ooxml-schemas-1.0
> > xmlbeans-2.3.0
> > dom4j-1.6.1
> > geronimo-stax
>
> (I just saw you conversation with Nick in the earlier thread.)
>
> What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there other
> versions of any of these Jars?
>
> > Java version: 1.5
> > Tomcat: 5.5
>
> Which Tomcat 5.5? The current version is 5.5.29.
>
> Is your Tomcat started with -Djava.awt.headless=true?
>
> Regards,
> Dave
>
>
> > On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >
> >>> Yes, this file was created using Excel 2007. The file was originally an
> >>> .xls, and I migrated it to .xlsx (however, I have tried uploading both
> >> new
> >>> and modified .xls files and it won't budge).
> >>>
> >>> Per request, I unzipped the .xlsx files and the reported structure is
> >> this:
> >>>
> >>> _rels Folder
> >>> docProps Folder
> >>> xl Folder
> >>> [Content_Types].xml
> >>
> >> What's in this file?
> >>
> >>> Inside the xl folder I found the following files:
> >>>
> >>> _rels Folder
> >>> printerSettings Folder
> >>> theme folder
> >>> worksheets folder
> >>> sharedStrings.xml
> >>> styles.xml
> >>> workbook.xml
> >>>
> >>> Etcetera. Truth be told, it seems the file is doing all right.
> >>>
> >>> I'll post my code (where it breaks) and see if there's something with
> the
> >>> code (although that wouldn't make sense, since it works perfectly fine
> in
> >>> this machine -- with both .xls and .xlsx files).
> >>
> >> What versions of Java are you running where it works?
> >>
> >> What version of Tomcat does your server use? Where are the POI jars in
> your
> >> Tomcat installation?
> >>
> >> Regards,
> >> Dave
> >>
> >>
> >>>
> >>> public void loadFile(File oFileToLoad) throws FileNotFoundException,
> >>> LoaderException, ValidationException {
> >>>       Workbook oWorkgroup;
> >>>
> >>>       m_oFileName = oFileToLoad;
> >>>       try {
> >>>        //LOG.Log("ExcelFile - Loading file name: " +
> >>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >>>        m_oIn = new FileInputStream(m_oFileName);
> >>>
> >>>
> >>>           oWorkgroup = WorkbookFactory.create(m_oIn);
> >>>
> >>>         if (oWorkgroup.getNumberOfSheets() == 0) {
> >>>             // page not found throw exception
> >>>             throw new LoaderException("Excel document does not contain
> a
> >>> workbook");
> >>>         }
> >>>
> >>>         m_oSheet = oWorkgroup.getSheetAt(0);
> >>>
> >>>         m_nTotalRows = getTotalRows();
> >>>
> >>>        //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> >>> LOG.LOG_TYPE_TRACE);
> >>>       } catch(OldExcelFormatException e){
> >>>        throw new ValidationException("This is an Excel 95 File, we can
> >>> process only Excel 97-2007. ",
> >>>        1, ValidationException.EXCEL_95_ERROR);
> >>>
> >>>       }catch (IOException ioe) {
> >>>        //LOG.LogErrors(ioe);
> >>>        ioe.printStackTrace();
> >>>        throw new LoaderException("Exception reading the excel
> >> document");
> >>>
> >>>       } catch (InvalidFormatException e) {
> >>>        // Catch created for Workbook.create method. Unspecified.
> >>>
> >>> e.printStackTrace();
> >>> }
> >>>   }
> >>>
> >>> Any thoughts?
> >>>
> >>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <dfisher@jmlafferty.com
> >>> wrote:
> >>>
> >>>> Was this file created with Excel or another application like
> OpenOffice?
> >>>> What version of that application?
> >>>>
> >>>> Try unzipping the xlsx file and reporting the structure. These OOXML
> >> files
> >>>> are really zipped up directories of xml files. I suspect that there is
> >>>> something in your content type that POI does not understand.
> >>>>
> >>>> Is this a file that you can share? If so, then I would suggest that
> you
> >>>> create a bugzilla entry so that a developer can take a look when they
> >> have
> >>>> time.
> >>>>
> >>>> Regards,
> >>>> Dave
> >>>>
> >>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>>>
> >>>>> I've verified and the file is functional. I'm really clueless, atm.
> >>>>>
> >>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk>
> wrote:
> >>>>>
> >>>>>>
> >>>>>> Is it possible that the structure of the file is being mangled
> >> somehow?
> >>>>>> Have
> >>>>>> you tried to open the file using Excel after it has been ftp'd into
> >> the
> >>>>>> folder on your server?
> >>>>>>
> >>>>>> Yours
> >>>>>>
> >>>>>> Mark B
> >>>>>>
> >>>>>>
> >>>>>> Jorge Moya wrote:
> >>>>>>>
> >>>>>>> I'm sorry for spam, but I menat it breaks when it tries to extract
> >> the
> >>>>>>> info
> >>>>>>> from the file.
> >>>>>>>
> >>>>>>> Thanks in advance.
> >>>>>>>
> >>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
> >> wrote:
> >>>>>>>
> >>>>>>>> What do you mean, exactly? I'm uploading the files through an FTP
> >>>>>> server,
> >>>>>>>> and after upload I execute the validation of my app which proceed
> to
> >>>>>>>> extract
> >>>>>>>> the information from a designated folder, but it breaks when it
> >> tries
> >>>> to
> >>>>>>>> upload the file with mentioned errors.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> You should write the uploaded file to your temporary file and
> then
> >>>> read
> >>>>>>>>> it
> >>>>>>>>> in.
> >>>>>>>>>
> >>>>>>>>> OOXML files are zip files and are not accessed non-serailly. The
> >> user
> >>>>>>>>> might stop transfer or the network connection might break.
> >>>>>>>>>
> >>>>>>>>> Regards,
> >>>>>>>>> Dave
> >>>>>>>>>
> >>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>>>
> >>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
> >> document
> >>>>>>>>> using
> >>>>>>>>>> POI API and the ss.usermodel (using an app I made), however when
> I
> >>>>>>>>> tried
> >>>>>>>>> to
> >>>>>>>>>> upload the file to the server, it returned me these errors on
> the
> >>>>>>>>> server's
> >>>>>>>>>> tomcat console:
> >>>>>>>>>>
> >>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException:
> Can't
> >>>>>> read
> >>>>>>>>>> content t
> >>>>>>>>>> ypes part !
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>>>> ntTypeManager.java:107)
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>>>> 136)
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>>>
> >>>>>>>>>>     at
> >>>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>>>> va:63)
> >>>>>>>>>>     at
> >>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>>>     at
> >>>>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>>>     at
> >>>>>>>>>>
> >>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>>>> a:154)
> >>>>>>>>>>     at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>>>
> >>>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
> >>>>>>>>> Extracting
> >>>>>>>>>> info on my local machine works fine, as well.
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> View this message in context:
> >>>>>>
> >>>>
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>>>> Sent from the POI - User mailing list archive at Nabble.com.
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
Hi,

Here a few things that I would check.


POI jars:C:\Tomcat\webapps\websrv\WEB-INF\lib
> 
> Including:
> poi-3.6
> poi-contrib-3.6
> poi-ooxml-3.6
> poi-scratchpad 3.6
> ooxml-schemas-1.0
> xmlbeans-2.3.0
> dom4j-1.6.1
> geronimo-stax

(I just saw you conversation with Nick in the earlier thread.) 

What is in C:\Tomcat\shared\lib and C:\Tomcat\common\lib? Are there other versions of any of these Jars?

> Java version: 1.5
> Tomcat: 5.5

Which Tomcat 5.5? The current version is 5.5.29.

Is your Tomcat started with -Djava.awt.headless=true?

Regards,
Dave


> On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <df...@jmlafferty.com>wrote:
> 
>>> Yes, this file was created using Excel 2007. The file was originally an
>>> .xls, and I migrated it to .xlsx (however, I have tried uploading both
>> new
>>> and modified .xls files and it won't budge).
>>> 
>>> Per request, I unzipped the .xlsx files and the reported structure is
>> this:
>>> 
>>> _rels Folder
>>> docProps Folder
>>> xl Folder
>>> [Content_Types].xml
>> 
>> What's in this file?
>> 
>>> Inside the xl folder I found the following files:
>>> 
>>> _rels Folder
>>> printerSettings Folder
>>> theme folder
>>> worksheets folder
>>> sharedStrings.xml
>>> styles.xml
>>> workbook.xml
>>> 
>>> Etcetera. Truth be told, it seems the file is doing all right.
>>> 
>>> I'll post my code (where it breaks) and see if there's something with the
>>> code (although that wouldn't make sense, since it works perfectly fine in
>>> this machine -- with both .xls and .xlsx files).
>> 
>> What versions of Java are you running where it works?
>> 
>> What version of Tomcat does your server use? Where are the POI jars in your
>> Tomcat installation?
>> 
>> Regards,
>> Dave
>> 
>> 
>>> 
>>> public void loadFile(File oFileToLoad) throws FileNotFoundException,
>>> LoaderException, ValidationException {
>>>       Workbook oWorkgroup;
>>> 
>>>       m_oFileName = oFileToLoad;
>>>       try {
>>>        //LOG.Log("ExcelFile - Loading file name: " +
>>> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>>>        m_oIn = new FileInputStream(m_oFileName);
>>> 
>>> 
>>>           oWorkgroup = WorkbookFactory.create(m_oIn);
>>> 
>>>         if (oWorkgroup.getNumberOfSheets() == 0) {
>>>             // page not found throw exception
>>>             throw new LoaderException("Excel document does not contain a
>>> workbook");
>>>         }
>>> 
>>>         m_oSheet = oWorkgroup.getSheetAt(0);
>>> 
>>>         m_nTotalRows = getTotalRows();
>>> 
>>>        //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
>>> LOG.LOG_TYPE_TRACE);
>>>       } catch(OldExcelFormatException e){
>>>        throw new ValidationException("This is an Excel 95 File, we can
>>> process only Excel 97-2007. ",
>>>        1, ValidationException.EXCEL_95_ERROR);
>>> 
>>>       }catch (IOException ioe) {
>>>        //LOG.LogErrors(ioe);
>>>        ioe.printStackTrace();
>>>        throw new LoaderException("Exception reading the excel
>> document");
>>> 
>>>       } catch (InvalidFormatException e) {
>>>        // Catch created for Workbook.create method. Unspecified.
>>> 
>>> e.printStackTrace();
>>> }
>>>   }
>>> 
>>> Any thoughts?
>>> 
>>> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <dfisher@jmlafferty.com
>>> wrote:
>>> 
>>>> Was this file created with Excel or another application like OpenOffice?
>>>> What version of that application?
>>>> 
>>>> Try unzipping the xlsx file and reporting the structure. These OOXML
>> files
>>>> are really zipped up directories of xml files. I suspect that there is
>>>> something in your content type that POI does not understand.
>>>> 
>>>> Is this a file that you can share? If so, then I would suggest that you
>>>> create a bugzilla entry so that a developer can take a look when they
>> have
>>>> time.
>>>> 
>>>> Regards,
>>>> Dave
>>>> 
>>>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>>>> 
>>>>> I've verified and the file is functional. I'm really clueless, atm.
>>>>> 
>>>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
>>>>> 
>>>>>> 
>>>>>> Is it possible that the structure of the file is being mangled
>> somehow?
>>>>>> Have
>>>>>> you tried to open the file using Excel after it has been ftp'd into
>> the
>>>>>> folder on your server?
>>>>>> 
>>>>>> Yours
>>>>>> 
>>>>>> Mark B
>>>>>> 
>>>>>> 
>>>>>> Jorge Moya wrote:
>>>>>>> 
>>>>>>> I'm sorry for spam, but I menat it breaks when it tries to extract
>> the
>>>>>>> info
>>>>>>> from the file.
>>>>>>> 
>>>>>>> Thanks in advance.
>>>>>>> 
>>>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
>> wrote:
>>>>>>> 
>>>>>>>> What do you mean, exactly? I'm uploading the files through an FTP
>>>>>> server,
>>>>>>>> and after upload I execute the validation of my app which proceed to
>>>>>>>> extract
>>>>>>>> the information from a designated folder, but it breaks when it
>> tries
>>>> to
>>>>>>>> upload the file with mentioned errors.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>>>> <df...@jmlafferty.com>wrote:
>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>> 
>>>>>>>>> You should write the uploaded file to your temporary file and then
>>>> read
>>>>>>>>> it
>>>>>>>>> in.
>>>>>>>>> 
>>>>>>>>> OOXML files are zip files and are not accessed non-serailly. The
>> user
>>>>>>>>> might stop transfer or the network connection might break.
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Dave
>>>>>>>>> 
>>>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>>>> 
>>>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
>> document
>>>>>>>>> using
>>>>>>>>>> POI API and the ss.usermodel (using an app I made), however when I
>>>>>>>>> tried
>>>>>>>>> to
>>>>>>>>>> upload the file to the server, it returned me these errors on the
>>>>>>>>> server's
>>>>>>>>>> tomcat console:
>>>>>>>>>> 
>>>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
>>>>>> read
>>>>>>>>>> content t
>>>>>>>>>> ypes part !
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>>>> ntTypeManager.java:107)
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>>>> 136)
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>>>> 
>>>>>>>>>>     at
>>>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>>>> va:63)
>>>>>>>>>>     at
>>>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>>>     at
>>>>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>>>     at
>>>>>>>>>> 
>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>>>> a:154)
>>>>>>>>>>     at java.lang.Thread.run(Thread.java:595)
>>>>>>>>>> 
>>>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
>>>>>>>>> Extracting
>>>>>>>>>> info on my local machine works fine, as well.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> View this message in context:
>>>>>> 
>>>> 
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
Java version: 1.5
Tomcat: 5.5
POI jars: C:\Tomcat\webapps\websrv\WEB-INF\lib

Including:
poi-3.6
poi-contrib-3.6
poi-ooxml-3.6
poi-scratchpad 3.6
ooxml-schemas-1.0
xmlbeans-2.3.0
dom4j-1.6.1
geronimo-stax


On Thu, Jun 10, 2010 at 11:25 AM, David Fisher <df...@jmlafferty.com>wrote:

> > Yes, this file was created using Excel 2007. The file was originally an
> > .xls, and I migrated it to .xlsx (however, I have tried uploading both
> new
> > and modified .xls files and it won't budge).
> >
> > Per request, I unzipped the .xlsx files and the reported structure is
> this:
> >
> > _rels Folder
> > docProps Folder
> > xl Folder
> > [Content_Types].xml
>
> What's in this file?
>
> > Inside the xl folder I found the following files:
> >
> > _rels Folder
> > printerSettings Folder
> > theme folder
> > worksheets folder
> > sharedStrings.xml
> > styles.xml
> > workbook.xml
> >
> > Etcetera. Truth be told, it seems the file is doing all right.
> >
> > I'll post my code (where it breaks) and see if there's something with the
> > code (although that wouldn't make sense, since it works perfectly fine in
> > this machine -- with both .xls and .xlsx files).
>
> What versions of Java are you running where it works?
>
> What version of Tomcat does your server use? Where are the POI jars in your
> Tomcat installation?
>
> Regards,
> Dave
>
>
> >
> > public void loadFile(File oFileToLoad) throws FileNotFoundException,
> > LoaderException, ValidationException {
> >        Workbook oWorkgroup;
> >
> >        m_oFileName = oFileToLoad;
> >        try {
> >         //LOG.Log("ExcelFile - Loading file name: " +
> > m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
> >         m_oIn = new FileInputStream(m_oFileName);
> >
> >
> >            oWorkgroup = WorkbookFactory.create(m_oIn);
> >
> >          if (oWorkgroup.getNumberOfSheets() == 0) {
> >              // page not found throw exception
> >              throw new LoaderException("Excel document does not contain a
> > workbook");
> >          }
> >
> >          m_oSheet = oWorkgroup.getSheetAt(0);
> >
> >          m_nTotalRows = getTotalRows();
> >
> >         //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> > LOG.LOG_TYPE_TRACE);
> >        } catch(OldExcelFormatException e){
> >         throw new ValidationException("This is an Excel 95 File, we can
> > process only Excel 97-2007. ",
> >         1, ValidationException.EXCEL_95_ERROR);
> >
> >        }catch (IOException ioe) {
> >         //LOG.LogErrors(ioe);
> >         ioe.printStackTrace();
> >         throw new LoaderException("Exception reading the excel
> document");
> >
> >        } catch (InvalidFormatException e) {
> >         // Catch created for Workbook.create method. Unspecified.
> >
> > e.printStackTrace();
> > }
> >    }
> >
> > Any thoughts?
> >
> > On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <dfisher@jmlafferty.com
> >wrote:
> >
> >> Was this file created with Excel or another application like OpenOffice?
> >> What version of that application?
> >>
> >> Try unzipping the xlsx file and reporting the structure. These OOXML
> files
> >> are really zipped up directories of xml files. I suspect that there is
> >> something in your content type that POI does not understand.
> >>
> >> Is this a file that you can share? If so, then I would suggest that you
> >> create a bugzilla entry so that a developer can take a look when they
> have
> >> time.
> >>
> >> Regards,
> >> Dave
> >>
> >> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
> >>
> >>> I've verified and the file is functional. I'm really clueless, atm.
> >>>
> >>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
> >>>
> >>>>
> >>>> Is it possible that the structure of the file is being mangled
> somehow?
> >>>> Have
> >>>> you tried to open the file using Excel after it has been ftp'd into
> the
> >>>> folder on your server?
> >>>>
> >>>> Yours
> >>>>
> >>>> Mark B
> >>>>
> >>>>
> >>>> Jorge Moya wrote:
> >>>>>
> >>>>> I'm sorry for spam, but I menat it breaks when it tries to extract
> the
> >>>>> info
> >>>>> from the file.
> >>>>>
> >>>>> Thanks in advance.
> >>>>>
> >>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com>
> wrote:
> >>>>>
> >>>>>> What do you mean, exactly? I'm uploading the files through an FTP
> >>>> server,
> >>>>>> and after upload I execute the validation of my app which proceed to
> >>>>>> extract
> >>>>>> the information from a designated folder, but it breaks when it
> tries
> >> to
> >>>>>> upload the file with mentioned errors.
> >>>>>>
> >>>>>>
> >>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>>>> <df...@jmlafferty.com>wrote:
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> You should write the uploaded file to your temporary file and then
> >> read
> >>>>>>> it
> >>>>>>> in.
> >>>>>>>
> >>>>>>> OOXML files are zip files and are not accessed non-serailly. The
> user
> >>>>>>> might stop transfer or the network connection might break.
> >>>>>>>
> >>>>>>> Regards,
> >>>>>>> Dave
> >>>>>>>
> >>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>>>
> >>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx
> document
> >>>>>>> using
> >>>>>>>> POI API and the ss.usermodel (using an app I made), however when I
> >>>>>>> tried
> >>>>>>> to
> >>>>>>>> upload the file to the server, it returned me these errors on the
> >>>>>>> server's
> >>>>>>>> tomcat console:
> >>>>>>>>
> >>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
> >>>> read
> >>>>>>>> content t
> >>>>>>>> ypes part !
> >>>>>>>>      at
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>>>> ntTypeManager.java:107)
> >>>>>>>>      at
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>>>> pContentTypeManager.java:56)
> >>>>>>>>      at
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>>>> 136)
> >>>>>>>>      at
> >>>>>>>>
> >> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>>>
> >>>>>>>>      at
> >>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>>>      at
> >>>>>>>>
> >> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>>>> va:63)
> >>>>>>>>      at
> >>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>>>      at
> >>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>>>      at
> >>>>>>>>
> >> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>>>> a:154)
> >>>>>>>>      at java.lang.Thread.run(Thread.java:595)
> >>>>>>>>
> >>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
> >>>>>>> Extracting
> >>>>>>>> info on my local machine works fine, as well.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>>
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >>>> Sent from the POI - User mailing list archive at Nabble.com.
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
> Yes, this file was created using Excel 2007. The file was originally an
> .xls, and I migrated it to .xlsx (however, I have tried uploading both new
> and modified .xls files and it won't budge).
> 
> Per request, I unzipped the .xlsx files and the reported structure is this:
> 
> _rels Folder
> docProps Folder
> xl Folder
> [Content_Types].xml

What's in this file?

> Inside the xl folder I found the following files:
> 
> _rels Folder
> printerSettings Folder
> theme folder
> worksheets folder
> sharedStrings.xml
> styles.xml
> workbook.xml
> 
> Etcetera. Truth be told, it seems the file is doing all right.
> 
> I'll post my code (where it breaks) and see if there's something with the
> code (although that wouldn't make sense, since it works perfectly fine in
> this machine -- with both .xls and .xlsx files).

What versions of Java are you running where it works?

What version of Tomcat does your server use? Where are the POI jars in your Tomcat installation?

Regards,
Dave


> 
> public void loadFile(File oFileToLoad) throws FileNotFoundException,
> LoaderException, ValidationException {
>        Workbook oWorkgroup;
> 
>        m_oFileName = oFileToLoad;
>        try {
>         //LOG.Log("ExcelFile - Loading file name: " +
> m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
>         m_oIn = new FileInputStream(m_oFileName);
> 
> 
>            oWorkgroup = WorkbookFactory.create(m_oIn);
> 
>          if (oWorkgroup.getNumberOfSheets() == 0) {
>              // page not found throw exception
>              throw new LoaderException("Excel document does not contain a
> workbook");
>          }
> 
>          m_oSheet = oWorkgroup.getSheetAt(0);
> 
>          m_nTotalRows = getTotalRows();
> 
>         //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
> LOG.LOG_TYPE_TRACE);
>        } catch(OldExcelFormatException e){
>         throw new ValidationException("This is an Excel 95 File, we can
> process only Excel 97-2007. ",
>         1, ValidationException.EXCEL_95_ERROR);
> 
>        }catch (IOException ioe) {
>         //LOG.LogErrors(ioe);
>         ioe.printStackTrace();
>         throw new LoaderException("Exception reading the excel document");
> 
>        } catch (InvalidFormatException e) {
>         // Catch created for Workbook.create method. Unspecified.
> 
> e.printStackTrace();
> }
>    }
> 
> Any thoughts?
> 
> On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <df...@jmlafferty.com>wrote:
> 
>> Was this file created with Excel or another application like OpenOffice?
>> What version of that application?
>> 
>> Try unzipping the xlsx file and reporting the structure. These OOXML files
>> are really zipped up directories of xml files. I suspect that there is
>> something in your content type that POI does not understand.
>> 
>> Is this a file that you can share? If so, then I would suggest that you
>> create a bugzilla entry so that a developer can take a look when they have
>> time.
>> 
>> Regards,
>> Dave
>> 
>> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>> 
>>> I've verified and the file is functional. I'm really clueless, atm.
>>> 
>>> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
>>> 
>>>> 
>>>> Is it possible that the structure of the file is being mangled somehow?
>>>> Have
>>>> you tried to open the file using Excel after it has been ftp'd into the
>>>> folder on your server?
>>>> 
>>>> Yours
>>>> 
>>>> Mark B
>>>> 
>>>> 
>>>> Jorge Moya wrote:
>>>>> 
>>>>> I'm sorry for spam, but I menat it breaks when it tries to extract the
>>>>> info
>>>>> from the file.
>>>>> 
>>>>> Thanks in advance.
>>>>> 
>>>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
>>>>> 
>>>>>> What do you mean, exactly? I'm uploading the files through an FTP
>>>> server,
>>>>>> and after upload I execute the validation of my app which proceed to
>>>>>> extract
>>>>>> the information from a designated folder, but it breaks when it tries
>> to
>>>>>> upload the file with mentioned errors.
>>>>>> 
>>>>>> 
>>>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>>>> <df...@jmlafferty.com>wrote:
>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> You should write the uploaded file to your temporary file and then
>> read
>>>>>>> it
>>>>>>> in.
>>>>>>> 
>>>>>>> OOXML files are zip files and are not accessed non-serailly. The user
>>>>>>> might stop transfer or the network connection might break.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Dave
>>>>>>> 
>>>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>>>> 
>>>>>>>> Ok guys, I'm trying to extract the information of an .xlsx document
>>>>>>> using
>>>>>>>> POI API and the ss.usermodel (using an app I made), however when I
>>>>>>> tried
>>>>>>> to
>>>>>>>> upload the file to the server, it returned me these errors on the
>>>>>>> server's
>>>>>>>> tomcat console:
>>>>>>>> 
>>>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
>>>> read
>>>>>>>> content t
>>>>>>>> ypes part !
>>>>>>>>      at
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>>>> ntTypeManager.java:107)
>>>>>>>>      at
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>>>> pContentTypeManager.java:56)
>>>>>>>>      at
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>>>> 136)
>>>>>>>>      at
>>>>>>>> 
>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>>>> 
>>>>>>>>      at
>>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>>>      at
>>>>>>>> 
>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>>>> va:63)
>>>>>>>>      at
>>>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>>>      at
>>>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>>>      at
>>>>>>>> 
>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>>>> a:154)
>>>>>>>>      at java.lang.Thread.run(Thread.java:595)
>>>>>>>> 
>>>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
>>>>>>> Extracting
>>>>>>>> info on my local machine works fine, as well.
>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> View this message in context:
>>>> 
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>>>> Sent from the POI - User mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
Yes, this file was created using Excel 2007. The file was originally an
.xls, and I migrated it to .xlsx (however, I have tried uploading both new
and modified .xls files and it won't budge).

Per request, I unzipped the .xlsx files and the reported structure is this:

_rels Folder
docProps Folder
xl Folder
[Content_Types].xml

Inside the xl folder I found the following files:

_rels Folder
printerSettings Folder
theme folder
worksheets folder
sharedStrings.xml
styles.xml
workbook.xml

Etcetera. Truth be told, it seems the file is doing all right.

I'll post my code (where it breaks) and see if there's something with the
code (although that wouldn't make sense, since it works perfectly fine in
this machine -- with both .xls and .xlsx files).

public void loadFile(File oFileToLoad) throws FileNotFoundException,
LoaderException, ValidationException {
        Workbook oWorkgroup;

        m_oFileName = oFileToLoad;
        try {
         //LOG.Log("ExcelFile - Loading file name: " +
m_oFileName.getPath(), LOG.LOG_TYPE_TRACE);
         m_oIn = new FileInputStream(m_oFileName);


            oWorkgroup = WorkbookFactory.create(m_oIn);

          if (oWorkgroup.getNumberOfSheets() == 0) {
              // page not found throw exception
              throw new LoaderException("Excel document does not contain a
workbook");
          }

          m_oSheet = oWorkgroup.getSheetAt(0);

          m_nTotalRows = getTotalRows();

         //LOG.Log("ExcelFile - Total Rows: " + m_nTotalRows,
LOG.LOG_TYPE_TRACE);
        } catch(OldExcelFormatException e){
         throw new ValidationException("This is an Excel 95 File, we can
process only Excel 97-2007. ",
         1, ValidationException.EXCEL_95_ERROR);

        }catch (IOException ioe) {
         //LOG.LogErrors(ioe);
         ioe.printStackTrace();
         throw new LoaderException("Exception reading the excel document");

        } catch (InvalidFormatException e) {
         // Catch created for Workbook.create method. Unspecified.

e.printStackTrace();
}
    }

Any thoughts?

On Thu, Jun 10, 2010 at 10:09 AM, David Fisher <df...@jmlafferty.com>wrote:

> Was this file created with Excel or another application like OpenOffice?
> What version of that application?
>
> Try unzipping the xlsx file and reporting the structure. These OOXML files
> are really zipped up directories of xml files. I suspect that there is
> something in your content type that POI does not understand.
>
> Is this a file that you can share? If so, then I would suggest that you
> create a bugzilla entry so that a developer can take a look when they have
> time.
>
> Regards,
> Dave
>
> On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:
>
> > I've verified and the file is functional. I'm really clueless, atm.
> >
> > On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
> >
> >>
> >> Is it possible that the structure of the file is being mangled somehow?
> >> Have
> >> you tried to open the file using Excel after it has been ftp'd into the
> >> folder on your server?
> >>
> >> Yours
> >>
> >> Mark B
> >>
> >>
> >> Jorge Moya wrote:
> >>>
> >>> I'm sorry for spam, but I menat it breaks when it tries to extract the
> >>> info
> >>> from the file.
> >>>
> >>> Thanks in advance.
> >>>
> >>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
> >>>
> >>>> What do you mean, exactly? I'm uploading the files through an FTP
> >> server,
> >>>> and after upload I execute the validation of my app which proceed to
> >>>> extract
> >>>> the information from a designated folder, but it breaks when it tries
> to
> >>>> upload the file with mentioned errors.
> >>>>
> >>>>
> >>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >>>> <df...@jmlafferty.com>wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> You should write the uploaded file to your temporary file and then
> read
> >>>>> it
> >>>>> in.
> >>>>>
> >>>>> OOXML files are zip files and are not accessed non-serailly. The user
> >>>>> might stop transfer or the network connection might break.
> >>>>>
> >>>>> Regards,
> >>>>> Dave
> >>>>>
> >>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>>>
> >>>>>> Ok guys, I'm trying to extract the information of an .xlsx document
> >>>>> using
> >>>>>> POI API and the ss.usermodel (using an app I made), however when I
> >>>>> tried
> >>>>> to
> >>>>>> upload the file to the server, it returned me these errors on the
> >>>>> server's
> >>>>>> tomcat console:
> >>>>>>
> >>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
> >> read
> >>>>>> content t
> >>>>>> ypes part !
> >>>>>>       at
> >>>>>>
> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>>>>> ntTypeManager.java:107)
> >>>>>>       at
> >>>>>>
> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>>>>> pContentTypeManager.java:56)
> >>>>>>       at
> >>>>>>
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>>>>> 136)
> >>>>>>       at
> >>>>>>
> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>>>>>
> >>>>>>       at
> >>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>>>>>       at
> >>>>>>
> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>>>>> va:63)
> >>>>>>       at
> >> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>>>>>       at
> >>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>>>>>       at
> >>>>>>
> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>>>>> a:154)
> >>>>>>       at java.lang.Thread.run(Thread.java:595)
> >>>>>>
> >>>>>> Any idea of what's happening? Uploading .XLS files work fine.
> >>>>> Extracting
> >>>>>> info on my local machine works fine, as well.
> >>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>>>> For additional commands, e-mail: user-help@poi.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> >> Sent from the POI - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >> For additional commands, e-mail: user-help@poi.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
Was this file created with Excel or another application like OpenOffice? What version of that application?

Try unzipping the xlsx file and reporting the structure. These OOXML files are really zipped up directories of xml files. I suspect that there is something in your content type that POI does not understand.

Is this a file that you can share? If so, then I would suggest that you create a bugzilla entry so that a developer can take a look when they have time.

Regards,
Dave

On Jun 10, 2010, at 7:34 AM, Jorge Moya wrote:

> I've verified and the file is functional. I'm really clueless, atm.
> 
> On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:
> 
>> 
>> Is it possible that the structure of the file is being mangled somehow?
>> Have
>> you tried to open the file using Excel after it has been ftp'd into the
>> folder on your server?
>> 
>> Yours
>> 
>> Mark B
>> 
>> 
>> Jorge Moya wrote:
>>> 
>>> I'm sorry for spam, but I menat it breaks when it tries to extract the
>>> info
>>> from the file.
>>> 
>>> Thanks in advance.
>>> 
>>> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
>>> 
>>>> What do you mean, exactly? I'm uploading the files through an FTP
>> server,
>>>> and after upload I execute the validation of my app which proceed to
>>>> extract
>>>> the information from a designated folder, but it breaks when it tries to
>>>> upload the file with mentioned errors.
>>>> 
>>>> 
>>>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>>>> <df...@jmlafferty.com>wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> You should write the uploaded file to your temporary file and then read
>>>>> it
>>>>> in.
>>>>> 
>>>>> OOXML files are zip files and are not accessed non-serailly. The user
>>>>> might stop transfer or the network connection might break.
>>>>> 
>>>>> Regards,
>>>>> Dave
>>>>> 
>>>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>>> 
>>>>>> Ok guys, I'm trying to extract the information of an .xlsx document
>>>>> using
>>>>>> POI API and the ss.usermodel (using an app I made), however when I
>>>>> tried
>>>>> to
>>>>>> upload the file to the server, it returned me these errors on the
>>>>> server's
>>>>>> tomcat console:
>>>>>> 
>>>>>> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
>> read
>>>>>> content t
>>>>>> ypes part !
>>>>>>       at
>>>>>> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>>>>> ntTypeManager.java:107)
>>>>>>       at
>>>>>> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>>>>> pContentTypeManager.java:56)
>>>>>>       at
>>>>>> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>>>>> 136)
>>>>>>       at
>>>>>> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>>>>> 
>>>>>>       at
>>>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>>>>>       at
>>>>>> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>>>>> va:63)
>>>>>>       at
>> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>>>>>       at
>>>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>>>>>       at
>>>>>> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>>>>> a:154)
>>>>>>       at java.lang.Thread.run(Thread.java:595)
>>>>>> 
>>>>>> Any idea of what's happening? Uploading .XLS files work fine.
>>>>> Extracting
>>>>>> info on my local machine works fine, as well.
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>>>> For additional commands, e-mail: user-help@poi.apache.org
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
>> --
>> View this message in context:
>> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
>> Sent from the POI - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
I've verified and the file is functional. I'm really clueless, atm.

On Thu, Jun 10, 2010 at 1:53 AM, MSB <ma...@tiscali.co.uk> wrote:

>
> Is it possible that the structure of the file is being mangled somehow?
> Have
> you tried to open the file using Excel after it has been ftp'd into the
> folder on your server?
>
> Yours
>
> Mark B
>
>
> Jorge Moya wrote:
> >
> > I'm sorry for spam, but I menat it breaks when it tries to extract the
> > info
> > from the file.
> >
> > Thanks in advance.
> >
> > On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
> >
> >> What do you mean, exactly? I'm uploading the files through an FTP
> server,
> >> and after upload I execute the validation of my app which proceed to
> >> extract
> >> the information from a designated folder, but it breaks when it tries to
> >> upload the file with mentioned errors.
> >>
> >>
> >> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
> >> <df...@jmlafferty.com>wrote:
> >>
> >>> Hi,
> >>>
> >>> You should write the uploaded file to your temporary file and then read
> >>> it
> >>> in.
> >>>
> >>> OOXML files are zip files and are not accessed non-serailly. The user
> >>> might stop transfer or the network connection might break.
> >>>
> >>> Regards,
> >>> Dave
> >>>
> >>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
> >>>
> >>> > Ok guys, I'm trying to extract the information of an .xlsx document
> >>> using
> >>> > POI API and the ss.usermodel (using an app I made), however when I
> >>> tried
> >>> to
> >>> > upload the file to the server, it returned me these errors on the
> >>> server's
> >>> > tomcat console:
> >>> >
> >>> > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't
> read
> >>> > content t
> >>> > ypes part !
> >>> >        at
> >>> > org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> >>> > ntTypeManager.java:107)
> >>> >        at
> >>> > org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> >>> > pContentTypeManager.java:56)
> >>> >        at
> >>> > org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> >>> > 136)
> >>> >        at
> >>> > org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >>> >
> >>> >        at
> >>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >>> >        at
> >>> > org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> >>> > va:63)
> >>> >        at
> com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >>> >        at
> >>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >>> >        at
> >>> > com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> >>> > a:154)
> >>> >        at java.lang.Thread.run(Thread.java:595)
> >>> >
> >>> > Any idea of what's happening? Uploading .XLS files work fine.
> >>> Extracting
> >>> > info on my local machine works fine, as well.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> >>> For additional commands, e-mail: user-help@poi.apache.org
> >>>
> >>>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by MSB <ma...@tiscali.co.uk>.
Is it possible that the structure of the file is being mangled somehow? Have
you tried to open the file using Excel after it has been ftp'd into the
folder on your server?

Yours

Mark B


Jorge Moya wrote:
> 
> I'm sorry for spam, but I menat it breaks when it tries to extract the
> info
> from the file.
> 
> Thanks in advance.
> 
> On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:
> 
>> What do you mean, exactly? I'm uploading the files through an FTP server,
>> and after upload I execute the validation of my app which proceed to
>> extract
>> the information from a designated folder, but it breaks when it tries to
>> upload the file with mentioned errors.
>>
>>
>> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher
>> <df...@jmlafferty.com>wrote:
>>
>>> Hi,
>>>
>>> You should write the uploaded file to your temporary file and then read
>>> it
>>> in.
>>>
>>> OOXML files are zip files and are not accessed non-serailly. The user
>>> might stop transfer or the network connection might break.
>>>
>>> Regards,
>>> Dave
>>>
>>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>>
>>> > Ok guys, I'm trying to extract the information of an .xlsx document
>>> using
>>> > POI API and the ss.usermodel (using an app I made), however when I
>>> tried
>>> to
>>> > upload the file to the server, it returned me these errors on the
>>> server's
>>> > tomcat console:
>>> >
>>> > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read
>>> > content t
>>> > ypes part !
>>> >        at
>>> > org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>>> > ntTypeManager.java:107)
>>> >        at
>>> > org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>>> > pContentTypeManager.java:56)
>>> >        at
>>> > org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>>> > 136)
>>> >        at
>>> > org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>>> >
>>> >        at
>>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>>> >        at
>>> > org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>>> > va:63)
>>> >        at com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>>> >        at
>>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>>> >        at
>>> > com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>>> > a:154)
>>> >        at java.lang.Thread.run(Thread.java:595)
>>> >
>>> > Any idea of what's happening? Uploading .XLS files work fine.
>>> Extracting
>>> > info on my local machine works fine, as well.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>>> For additional commands, e-mail: user-help@poi.apache.org
>>>
>>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/openxml4j-InvalidFormatException-tp28820283p28839434.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
I'm sorry for spam, but I menat it breaks when it tries to extract the info
from the file.

Thanks in advance.

On Wed, Jun 9, 2010 at 10:43 AM, Jorge Moya <jo...@gmail.com> wrote:

> What do you mean, exactly? I'm uploading the files through an FTP server,
> and after upload I execute the validation of my app which proceed to extract
> the information from a designated folder, but it breaks when it tries to
> upload the file with mentioned errors.
>
>
> On Tue, Jun 8, 2010 at 3:04 PM, David Fisher <df...@jmlafferty.com>wrote:
>
>> Hi,
>>
>> You should write the uploaded file to your temporary file and then read it
>> in.
>>
>> OOXML files are zip files and are not accessed non-serailly. The user
>> might stop transfer or the network connection might break.
>>
>> Regards,
>> Dave
>>
>> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>>
>> > Ok guys, I'm trying to extract the information of an .xlsx document
>> using
>> > POI API and the ss.usermodel (using an app I made), however when I tried
>> to
>> > upload the file to the server, it returned me these errors on the
>> server's
>> > tomcat console:
>> >
>> > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read
>> > content t
>> > ypes part !
>> >        at
>> > org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
>> > ntTypeManager.java:107)
>> >        at
>> > org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
>> > pContentTypeManager.java:56)
>> >        at
>> > org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
>> > 136)
>> >        at
>> > org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
>> >
>> >        at
>> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>> >        at
>> > org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
>> > va:63)
>> >        at com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>> >        at
>> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>> >        at
>> > com.msights.core.validation.ValidationModule.run(ValidationModule.jav
>> > a:154)
>> >        at java.lang.Thread.run(Thread.java:595)
>> >
>> > Any idea of what's happening? Uploading .XLS files work fine. Extracting
>> > info on my local machine works fine, as well.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>

Re: openxml4j InvalidFormatException

Posted by Jorge Moya <jo...@gmail.com>.
What do you mean, exactly? I'm uploading the files through an FTP server,
and after upload I execute the validation of my app which proceed to extract
the information from a designated folder, but it breaks when it tries to
upload the file with mentioned errors.

On Tue, Jun 8, 2010 at 3:04 PM, David Fisher <df...@jmlafferty.com> wrote:

> Hi,
>
> You should write the uploaded file to your temporary file and then read it
> in.
>
> OOXML files are zip files and are not accessed non-serailly. The user might
> stop transfer or the network connection might break.
>
> Regards,
> Dave
>
> On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:
>
> > Ok guys, I'm trying to extract the information of an .xlsx document using
> > POI API and the ss.usermodel (using an app I made), however when I tried
> to
> > upload the file to the server, it returned me these errors on the
> server's
> > tomcat console:
> >
> > org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read
> > content t
> > ypes part !
> >        at
> > org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> > ntTypeManager.java:107)
> >        at
> > org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> > pContentTypeManager.java:56)
> >        at
> > org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> > 136)
> >        at
> > org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> >
> >        at
> org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
> >        at
> > org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> > va:63)
> >        at com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
> >        at
> com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
> >        at
> > com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> > a:154)
> >        at java.lang.Thread.run(Thread.java:595)
> >
> > Any idea of what's happening? Uploading .XLS files work fine. Extracting
> > info on my local machine works fine, as well.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: openxml4j InvalidFormatException

Posted by David Fisher <df...@jmlafferty.com>.
Hi,

You should write the uploaded file to your temporary file and then read it in. 

OOXML files are zip files and are not accessed non-serailly. The user might stop transfer or the network connection might break.

Regards,
Dave

On Jun 8, 2010, at 9:37 AM, Jorge Moya wrote:

> Ok guys, I'm trying to extract the information of an .xlsx document using
> POI API and the ss.usermodel (using an app I made), however when I tried to
> upload the file to the server, it returned me these errors on the server's
> tomcat console:
> 
> org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read
> content t
> ypes part !
>        at
> org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(Conte
> ntTypeManager.java:107)
>        at
> org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(Zi
> pContentTypeManager.java:56)
>        at
> org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
> 136)
>        at
> org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:585)
> 
>        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
>        at
> org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.ja
> va:63)
>        at com.msights.core.utils.ExcelFile.loadFile(ExcelFile.java:84)
>        at com.msights.core.utils.GroupLoader.loadFiles(GroupLoader.java:50)
>        at
> com.msights.core.validation.ValidationModule.run(ValidationModule.jav
> a:154)
>        at java.lang.Thread.run(Thread.java:595)
> 
> Any idea of what's happening? Uploading .XLS files work fine. Extracting
> info on my local machine works fine, as well.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: openxml4j InvalidFormatException

Posted by venkat sunil m <su...@yahoo.co.in>.
@ Venkat Sunil M
XLSX EXCEPTION
I hope many people are looking for a solution for the
"InvalidFormatException", here we go.

fileInputStream = new FileInputStream(fileName);
OPCPackage opcPackage = OPCPackage.open(fileName);
XSSFWorkbook xssfWorkBook = new XSSFWorkbook(opcPackage);

If you getting "InvalidFormatException", create an instance for OPCPackage
like shown above and pass it. It works.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/openxml4j-InvalidFormatException-tp2307028p5712871.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org