uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: [jira] Pear installer classloader losing UIMA ResourceManager extensions classpath
Date Tue, 14 Sep 2010 15:18:25 GMT
 The intent of Pears is to isolate the classpath they run with, from the calling

Instead of the calling environment's classpath, the annotators running from a
pear descriptor are instead using whatever classpath was specified for that pear.

This is on-purpose. The use case is to allow a pear packager to package an
annotator together with all of its required dependencies, together into the
pear, and have those dependencies used instead of what ever the calling
environment is providing.

If you don't want this feature, you can unpack / install the pear file, and then
examine its classpath information, and do the required merging with your current
environment (this is, of course, a hard problem, in general).  And then, you can
launch the annotator represented by the pear without using the pear descriptor
to specify it, but rather a plain uima descriptor specifying the unpacked annotator.

Does this make sense, or have I missed the point? -Marshall

On 9/13/2010 12:52 PM, Murphy, Sean P. wrote:
> I hope this is the correct forum for this type of discussion.  I found
> similar issues being covered here, so I thought I'd give it a try.
> Background:  I'm trying to get the same behavior from an analysis engine
> code whether run from the eclipse environment or via the pear installer
> with the CVD verification step.  This will ensure that the user has
> correctly set up the environment using the default submitted component
> AE.  
> The only way to have common code used for both environments is to
> leverage the visibility of the uima.datapath via the UimaContext during
> the initialize method.  Apparently, the CLASSPATH set in the pear
> install.xml for the project isn't available as far as I can tell, so it
> is necessary to use the 'aContext.getDatapath' to set the extension
> class path used by the ResourceManager (ResMgr) instance
> (UIMAFramework.newDefaultResourceManager()).   
> Any subsequent AnalysisEngine setup during initialization will use the
> ResMgr extension classpath as seen in the following (This works fine for
> taeStep1 and taeStep2 below):
>         ResMgr.setExtensionClassPath(aContext.getDataPath(), true);
>         taeStep1 =
> UIMAFramework.produceAnalysisEngine(taeSpecifierStep1, ResMgr, null);
>         taeStep2 =
> UIMAFramework.produceAnalysisEngine(taeSpecifierStep2, ResMgr, null);
>         jcas_local =
> CasCreationUtils.createCas(taeStep1.getAnalysisEngineMetaData()).getJCas
> ();
> Problem:  When running the 'process(JCas jcas) from this same class,
> neither 'jcas_local' or the ResMgr has access to the classpath provided
> in the 'initialize'.  Within the 'process' neither jcas nor jcas_local
> apparently is using the extension classpath.  I suspect that 'ResMgr' is
> either being reset or somehow lost in the scope when run from the pear
> installer, since the classloader is missing resources and classes when
> accessed w/in the process method.  As an experiment I ran
> ResMgr.getDataPath() w/in a System.out.println from both the Eclipse
> launch and the pear installer.  The expected datapath was produced in
> Eclipse and 'null' is being returned for the pear installer.
> Error: The actual error being thrown is as follows:
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.uima.cas.CASRuntimeException: The JCAS cover class
> "edu.mayo.bmi.smoking.i2b2.type.RecordSentence_Type" could not be
> loaded.
>         at org.apache.uima.jcas.impl.JCasImpl.getType(JCasImpl.java:417)
>         at org.apache.uima.jcas.cas.TOP.<init>(TOP.java:92)
>         at
> org.apache.uima.jcas.cas.AnnotationBase.<init>(AnnotationBase.java:53)
>         at
> org.apache.uima.jcas.tcas.Annotation.<init>(Annotation.java:54)
>         at
> edu.mayo.bmi.smoking.i2b2.type.RecordSentence.<init>(RecordSentence.java
> :42)
>         at
> edu.mayo.bmi.smoking.ae.ClassifiableEntries.process(ClassifiableEntries.
> java:334)
>         ... 13 more
> Can anyone tell me how I can get the classloader to use the same version
> from the process method?
> 	Thanks,
> 		~Sean
> Sean Murphy
>> Senior Analyst/Programmer
>> Department  of Information Technology
>> Phone: 507-284-9348
>> Mayo Clinic
>> 200 First Street SW
>> Rochester, MN 55905
>> www.mayoclinic.org <http://www.mayoclinic.org/> 

View raw message