发现没有可行的替代方案 - Java Maven项目中的Ruta

时间:2016-12-23 12:53:59

标签: java maven uima ruta

以下脚本在Ruta工作台中运行正常。然而,当我在触发Ruta脚本的现有Java Maven项目中包含相同内容时,我得到“找不到可行的替代”异常。为什么会这样?如何解决这种异常?

脚本:

    CssDefinition{->onlyClass=false, family = CssDefinition.fontfamily, size = CssDefinition.fontsize, color = CssDefinition.fontcolor}
        <-{CssStyles{PARSE(cssStylesStr),IF(contains(cssStylesStr,tagClass))};};

堆栈跟踪:

Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.bool.BooleanOperationsExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.StringOperationsExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.OnlyFirstBlockExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.OnlyOnceBlockExtension
Jan 10, 2017 5:05:09 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.fst.FSTBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.bool.BooleanOperationsExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.string.StringOperationsExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.OnlyFirstBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.OnlyOnceBlockExtension
Jan 10, 2017 5:05:10 PM org.apache.uima.ruta.engine.RutaEngine initializeExtensionWithClassPath(618)
WARNING: Failed to initialze extension org.apache.uima.ruta.block.fst.FSTBlockExtension
Jan 10, 2017 5:05:12 PM org.apache.uima.ruta.engine.HtmlConverter mapAnnotations(454)
WARNING: illegal annotation offset mapping
Jan 10, 2017 5:05:12 PM org.apache.uima.ruta.engine.HtmlConverter mapAnnotations(454)
WARNING: illegal annotation offset mapping

org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "org.apache.uima.ruta.engine.RutaEngine" failed.  (Descriptor: file:/home/Documents/Ruta/TestEngine.xml)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:254)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:158)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:354)
at org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:208)
at com.pagemajik.explico.stylekit.ArtifactAnnotator.runScript(ArtifactAnnotator.java:322)
at com.pagemajik.explico.stylekit.ArtifactAnnotator.getAllAnnotations(ArtifactAnnotator.java:88)
at com.pagemajik.explico.stylekit.MainFormatter.format(MainFormatter.java:105)
at com.pagemajik.explico.stylekit.Test.main(Test.java:29)
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.file_input(RutaParser.java:733)
at org.apache.uima.ruta.engine.RutaEngine.loadScript(RutaEngine.java:988)
at org.apache.uima.ruta.engine.RutaEngine.initializeScript(RutaEngine.java:704)
at org.apache.uima.ruta.engine.RutaEngine.initialize(RutaEngine.java:465)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)
... 10 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.statements(RutaParser.java:832)
at org.apache.uima.ruta.parser.RutaParser.file_input(RutaParser.java:719)
... 14 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.statement(RutaParser.java:1055)
at org.apache.uima.ruta.parser.RutaParser.statements(RutaParser.java:811)
... 15 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.forEachDeclaration(RutaParser.java:3124)
at org.apache.uima.ruta.parser.RutaParser.statement(RutaParser.java:1027)
... 16 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.statements(RutaParser.java:832)
at org.apache.uima.ruta.parser.RutaParser.forEachDeclaration(RutaParser.java:3104)
... 17 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.statement(RutaParser.java:1055)
at org.apache.uima.ruta.parser.RutaParser.statements(RutaParser.java:811)
... 18 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.simpleStatement(RutaParser.java:3450)
at org.apache.uima.ruta.parser.RutaParser.statement(RutaParser.java:1007)
... 19 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.ruleElementsRoot(RutaParser.java:3980)
at org.apache.uima.ruta.parser.RutaParser.simpleStatement(RutaParser.java:3434)
... 20 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.ruleElement(RutaParser.java:4340)
at org.apache.uima.ruta.parser.RutaParser.ruleElementsRoot(RutaParser.java:3923)
... 21 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.simpleStatement(RutaParser.java:3450)
at org.apache.uima.ruta.parser.RutaParser.ruleElement(RutaParser.java:4253)
... 22 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.ruleElementsRoot(RutaParser.java:3980)
at org.apache.uima.ruta.parser.RutaParser.simpleStatement(RutaParser.java:3434)
... 23 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.ruleElement(RutaParser.java:4340)
at org.apache.uima.ruta.parser.RutaParser.ruleElementsRoot(RutaParser.java:3923)
... 24 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.ruleElementType(RutaParser.java:4906)
at org.apache.uima.ruta.parser.RutaParser.ruleElement(RutaParser.java:4178)
... 25 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.conditions(RutaParser.java:5225)
at org.apache.uima.ruta.parser.RutaParser.ruleElementType(RutaParser.java:4852)
... 26 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.condition(RutaParser.java:8663)
at org.apache.uima.ruta.parser.RutaParser.conditions(RutaParser.java:5204)
... 27 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:397)
at org.apache.uima.ruta.parser.RutaParser.conditionIf(RutaParser.java:10386)
at org.apache.uima.ruta.parser.RutaParser.condition(RutaParser.java:8526)
... 28 more
Caused by: org.apache.uima.ruta.extensions.RutaParseRuntimeException: Error in Dazzle_ChapRef_Updated,  line 3499, "(": found no viable alternative
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:362)
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:376)
at org.apache.uima.ruta.parser.RutaParser.booleanExpression(RutaParser.java:20012)
at org.apache.uima.ruta.parser.RutaParser.conditionIf(RutaParser.java:10372)
... 29 more

PS: 我已经遇到过与其他一些脚本相同的场景。

1 个答案:

答案 0 :(得分:1)

解析异常是由结合项目设置的分析引擎配置引起的。引擎无法初始化扩展包含contains字符串函数:

WARNING: Failed to initialze extension org.apache.uima.ruta.string.StringOperationsExtension

因此,解析器无法将部分IF(contains(cssStylesStr,tagClass))标识为正确的条件,因为contains不是布尔变量或其他允许的构造。假设它是允许的,那么对于下一个(,没有可行的替代方案。

这个问题最有可能通过在类路径中添加ruta-core-ext来解决。