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 <[email protected]>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 <[email protected]> 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 <[email protected] >>> 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 <[email protected] >>>>>> 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 < >> [email protected] >>>>>>>> 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 < >>>>> [email protected] >>>>>>>>>> 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 < >>>>>>> [email protected] >>>>>>>>>>>> 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 < >> [email protected]> >>>>>>>>> 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 < >> [email protected] >>>>>> >>>>>>>>>>> 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 >>>>>>>>>>>>>>>>> <[email protected]>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: [email protected] >>>>>>>>>>>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> -- >>>>>>>>>>>>>>> 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: [email protected] >>>>>>>>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>>>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>> --------------------------------------------------------------------- >>>>>>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >> --------------------------------------------------------------------- >>>>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>> For additional commands, e-mail: [email protected] >>>>>>> >>>>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
