biff exception: unrecognizedOLE - excel

Just trying to read from an ordinary excel file which I craeted using microsoft excel starter 2010 and saved as an excel 97-2003 file because I originally thought the exception was due to the file format. Apparently this exception means there is something embedded in the file that cannot be read, but for the life of me I dont know how or why that is. It's just a simple excel file I typed out myself. The stacktrace is as follows:
[CDATA[jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at test.ExcelClass.updateTestResultsSpreadsheet(ExcelClass.java:1707)
at test.Internal_TestSuite.afterSuite(Internal_Virgin_TestSuite.java:846)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:543)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:212)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:309)
at org.testng.SuiteRunner.run(SuiteRunner.java:241)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1169)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1094)
at org.testng.TestNG.run(TestNG.java:1006)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:107)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:199)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:170)
]]>
I have used similar files without this exception being thrown. Any ideas?? Thanks in advance!
UPDATE: I solved the problem by removing another MS excel starter 2010 (.xlsx) file I was using elsewhere in my testNG class and making it a .xls file. It appears the stacktrace was not pointing at the correct location of the problem? Or at least it didn't change when I removed the first file? Anyway it's fixed, the JExcel api isn't compatible with other excel formats.

Related

Reading XLSB file - Apache POI

I have referred all post in stack overflow related to reading XLSB file using apache POI.
I tried many ways to read XLSB file using available links/example mentioned in post. But I am ended up in issues.
I am using latest Apache POI 3.17 and used the code mentioned in
Link :
Exception reading XLSB File Apache POI java.io.CharConversionException
Section: Post mentioned by "Gagravarr "
I am getting the following errors
The method getLocale() is undefined for the type XSSFBEventBasedExcelExtractor
The method getFormulasNotResults() is undefined for the type XSSFBEventBasedExcelExtractor
The constructor XSSFEventBasedExcelExtractor.SheetTextExtractor() is not visible
The method getIncludeSheetNames() is undefined for the type XSSFBEventBasedExcelExtractor
.......................... etc
I checked the base class "XSSFEventBasedExcelExtractor" in poi-ooxml-3.17.jar (source files) and I can able to find implementation for all the method.
I wanted to know whether this is an known issue ? Does it mean that there is no working example available to read XLSB files in Java.
I hope this query is not duplicate.
Recently, i study how to use poi to read xlsb.
If you just want to read a xlsb purely, you can use the apache test example code as the following.
https://svn.apache.org/repos/asf/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFBReader.java
In fact, xlsb use .bin file instead of .xml file.
If you want to do more thing to xlsb file, you can read this document as the following.
https://msdn.microsoft.com/en-us/library/office/cc313133(v=office.12).aspx

Issue with Excel DecisionTable to load from newClasspathResource

There is some issue with the implementation of DecisionTable in Excel file, if i am using newClasspathResource to load the excel file, where as if i use newFileResource with path of the file it works fine with the same file.
The Exception is:
Caused by: org.drools.template.parser.DecisionTableParseException: An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader.
at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:85)
at org.drools.decisiontable.SpreadsheetCompiler.parseResource(SpreadsheetCompiler.java:126)
at org.drools.decisiontable.SpreadsheetCompiler.getRuleSheetListener(SpreadsheetCompiler.java:185)
at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:172)
at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:167)
at org.drools.decisiontable.DecisionTableProviderImpl.compileResource(DecisionTableProviderImpl.java:81)
at org.drools.decisiontable.DecisionTableProviderImpl.loadFromResource(DecisionTableProviderImpl.java:44)
at org.drools.compiler.compiler.DecisionTableFactory.loadFromResource(DecisionTableFactory.java:37)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.decisionTableToPackageDescr(KnowledgeBuilderImpl.java:404)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageFromDecisionTable(KnowledgeBuilderImpl.java:374)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addKnowledgeResource(KnowledgeBuilderImpl.java:766)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:2249)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Your InputStream was neither an OLE2 stream, nor an OOXML stream
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:211)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:168)
at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:83)
... 47 more
I think i found the reason, why this was a problem. Actually with my gradle builds, i was processing and filtering some resources and realised that xls file being in resources as well, was being processed through it and somehow being changed while in compiled build path.
I skipped this file to pass through those filtering and processing via build and all is good.

Stanford CORENLP Master Keep Crashing (NullPointerException)

