Now I feel like an idiot. The issue was I was trying to access the external resource using aContext.getConfigParameterValue() instead of aContext.getResourceObject(). Thanks for replying, Marshall, but this is a case of PEBKAC. Anyways, does anyone have suggestions on my second question?
2) What's the best way to share TypeSystemDescriptor files. Right now, I'm just copying them into any annotators that need them. Is there a way to have the analysisEngineDescriptor read them from a jar? ________________________________ From: Marshall Schor <[email protected]> To: [email protected] Sent: Wednesday, May 29, 2013 5:43 PM Subject: Re: UIMA AS PEAR External Resource and Type System Decriptor problem? So, it seems this is an issue when you "deploy the PEAR", but not when you run with it in, for instance, the CAS Visual Debugger. Can you post more details on exactly what you're doing to "deploy the PEAR", and what difference that has with what is working (e.g., running in the CAS Visual Debugger)? -Marshall On 5/29/2013 4:20 PM, GATE User wrote: > Thanks in advance for your time and help. > > > 1) I'm trying to use an external resource in a UIMA AS PEAR. During the > PEAR's installation using the runPearInstaller.sh, it seems to find the file > just fine. However, when I deploy the PEAR, the resource is not created. > When I print out the the absolute file path, I get null. Here is the external > resources part of my descriptor: > > <externalResourceDependencies> > <externalResourceDependency> > <key>ValidIds</key> > <description /> > ><interfaceName>uima.resources.implementations.StringMapResource_Impl</interfaceName> > <optional>false</optional> > </externalResourceDependency> > </externalResourceDependencies> > <resourceManagerConfiguration> > <externalResources> > <externalResource> > <name>ValidIdsFile</name> > <description /> > <fileResourceSpecifier> > <fileUrl>file:uima/resources/file/validIds</fileUrl> > </fileResourceSpecifier> > ><implementationName>uima.resources.implementations.StringMapResource_Impl</implementationName> > </externalResource> > </externalResources> > <externalResourceBindings> > <externalResourceBinding> > <key>ValidIds</key> > <resourceName>ValidIdsFile</resourceName> > </externalResourceBinding> > </externalResourceBindings> > </resourceManagerConfiguration> > > The I am using a typical spring project layout, so the resources go in > src/main/resources. When compiled, anything in the resources file is copied > to the bin directory. Relative src/main/resources, the file is at: > uima/resources/file/validIds > > I've checked the PEAR and the resource is at the expected location: > bin/uima/resources/file/validIds > Additionally, after installation, the PATH environment variable is set to the > bin directory in the setenv file under metadata. In the annotator, in the > initialize() method, I am getting the annotator like so: > > public static final String exResourceGridZoes = "ValidIds"; > > map = (StringMapResource) >aContext.getConfigParameterValue(exResourceGridZoes); > > if(map == null) { > try { > getContext().getLogger().log(Level.INFO, >"RegularExpressionAnnotator: resource" + > " file not found." + >getContext().getResourceFilePath(exResourceGridZoes)); > } catch (ResourceAccessException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > The getContext().getResourceFilePath(exResourceGridZoes)) is returning a > null, and I'm not sure why. Only thing I can think of is that it can't find > the resource "ValidIds", but I don't know why. > > 2) What's the best way to share TypeSystemDescriptor files. Right now, I'm > just copying them into any annotators that need them. Is there a way to have > the analysisEngineDescriptor read them from a jar? >
