uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: ClassLoader problems when using PEAR files
Date Wed, 26 Sep 2012 22:57:07 GMT
Hi Greg,

Did you try troubleshooting this using the "Tip" in the Javadocs for the
DocumentBuilderFactory class (add -Djaxp.debug=1 to the "java" command line)? 

-Marshall

On 9/24/2012 6:46 PM, Greg Holmberg wrote:
> Hi UIMA users-- 
>
>
> When I use PEAR files, the XML parser can't find it's DocumentBuilderFactory. I think
it's a ClassLoader issue. Has anyone else seen this? 
>
> I install the PEAR as described in the docs: 
>
>     PackageBrowser pkg = PackageInstaller.installPackage(myDir, pearFile, false); 
>
>     String pearDescPath = pkg.getComponentPearDescPath(); 
>
>     ResourceSpecifier specifier = 
>         UIMAFramework.getXMLParser().parseResourceSpecifier( 
>             new XMLInputSource(pearDescPath)); 
>
>     ResourceManager resmgr = getResourceManager(); 
>
>     AnalysisEngine engine = UIMAFramework.produceAnalysisEngine(specifier, resmgr, params);

>
> My PEAR includes TikaAnnotator, and I get the exception shown at the end of this email.
Summary: TikaConfig asks for an XML parser, but the system can't find one. 
>
> Outside the analysis engine, it's possible to find an implementation of DocumentBuilderFactory,
but inside it seems that the ClassLoader in use doesn't have one. 
>
> javax.xml.parsers.DocumentBuilderFactory.newInstance() has a complicated way of finding
the implementation (quoting the JavaDoc):
>
> =======================
>
>     Obtain a new instance of a DocumentBuilderFactory. This static method creates a new
factory instance. This method
>     uses the following ordered lookup procedure to determine the DocumentBuilderFactory
implementation class to load:
>
>     * Use the javax.xml.parsers.DocumentBuilderFactory system property.
>     * Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration
file is in standard java.util.Properties format and contains the fully qualified name of the
implementation class with the key being the system property defined above. The jaxp.properties
file is read only once by the JAXP implementation and it's values are then cached for future
use. If the file does not exist when the first attempt is made to read from it, no further
attempts are made to check for its existence. It is not possible to change the value of any
property in jaxp.properties after it has been read for the first time.
>     *  Use the Services API (as detailed in the JAR specification), if available, to
determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.parsers.DocumentBuilderFactory
in jars available to the runtime.
>     * Platform default DocumentBuilderFactory instance.
>
> =========================
>
> So it seems like the ClassLoader used in the analysis engine prevents DocumentBuilderFactory
from finding even the platform default implementation.
>
> Does anyone know how to work around this?  Add something to my metadata/install.xml file
perhaps?
>
> Thanks,
>
>
> Greg Holmberg
>
>
>
> org.apache.uima.resource.ResourceInitializationException: Error initializing "org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper"
from descriptor file:/tmp/taservice/pear/SAPAnalysisEngine/SAPAnalysisEngine_pear.xml. 
> at org.apache.uima.util.SimpleResourceFactory.produceResource(SimpleResourceFactory.java:144)

> 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.produceResource(UIMAFramework.java:314) 
> at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:425) 
> at com.sap.taservice.controller.UimaPipeline.createAnalysisEngine(UimaPipeline.java:343)

> at com.sap.taservice.controller.UimaPipeline.execute(UimaPipeline.java:151) 
> at com.sap.taservice.controller.TAServiceWork.execute(TAServiceWork.java:44) 
> at com.sap.job.impl.TaskImpl.execute(TaskImpl.java:104) 
> at com.sap.taservice.job.impl.remote.RemoteWorker.iteration(RemoteWorker.java:52) 
> at com.sap.util.DaemonRunnable.run(DaemonRunnable.java:117) 
> at java.lang.Thread.run(Thread.java:662) 
> Caused by: javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.DocumentBuilderFactory
cannot be found 
> at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source) 
> at org.apache.tika.config.TikaConfig.getBuilder(TikaConfig.java:228) 
> at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:66) 
> at org.apache.uima.tika.MarkupAnnotator.initialize(MarkupAnnotator.java:96) 
> at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)

> 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:387) 
> at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:255) 
> at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:429)

> at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:373)

> at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:186)

> 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.internal.util.ResourcePool.fillPool(ResourcePool.java:243) 
> at org.apache.uima.internal.util.ResourcePool.<init>(ResourcePool.java:100) 
> at org.apache.uima.internal.util.AnalysisEnginePool.<init>(AnalysisEnginePool.java:91)

> at org.apache.uima.analysis_engine.impl.MultiprocessingAnalysisEngine_impl.initialize(MultiprocessingAnalysisEngine_impl.java:118)

> 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.produceResource(UIMAFramework.java:314) 
> at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:425) 
> at org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.initialize(PearAnalysisEngineWrapper.java:269)

> at org.apache.uima.util.SimpleResourceFactory.produceResource(SimpleResourceFactory.java:123)

> ... 11 more 
>
>


Mime
View raw message