I downloaded the latest version of Stanford CoreNLP with the larger english model from this link
Placing the model downloaded in the same project folder, i am using "ant" / "ant jar" to build the project.
I then load the server using this command on windows:
java -d64 -mx20g -classpath "*;lib\*;liblocal\*;libsrc\*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -timeout 500000
Loading the result page from http://localhost:9000 , the server crashes when using filters such as relations, coreference.
I get the error:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
The log from server:
Some annotation fail such as:
[pool-1-thread-1] INFO edu.stanford.nlp.pipeline.MentionAnnotator - Error with building coref mention annotator!
And the main problem / exception:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.handle(StanfordCoreNLPServer.java:497)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at edu.stanford.nlp.pipeline.MentionAnnotator.annotate(MentionAnnotator.java:100)
at edu.stanford.nlp.pipeline.AnnotationPipeline.annotate(AnnotationPipeline.java:75)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.annotate(StanfordCoreNLP.java:606)
at edu.stanford.nlp.pipeline.StanfordCoreNLPServer$CoreNLPHandler.lambda$handle$344(StanfordCoreNLPServer.java:479)
at java.util.concurrent.FutureTask.run(Unknown Source)
... 3 more
Any help on what could be causing this would be much appreciated.
Thanks
What are you feeding to the library? I used to run coreNLP library in IntelliJ and Netbeans and I had an issue where if I fed a blank space (either one or more spaces, a tab or an empty blank line) I would get a null pointer exception. I had to check every sentence so they wouldn't be blank when feeding it to the coreNLP library. (I was storing each sentence as a String in a Array, so if I stored a blank string in the array and passed it to the CoreNLP library it would crash). I don't know if its your case but hope this helps.

Chainsaw log format pattern syntax

We have a log4j file that has the following pattern:
#|%d{yyyy-MM-dd HH:mm:ss.SSS}|%X{Machine}|%X{CorrelationId}|%X{Sender}|%X{Receiver}|%-5p|%X{Runtime}|%X{ClientUser}|%c|%M|%L|%m%n
I created a LogFilePatternReceiver with the following pattern:
#|TIMESTAMP|PROP(MACHINE)|PROP(CORRELATIONID)|PROP(SENDER)|PROP(RECEIVER)|LEVEL|PROP(RUNTIME)|PROP(CLIENTUSER)|CLASS|METHOD|LINE|MESSAGE
But when I start that receiver I get an error:
java.lang.IllegalArgumentException: invalid expression:
at org.apache.log4j.rule.ExpressionRule$PostFixExpressionCompiler.compileExpression(ExpressionRule.java:132)
at org.apache.log4j.rule.ExpressionRule.getRule(ExpressionRule.java:64)
at org.apache.log4j.rule.ExpressionRule.getRule(ExpressionRule.java:56)
at org.apache.log4j.varia.LogFilePatternReceiver.initialize(LogFilePatternReceiver.java:557)
at org.apache.log4j.varia.LogFilePatternReceiver$1.run(LogFilePatternReceiver.java:801)
at java.lang.Thread.run(Unknown Source)
regexp is #|(\w+-\w+-\w+ \w+:\w+:\w+.\w+)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+?)|(.+)
I don't really see where the error is? Any input? Can I use the "PROP(...)" keyword like that for columns that are non-standard?
Yes, you can use the PROP keyword for your own columns..
Can you try the latest developer snapshot of Chainsaw? It can parse your log4j.xml or log4j.properties configuration containing FileAppender entries and will build a matching Chainsaw config to process that.
Snapshot available here..the new version also has a lot of new features:
http://people.apache.org/~sdeboy
What usually trips people up is timestamp formatting and special characters, but I don't see anything weird here, so see if the latest developer snapshot helps.
Scott

WSDL to Java -client creation error

I am trying to create a web service from the WSDL but is repeatedly giving me the following error. Tried refreshing axis.jar in the build path but is still giving same error whereas I have another WSDL and client is very well being generated for the same.
Anyone here who has encountered something similar?
IWAB0399E Error in generating Java from WSDL: WSDLException (at
/definitions/types/xsd:schema): faultCode=OTHER_ERROR: An error
occurred trying to resolve schema referenced at
'#sp.schema.url#/FinancialStatement.xsd', relative to
'file:/C:/hrishi_workspace/findata/web/wsdl/FinancialStatement.wsdl'.:
This file was not found:
file:/C:/hrishi_workspace/findata/web/wsdl/#sp.schema.url#/FinancialStatement.xsd:
java.io.FileNotFoundException: This file was not found:
file:/C:/hrishi_workspace/findata/web/wsdl/#sp.schema.url#/FinancialStatement.xsd
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown
Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown
Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown
Source) at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:516)
at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
Thanks.
Rishi
It looks as if your file:/C:/hrishi_workspace/findata/web/wsdl/FinancialStatement.wsdl is making a reference to an external schema file. If you look inside that WSDL file, under the definitions/types/xsd:schema element, you'll have one or more xsd:include and/or xsd:import. These elements may have a schemaLocation attribute; look for the one that ends in FinancialStatement.xsd; I suspect it has the #sp.schema.url# in there which to me looks like a placeholder that is probably supposed to be changed by your build script or something else... Replace that with the relative path between the WSDL and XSD; if they are in the same folder, simply use the XSD file name. It should take care of the error. Once it works, you should try to understand what's with that placeholder, and maybe figure out what you need to configure in your particular environment to make it work like that...

Resources