Kai Schlamp wrote:
>  > Before you do that, try putting the following code
>> in your annotator:
>>
>>     String filename = "EnglishSD.bin.gz";
>>     InputStream is = UIMAFramework.class.getResourceAsStream(filename);
>>     if (is == null) {
>>       System.out.println("Could not open file " + filename);
>>     } else {
>>       System.out.println("Successfully opened file " + filename);
>>     }
>>
>> I don't know what code exactly UIMA uses to load that
>> resource, but if this works, loading the model as a
>> resource should work as well.  If on the other hand
>> this doesn't work, I'm not surprised that the model
>> can't be loaded as a resource.
> 
> This classpath issue still bugs me. Would it be possible to introduce a
> way to set the classloader manually (and globally)?
> For example XStream has such a feature (xstream.setClassLoader()). That
> way those problems with XStream were completely solved when using it
> inside an Eclipse plugin.

Kai,

you can sort of set the class loader:
http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/api/org/apache/uima/resource/ResourceManager.html#setExtensionClassPath%28java.lang.ClassLoader,%20java.lang.String,%20boolean%29

You can provide your own resource manager when creating
your analysis engine:
http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/api/org/apache/uima/UIMAFramework.html#produceAnalysisEngine%28org.apache.uima.resource.ResourceSpecifier,%20org.apache.uima.resource.ResourceManager,%20java.util.Map%29

--Thilo

> But the thing that even bugs me more is that this happens at all. Cause
> of "Eclipse-RegisterBuddy: org.apache.uima" in the MANIFEST, UIMA should
> see the same classpath as the plugin itself. And even stranger is that
> all descriptors are found, but not the defined resources. So it seems
> that UIMA looks in different ways for descriptors and resources.
> Hm, as I said ... it really bugs me ;-)
> 
> Regards,
> Kai

Reply via email to