Hi,
On our project we are currently trying to create OSGI Bundle to integrate UIMA components.
For the moment it works well but I have an instantiation problem using an aggregate AE which
reference a Vinci descriptor.
He is what i'm doing:
-- Main descriptor of the aggregate AE (X.xml) --
<?xml version="1.0" encoding="UTF-8"?>
<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>false</primitive>
<delegateAnalysisEngineSpecifiers>
<delegateAnalysisEngine key="A">
<import location="A.xml"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="B">
<import location="B.xml"/>
</delegateAnalysisEngine>
</delegateAnalysisEngineSpecifiers>
<analysisEngineMetaData>
<name>XXX</name>
<description>slmkjhsqldkjfhldfjkh</description>
<version>1.0</version>
<vendor>XXX</vendor>
<configurationParameters/>
<configurationParameterSettings/>
<flowConstraints>
<fixedFlow>
<node>B</node>
<node>A</node>
</fixedFlow>
</flowConstraints>
<typePriorities/>
<fsIndexCollection/>
<capabilities>
<capability>
<inputs/>
<outputs/>
<languagesSupported/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>false</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
<resourceManagerConfiguration/>
</taeDescription>
-- Descriptor B.xml describes a UriSpecifier --
<?xml version="1.0" encoding="UTF-8"?>
<uriSpecifier xmlns="http://uima.apache.org/resourceSpecifier">
<resourceType>AnalysisEngine</resourceType>
<uri>XXX</uri>
<protocol>Vinci</protocol>
</uriSpecifier>
Then in Java i'm using this code to instantiate the Aggregate AE (uimaComponentDescriptorPath
is the path to the main component descriptor, uima) :
ConfigurationManager configurationManager = UIMAFramework.newConfigurationManager();
try
{
// uimaComponentDescriptorPath is the path to the main component descriptor of
the aggregate (X.xml)
ResourceSpecifier uimaComponentDescription = UIMAFramework.getXMLParser().parseResourceSpecifier(new
File(uimaComponentDescriptorPath));
// uimaComponentRootPath is the path to the root directory of the aggregate AE
ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();
resourceManager.setDataPath(uimaComponentRootPath);
// Component classPath is computed using an utility function
String uimaComponentClassPath = this.buildUimaComponentClassPath(uimaComponentRootPath);
resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), uimaComponentClassPath,
true);
AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(this.uimaComponentDescription,
resourceManager, null);
}
catch (Exception e)
{
}
The line AnalysisEngine analysisEngine = UIMAFramework.produceAnalysisEngine(this.uimaComponentDescription,
resourceManager, null); throws an exception :
org.apache.uima.resource.ResourceInitializationException: The Resource Factory does not know
how to create a resource of class org.apache.uima.analysis_engine.AnalysisEngine from the
given ResourceSpecifier. (Descriptor: file:/D:/workspace_npf/component/desc/B.xml)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:261)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:352)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:243)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:413)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:361)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:183)
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:258)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:303)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:383)
So this error indicate that UIMA can't find the a ResourceFactory to create an AnalysisEngine
from a <uriSpecifier>....</uriSpecifier> descriptor.
What is the problem in the source code ? I think i've missed a step because this Aggregate
AE is working in a CPE.
Thanks,
Baptiste Gaillard
_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger !
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx
|