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.
No, it could not be opened. So it is indeed a classloader/classpath problem.
I could easily avoid this by loading the resource without the help of UIMA (directly by using the
Eclipse Framework),
but I would like to do it the UIMA way, so that the plugins remain independent from Eclipse and can
be used for other UIMA apps.
Maybe we could figure out a way to use the UIMA resource loading in a way that it is able to find
the resource in both setups (as Eclipse plugin and as standalone analysis engine).
Here the Eclipse projects + instructions in the JIRA to demonstrate the problem:
https://issues.apache.org/jira/browse/UIMA-1427
Regards,
Kai
--Thilo
Regards,
Kai
--Thilo
Here is how I define the resource in the AE descriptor:
<resourceManagerConfiguration>
<externalResources>
<externalResource>
<name>english_sd_model</name>
<description/>
<fileResourceSpecifier>
<fileUrl>file:EnglishSD.bin.gz</fileUrl>
</fileResourceSpecifier>
</externalResource>
</externalResources>
<externalResourceBindings>
<externalResourceBinding>
<key>sd_model</key>
<resourceName>english_sd_model</resourceName>
</externalResourceBinding>
</externalResourceBindings>
</resourceManagerConfiguration>
Should I define the fileUrl somehow different?
Regards,
Kai
org.apache.uima.resource.ResourceAccessException
at
org.apache.uima.impl.UimaContext_ImplBase.getResourceFilePath(UimaContext_ImplBase.java:226)
at
org.pubcurator.analyzers.range.annotators.RangeAnnotator.initialize(RangeAnnotator.java:54)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:251)
at
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:157)
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:267)
at
org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:335)
at
org.pubcurator.analyzers.range.annotators.RangeAnnotatorTest.testProcessJCas(RangeAnnotatorTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)