You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2009/04/22 11:20:39 UTC

CasManager.defineCasPool() was called twice by the same Analysis Engine

Hi everyone,

I am using the PEAR Api to install a AAE and run it. The first time it 
runs everything is fine.
The second time it runs I get this exception:

Apr 22, 2009 11:08:42 AM 
org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl 
processAndOutputNewCASes(269)
SEVERE: Exception occurred
org.apache.uima.analysis_engine.AnalysisEngineProcessException: The 
method CasManager.defineCasPool() was called twice by the same Analysis 
Engine (/Multiplier/).
    at 
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:516)
    at 
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:594)
    at 
org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:558)
    at 
org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:398)
    at 
org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:331)
    at 
org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:261)
    at 
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
    at 
org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:273)
    at 
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
    at 
dk.infopaq.trainserver.TrainingEngine$TrainingJob.run(TrainingEngine.java:229)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.uima.UIMARuntimeException: The method 
CasManager.defineCasPool() was called twice by the same Analysis Engine 
(/Multiplier/).
    at 
org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:181)
    at 
org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:161)
    at 
org.apache.uima.impl.UimaContext_ImplBase.getEmptyCas(UimaContext_ImplBase.java:565)
    at 
org.apache.uima.analysis_component.CasMultiplier_ImplBase.getEmptyCAS(CasMultiplier_ImplBase.java:109)
    at 
dk.infopaq.nlp.repository.connector.HBaseReadCasMultiplier.next(HBaseReadCasMultiplier.java:123)
    at 
org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:489)
    ... 12 more

For me it looks like that I have to do some cleanup after the first run, 
but which methods must be called
after I am done with processing ?

Currently I only call collectionProcessigComplete() on my AE. I tried to 
call destory(), but that
did not help. The AAE contains a CasMultiplier and thats also the AE in 
which it fails inside getEmptyCAS().

Thanks,
Jörn

Re: Problem with UIMA Eclipse Plugins when starting Galileo

Posted by Peter Klügl <pk...@ki.informatik.uni-wuerzburg.de>.
Hi,

sorry for the late answer.
> I am not sure what plugins are "included" in your "RCP Eclipse" and how you
> "launch" your RCP. Let me describe some options that you can try.
>   
The included plugins consist mostly of TextMarker plugins that depend on 
the UIMA runtime plugin. The launch is currently configurate to run a 
product (org.eclipse.sdk.ide) using all plugins in the workspace

> Option 1. "Validate Plug-ins" before you launch your RCP
> If you launch your RCP through the Lauch Configuration Dialog, in the
> "Plug-ins" Tab, there is a "Validate Plug-ins" button that you can click to
> verify that all the dependency of the "selected" plug-ins are satisfied. If
> there are some errors, you can click the "Add Rquired Plug-ins" to correct
> the error.
>   
I have done that; no problems were detected.

> Option 2. If your RCP has "Plug-in Dependencies" view, try to see if there
> is a "red x" on top of any UIMA plug-in that may have some missing plug-ins
> that it depends on.
>   
No complaints in the dependencies view.
> Option 3.If your RCP has "Plug-in Registry" view, try to "diagnose" the
> problematic UIMA plug-ins as follows:
>   - "Plug-in Registry" view, Right click of any plug-in and Select "Show
> Advanced Operations"
>   - Right click on the problematic UIMA plug-in and Select "Diagnose" which
> will pop-up the result of the diagnostic operation.
>   
Returns "no problems detected". The desceditor is not listed in the 
active plugins, however, the runtime plugin is.
> Let us know which option you can use and what is the result.
>   
One of my students solved the problem for his application by 
closing/opening all project in his IDE workspace and some restarts with 
new plugins, but this did not work for me. My best guess is currently 
that there is a problem with the workspace itself. I get back to you 
when I got more news.

Peter


Re: Problem with UIMA Eclipse Plugins when starting Galileo

Posted by Tong Fin <to...@gmail.com>.
Hi Peter,


> If I start a new Eclipse with my RCP Eclipse and some other plugins, then
> the UIMA plugins are indeed listed as installed in the About/Installation
> Details, but can not be loaded or used by other plugins.


I am not sure what plugins are "included" in your "RCP Eclipse" and how you
"launch" your RCP. Let me describe some options that you can try.

Option 1. "Validate Plug-ins" before you launch your RCP
If you launch your RCP through the Lauch Configuration Dialog, in the
"Plug-ins" Tab, there is a "Validate Plug-ins" button that you can click to
verify that all the dependency of the "selected" plug-ins are satisfied. If
there are some errors, you can click the "Add Rquired Plug-ins" to correct
the error.

Option 2. If your RCP has "Plug-in Dependencies" view, try to see if there
is a "red x" on top of any UIMA plug-in that may have some missing plug-ins
that it depends on.

Option 3.If your RCP has "Plug-in Registry" view, try to "diagnose" the
problematic UIMA plug-ins as follows:
  - "Plug-in Registry" view, Right click of any plug-in and Select "Show
Advanced Operations"
  - Right click on the problematic UIMA plug-in and Select "Diagnose" which
will pop-up the result of the diagnostic operation.

Let us know which option you can use and what is the result.

-- Tong

Re: Problem with UIMA Eclipse Plugins when starting Galileo

Posted by Thilo Goetz <tw...@gmx.de>.
Peter Klügl wrote:
> Hi,
> 
> I have a problem with the UIMA eclipse plugins and wanted to ask if
> anyone already made some experiences with this behaviour:
> 
> I downloaded the latest (RCP) Galileo milestone (M6), installed the
> adequate EMF SDK (zip, 2.5.0M6) und installed the UIMA plugins with the
> update site. The UIMA plugins work just fine, e.g., I am able to open an
> AE descriptor with the component editor. If I start a new Eclipse with
> my RCP Eclipse and some other plugins, then the UIMA plugins are indeed
> listed as installed in the About/Installation Details, but can not be
> loaded or used by other plugins. Here is what happens if I try to open
> the same AE descriptor with the component editor:
> 
> eclipse.buildId=unknown
> java.version=1.6.0_12
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
> Framework arguments:  -product org.eclipse.sdk.ide
> Command-line arguments:  -product org.eclipse.sdk.ide -data
> D:\work\workspace/../runtime-EclipseApplication -dev
> file:D:/work/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse
> Application/dev.properties -os win32 -ws win32 -arch x86
> 
> 
> Error
> Tue Apr 28 13:05:25 CEST 2009
> Unable to create editor ID taeconfigurator.editors.MultiPageEditor: The
> editor class could not be instantiated. This usually indicates a missing
> no-arg constructor or that the editor's class name was mistyped in

I've seen this in the past, and as far as I remember, it was caused by
the fact that the UIMA runtime plugin was not available for some reason.
Can you make it's really there (org.apache.uima.runtime)?

> plugin.xml.
> 
> java.lang.NoClassDefFoundError: org/apache/uima/UIMAException
>    at java.lang.ClassLoader.defineClass1(Native Method)
>    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>    at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:166)
> 
>    at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:574)
> 
>    at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:544)
> 
>    at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:475)
> 
>    at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:463)
> 
>    at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:443)
> 
>    at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:194)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
> 
>    at
> org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:440)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
> 
>    at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:88)
> 
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>    at java.lang.Class.getDeclaredConstructors0(Native Method)
>    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>    at java.lang.Class.getConstructor0(Class.java:2699)
>    at java.lang.Class.newInstance0(Class.java:326)
>    at java.lang.Class.newInstance(Class.java:308)
>    at
> org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:170)
> 
>    at
> org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
> 
>    at
> org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
> 
>    at
> org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
> 
>    at
> org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
>    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
>    at
> org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
> 
>    at
> org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
> 
>    at
> org.eclipse.ui.internal.EditorManager.createPart(EditorManager.java:848)
>    at
> org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:602)
> 
>    at
> org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:458)
> 
>    at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
> 
>    at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
>    at
> org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
> 
>    at
> org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
> 
>    at
> org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
> 
>    at
> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
> 
>    at
> org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
> 
>    at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
>    at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
>    at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
>    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
>    at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
>    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
>    at
> org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
> 
>    at
> org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
> 
>    at
> org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
> 
>    at
> org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:781)
> 
>    at
> org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:680)
> 
>    at
> org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:641)
>    at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2850)
> 
>    at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
> 
>    at
> org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
>    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
>    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
>    at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
>    at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
>    at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
>    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:650)
>    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:609)
>    at
> org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:394)
> 
>    at
> org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:141)
> 
>    at
> org.eclipse.dltk.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:45)
> 
>    at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:256)
>    at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:237)
>    at
> org.eclipse.dltk.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:259)
> 
>    at
> org.eclipse.dltk.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:235)
> 
>    at
> org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerActionGroup.handleOpen(ScriptExplorerActionGroup.java:297)
> 
>    at
> org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerPart$5.open(ScriptExplorerPart.java:665)
> 
>    at
> org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
>    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
>    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
>    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
>    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
>    at
> org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
> 
>    at
> org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
> 
>    at
> org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
> 
>    at
> org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
>    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
>    at
> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
>    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
>    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
>    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
>    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
>    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2393)
>    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2357)
>    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2209)
>    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499)
>    at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> 
>    at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492)
>    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>    at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
> 
>    at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
> 
>    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:556)
>    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
>    at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
>    at org.eclipse.equinox.launcher.Main.main(Main.java:1260)
> Caused by: java.lang.ClassNotFoundException: org.apache.uima.UIMAException
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:443)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
> 
>    at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
> 
>    at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:88)
> 
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>    ... 107 more
> 
> Any hints where to search for a solution? The problem does not occur
> with a Ganymede (and normal EMF SDK) installation and the same plugins
> 
> Peter
> 

Problem with UIMA Eclipse Plugins when starting Galileo

Posted by Peter Klügl <pk...@ki.informatik.uni-wuerzburg.de>.
Hi,

I have a problem with the UIMA eclipse plugins and wanted to ask if 
anyone already made some experiences with this behaviour:

I downloaded the latest (RCP) Galileo milestone (M6), installed the 
adequate EMF SDK (zip, 2.5.0M6) und installed the UIMA plugins with the 
update site. The UIMA plugins work just fine, e.g., I am able to open an 
AE descriptor with the component editor. If I start a new Eclipse with 
my RCP Eclipse and some other plugins, then the UIMA plugins are indeed 
listed as installed in the About/Installation Details, but can not be 
loaded or used by other plugins. Here is what happens if I try to open 
the same AE descriptor with the component editor:

eclipse.buildId=unknown
java.version=1.6.0_12
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data 
D:\work\workspace/../runtime-EclipseApplication -dev 
file:D:/work/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse 
Application/dev.properties -os win32 -ws win32 -arch x86


Error
Tue Apr 28 13:05:25 CEST 2009
Unable to create editor ID taeconfigurator.editors.MultiPageEditor: The 
editor class could not be instantiated. This usually indicates a missing 
no-arg constructor or that the editor's class name was mistyped in 
plugin.xml.

java.lang.NoClassDefFoundError: org/apache/uima/UIMAException
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:166)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:574)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:544)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:475)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:463)
    at 
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:443)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:194)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
    at 
org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:440)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:88)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at 
org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:170)
    at 
org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
    at 
org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at 
org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
    at 
org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at 
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
    at 
org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
    at 
org.eclipse.ui.internal.EditorManager.createPart(EditorManager.java:848)
    at 
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:602)
    at 
org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:458)
    at 
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
    at 
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
    at 
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
    at 
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
    at 
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
    at 
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
    at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
    at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
    at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
    at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
    at 
org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
    at 
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
    at 
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
    at 
org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:781)
    at 
org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:680)
    at 
org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:641)
    at 
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2850)
    at 
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
    at 
org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
    at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at 
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
    at 
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
    at 
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:650)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:609)
    at 
org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:394)
    at 
org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:141)
    at 
org.eclipse.dltk.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:45)
    at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:256)
    at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:237)
    at 
org.eclipse.dltk.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:259)
    at 
org.eclipse.dltk.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:235)
    at 
org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerActionGroup.handleOpen(ScriptExplorerActionGroup.java:297)
    at 
org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerPart$5.open(ScriptExplorerPart.java:665)
    at 
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
    at org.eclipse.core.runtime.Platform.run(Platform.java:888)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at 
org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
    at 
org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
    at 
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
    at 
org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
    at 
org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2393)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2357)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2209)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:499)
    at 
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at 
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:492)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at 
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at 
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    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:556)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1260)
Caused by: java.lang.ClassNotFoundException: org.apache.uima.UIMAException
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:443)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
    at 
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
    at 
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:88)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    ... 107 more

Any hints where to search for a solution? The problem does not occur 
with a Ganymede (and normal EMF SDK) installation and the same plugins

Peter



Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Eddie Epstein <ea...@gmail.com>.
>The Analysis Engine interface does not provide a hasNext method.
Check out the AE interface: processAndOutputNewCASes().

> I switched from uima-2.2.2-incubating to the current head
> and now I do not encounter the issue anymore.
There were some changes to PEARs and resources which
may have played a role. See UIMA-1107

> But I am still interested to know how to include the Collection Reader
> in the Aggregate.
Should just be able to import it as a delegateAnalysisEngine.

Regards,
Eddie

Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Jörn Kottmann <ko...@gmail.com>.
Hello,

I switched from uima-2.2.2-incubating to the current head
and now I do not encounter the issue anymore.

But I am still interested to know how to include the Collection Reader
in the Aggregate.

Jörn

Marshall Schor wrote:
> Hi Jörn,
>
> I took a look the code you posted and the stack trace.  I don't see
> anything definitive, but here are some questions.
>
> The Pear you are making use of - it has a collection reader and a main
> aggregate.  You pull out and parse the collection reader using
> instDesc.getMainCollIteratorDesc() and you pull out and parse the main
> Aggregate Analysis Engine using instPear.getComponentPearDescPath().
>
> Can you verify that the instPear.getComponentPearDescPath() doesn't also
> include the collection reader? (You can include Collection Readers
> inside an Aggregate).
>
> The 2nd thing I see is in the stack trace where it looks like the code
> that does the call to process the CAS is running descended from some
> thread pooling, concurrent execution stuff (Here's the top of the stack
> trace up to the point where the process call is:
>
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
>
>    at
> dk.infopaq.trainserver.TrainingEngine$TrainingJob.run(TrainingEngine.java:229)
>
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
>    at java.lang.Thread.run(Thread.java:619)
>
> Is it possible there are multiple threads running, and if so is the
> TrainingJob code set up to be thread safe?
>
> Here's another observation.
>
> The code is separately instantiating a collection reader and an
> Aggregate.  The Aggregate is created (produceAnalysisEngine) with a
> resource manager that has no extra class paths specified. 
>
> The collection reader is instantiated with a resource manager that has
> extra class paths instantiated:
>
> rsrcMgr = UIMAFramework.newDefaultResourceManager();
>     rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() + ":"
>         + instPear.buildComponentClassPath(), false);
>
> It seems to me that maybe the same resource manager should be used for
> both? or is there a reason for doing it this way?
>
> Another observation:  One thing UIMA does with the type system from all
> the components is to merge the type system specifications.  There are
> APIs to do this manually, if you are loading different descriptors.  I
> see this isn't being done here though.  You do send the Aggregate's type
> system to the collection reader component, though - so this would work
> unless some special stuff was going on with JCas cover types (but maybe
> your collection reader isn't using JCas). 
>
> Last observation: the code that sends the type system to the collection
> reader gets a new CAS (ae.newCAS() ), but doesn't use that CAS for the
> subsequent call to process, but instead gets another newCAS(). 
>
> -Marshall (apologizing for not having a good definitive answer :-) )
>
> Jörn Kottmann wrote:
>   
>> Eddie Epstein wrote:
>>     
>>> Hi Jörn,
>>>
>>> From CVD I can repeatedly run aggregates containing cas mutiplier
>>> delegates. Can you be more specific about the scenario? For example,
>>> are you re-instantiating the AE between runs? Would it be easy for you
>>> to make a minimal code sample that demonstrates the problem?
>>>   
>>>       
>> Here is my code which interacts with the PEAR Api. Maybe it differs a bit
>> from the usual use case, because I also instantiate a CollectionReader.
>> Errors occurs if this code is run twice.
>>
>> BTW, is it safe it run it concurrently in multiple threads for
>> different pears ?
>> In the case it failed it did not run concurrently, but it is possible
>> that is run the second time in a different thread.
>>
>> I can try to make a minimal code sample, but maybe you see something
>> wrong in my interaction with UIMA.
>>
>> Jörn
>>                PackageBrowser instPear =
>> PackageInstaller.installPackage(...);
>>
>>                ResourceManager rsrcMgr = UIMAFramework
>>                        .newDefaultResourceManager();
>>                              InstallationDescriptor instDesc =
>> instPear.getInstallationDescriptor();
>>                              XMLInputSource in = new
>> XMLInputSource(instPear
>>                        .getComponentPearDescPath());
>>
>>                ResourceSpecifier specifier = UIMAFramework.getXMLParser()
>>                        .parseResourceSpecifier(in);
>>
>>                AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(
>>                        specifier, rsrcMgr, null);
>>                              rsrcMgr =
>> UIMAFramework.newDefaultResourceManager();
>>               
>> rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() +
>> ":" + instPear.buildComponentClassPath(), false);
>>                              XMLInputSource collectionReaderIn = new
>> XMLInputSource(
>>                        instDesc.getMainCollIteratorDesc());
>>                              ResourceSpecifier colReaderSpecifier =
>>                       
>> UIMAFramework.getXMLParser().parseResourceSpecifier(collectionReaderIn);
>>                             
>> Thread.currentThread().setContextClassLoader(rsrcMgr.getExtensionClassLoader());
>>
>>
>>                CollectionReader colReader =
>>                       
>> UIMAFramework.produceCollectionReader(colReaderSpecifier, rsrcMgr, null);
>>                             
>> colReader.typeSystemInit(ae.newCAS().getTypeSystem());
>>                              CAS cas = ae.newCAS();
>>                while (colReader.hasNext()) {
>>                    colReader.getNext(cas);
>>                                      ae.process(cas);
>>                                      cas.reset();
>>                }
>>                              isCompletingCollectionProcessing = true;
>>                              ae.collectionProcessComplete();
>>
>>
>>
>>
>>     


Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Jörn Kottmann <ko...@gmail.com>.
Marshall Schor wrote:
> Can you verify that the instPear.getComponentPearDescPath() doesn't also
> include the collection reader? (You can include Collection Readers
> inside an Aggregate).
>   
instPear.getComponentPearDescPath() does include the
Collection Reader Descritpor xml file. Is that an issue ?

In my case it would be the right thing to include the Collection
Reader in the Aggregate. The reason I didn't do it is that
I thought it is not possible.

The Analysis Engine interface does not provide a hasNext method.
How can I now drive the processing pipeline without knowing when
to stop ?
> The 2nd thing I see is in the stack trace where it looks like the code
> that does the call to process the CAS is running descended from some
> thread pooling, concurrent execution stuff (Here's the top of the stack
> trace up to the point where the process call is:
>
>    at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
>
>    at
> dk.infopaq.trainserver.TrainingEngine$TrainingJob.run(TrainingEngine.java:229)
>
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
>    at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
>    at java.lang.Thread.run(Thread.java:619)
>
> Is it possible there are multiple threads running, and if so is the
> TrainingJob code set up to be thread safe?
>   
Yes the code is usually executed concurrently. There are multiple
PEARs and each PEAR can have exactly own thread which runs it,
but the code makes sure that it cannot happen that two threads
try to process the same PEAR, because I think it would not be safe
to install the same PEAR concurrently into the same directory.

In the test I did I do not think that the reason is a concurrency
problem, because it also fails if I only have one thread, and it always
fails on the second time I run it.

> Here's another observation.
>
> The code is separately instantiating a collection reader and an
> Aggregate.  The Aggregate is created (produceAnalysisEngine) with a
> resource manager that has no extra class paths specified. 
>
> The collection reader is instantiated with a resource manager that has
> extra class paths instantiated:
>
> rsrcMgr = UIMAFramework.newDefaultResourceManager();
>     rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() + ":"
>         + instPear.buildComponentClassPath(), false);
>
> It seems to me that maybe the same resource manager should be used for
> both? or is there a reason for doing it this way?
>   
Your are right they should be used for both, I changed my code.
> Another observation:  One thing UIMA does with the type system from all
> the components is to merge the type system specifications.  There are
> APIs to do this manually, if you are loading different descriptors.  I
> see this isn't being done here though.  You do send the Aggregate's type
> system to the collection reader component, though - so this would work
> unless some special stuff was going on with JCas cover types (but maybe
> your collection reader isn't using JCas). 
>   
No, I do not use JCas. That issue does not longer exist when
I include the Collection Reader into the Aggregate, right ?
> Last observation: the code that sends the type system to the collection
> reader gets a new CAS (ae.newCAS() ), but doesn't use that CAS for the
> subsequent call to process, but instead gets another newCAS(). 
>   
Thanks, also changed that, now I only have on CAS object which is used
all the time for precessing.

Thanks,
Jörn

Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Marshall Schor <ms...@schor.com>.
Hi Jörn,

I took a look the code you posted and the stack trace.  I don't see
anything definitive, but here are some questions.

The Pear you are making use of - it has a collection reader and a main
aggregate.  You pull out and parse the collection reader using
instDesc.getMainCollIteratorDesc() and you pull out and parse the main
Aggregate Analysis Engine using instPear.getComponentPearDescPath().

Can you verify that the instPear.getComponentPearDescPath() doesn't also
include the collection reader? (You can include Collection Readers
inside an Aggregate).

The 2nd thing I see is in the stack trace where it looks like the code
that does the call to process the CAS is running descended from some
thread pooling, concurrent execution stuff (Here's the top of the stack
trace up to the point where the process call is:

   at
org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)

   at
dk.infopaq.trainserver.TrainingEngine$TrainingJob.run(TrainingEngine.java:229)

   at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

   at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

   at java.lang.Thread.run(Thread.java:619)

Is it possible there are multiple threads running, and if so is the
TrainingJob code set up to be thread safe?

Here's another observation.

The code is separately instantiating a collection reader and an
Aggregate.  The Aggregate is created (produceAnalysisEngine) with a
resource manager that has no extra class paths specified. 

The collection reader is instantiated with a resource manager that has
extra class paths instantiated:

rsrcMgr = UIMAFramework.newDefaultResourceManager();
    rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() + ":"
        + instPear.buildComponentClassPath(), false);

It seems to me that maybe the same resource manager should be used for
both? or is there a reason for doing it this way?

Another observation:  One thing UIMA does with the type system from all
the components is to merge the type system specifications.  There are
APIs to do this manually, if you are loading different descriptors.  I
see this isn't being done here though.  You do send the Aggregate's type
system to the collection reader component, though - so this would work
unless some special stuff was going on with JCas cover types (but maybe
your collection reader isn't using JCas). 

Last observation: the code that sends the type system to the collection
reader gets a new CAS (ae.newCAS() ), but doesn't use that CAS for the
subsequent call to process, but instead gets another newCAS(). 

-Marshall (apologizing for not having a good definitive answer :-) )

Jörn Kottmann wrote:
> Eddie Epstein wrote:
>> Hi Jörn,
>>
>> From CVD I can repeatedly run aggregates containing cas mutiplier
>> delegates. Can you be more specific about the scenario? For example,
>> are you re-instantiating the AE between runs? Would it be easy for you
>> to make a minimal code sample that demonstrates the problem?
>>   
> Here is my code which interacts with the PEAR Api. Maybe it differs a bit
> from the usual use case, because I also instantiate a CollectionReader.
> Errors occurs if this code is run twice.
>
> BTW, is it safe it run it concurrently in multiple threads for
> different pears ?
> In the case it failed it did not run concurrently, but it is possible
> that is run the second time in a different thread.
>
> I can try to make a minimal code sample, but maybe you see something
> wrong in my interaction with UIMA.
>
> Jörn
>                PackageBrowser instPear =
> PackageInstaller.installPackage(...);
>
>                ResourceManager rsrcMgr = UIMAFramework
>                        .newDefaultResourceManager();
>                              InstallationDescriptor instDesc =
> instPear.getInstallationDescriptor();
>                              XMLInputSource in = new
> XMLInputSource(instPear
>                        .getComponentPearDescPath());
>
>                ResourceSpecifier specifier = UIMAFramework.getXMLParser()
>                        .parseResourceSpecifier(in);
>
>                AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(
>                        specifier, rsrcMgr, null);
>                              rsrcMgr =
> UIMAFramework.newDefaultResourceManager();
>               
> rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() +
> ":" + instPear.buildComponentClassPath(), false);
>                              XMLInputSource collectionReaderIn = new
> XMLInputSource(
>                        instDesc.getMainCollIteratorDesc());
>                              ResourceSpecifier colReaderSpecifier =
>                       
> UIMAFramework.getXMLParser().parseResourceSpecifier(collectionReaderIn);
>                             
> Thread.currentThread().setContextClassLoader(rsrcMgr.getExtensionClassLoader());
>
>
>                CollectionReader colReader =
>                       
> UIMAFramework.produceCollectionReader(colReaderSpecifier, rsrcMgr, null);
>                             
> colReader.typeSystemInit(ae.newCAS().getTypeSystem());
>                              CAS cas = ae.newCAS();
>                while (colReader.hasNext()) {
>                    colReader.getNext(cas);
>                                      ae.process(cas);
>                                      cas.reset();
>                }
>                              isCompletingCollectionProcessing = true;
>                              ae.collectionProcessComplete();
>
>
>
>

Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Jörn Kottmann <ko...@gmail.com>.
Eddie Epstein wrote:
> Hi Jörn,
>
> From CVD I can repeatedly run aggregates containing cas mutiplier
> delegates. Can you be more specific about the scenario? For example,
> are you re-instantiating the AE between runs? Would it be easy for you
> to make a minimal code sample that demonstrates the problem?
>   
Here is my code which interacts with the PEAR Api. Maybe it differs a bit
from the usual use case, because I also instantiate a CollectionReader.
Errors occurs if this code is run twice.

BTW, is it safe it run it concurrently in multiple threads for different 
pears ?
In the case it failed it did not run concurrently, but it is possible
that is run the second time in a different thread.

I can try to make a minimal code sample, but maybe you see something
wrong in my interaction with UIMA.

Jörn
                PackageBrowser instPear = 
PackageInstaller.installPackage(...);

                ResourceManager rsrcMgr = UIMAFramework
                        .newDefaultResourceManager();
               
                InstallationDescriptor instDesc = 
instPear.getInstallationDescriptor();
               
                XMLInputSource in = new XMLInputSource(instPear
                        .getComponentPearDescPath());

                ResourceSpecifier specifier = UIMAFramework.getXMLParser()
                        .parseResourceSpecifier(in);

                AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(
                        specifier, rsrcMgr, null);
               
                rsrcMgr = UIMAFramework.newDefaultResourceManager();
                
rsrcMgr.setExtensionClassPath(instPear.getComponentPearDescPath() + ":" 
+ instPear.buildComponentClassPath(), false);
               
                XMLInputSource collectionReaderIn = new XMLInputSource(
                        instDesc.getMainCollIteratorDesc());
               
                ResourceSpecifier colReaderSpecifier =
                        
UIMAFramework.getXMLParser().parseResourceSpecifier(collectionReaderIn);
               
                
Thread.currentThread().setContextClassLoader(rsrcMgr.getExtensionClassLoader());

                CollectionReader colReader =
                        
UIMAFramework.produceCollectionReader(colReaderSpecifier, rsrcMgr, null);
               
                colReader.typeSystemInit(ae.newCAS().getTypeSystem());
               
                CAS cas = ae.newCAS();
                while (colReader.hasNext()) {
                    colReader.getNext(cas);
                   
                    ae.process(cas);
                   
                    cas.reset();
                }
               
                isCompletingCollectionProcessing = true;
               
                ae.collectionProcessComplete();



Re: CasManager.defineCasPool() was called twice by the same Analysis Engine

Posted by Eddie Epstein <ea...@gmail.com>.
Hi Jörn,

>From CVD I can repeatedly run aggregates containing cas mutiplier
delegates. Can you be more specific about the scenario? For example,
are you re-instantiating the AE between runs? Would it be easy for you
to make a minimal code sample that demonstrates the problem?

Thanks,
Eddie

On Wed, Apr 22, 2009 at 5:20 AM, Jörn Kottmann <ko...@gmail.com> wrote:
> Hi everyone,
>
> I am using the PEAR Api to install a AAE and run it. The first time it runs
> everything is fine.
> The second time it runs I get this exception:
>
> Apr 22, 2009 11:08:42 AM
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl
> processAndOutputNewCASes(269)
> SEVERE: Exception occurred
> org.apache.uima.analysis_engine.AnalysisEngineProcessException: The method
> CasManager.defineCasPool() was called twice by the same Analysis Engine
> (/Multiplier/).
>   at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:516)
>   at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl$AnalysisComponentCasIterator.next(PrimitiveAnalysisEngine_impl.java:594)
>   at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.processUntilNextOutputCas(ASB_impl.java:558)
>   at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl$AggregateCasIterator.<init>(ASB_impl.java:398)
>   at
> org.apache.uima.analysis_engine.asb.impl.ASB_impl.process(ASB_impl.java:331)
>   at
> org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.processAndOutputNewCASes(AggregateAnalysisEngine_impl.java:261)
>   at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
>   at
> org.apache.uima.analysis_engine.impl.PearAnalysisEngineWrapper.processAndOutputNewCASes(PearAnalysisEngineWrapper.java:273)
>   at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:218)
>   at
> dk.infopaq.trainserver.TrainingEngine$TrainingJob.run(TrainingEngine.java:229)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>   at java.lang.Thread.run(Thread.java:619)
> Caused by: org.apache.uima.UIMARuntimeException: The method
> CasManager.defineCasPool() was called twice by the same Analysis Engine
> (/Multiplier/).
>   at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:181)
>   at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:161)
>   at
> org.apache.uima.impl.UimaContext_ImplBase.getEmptyCas(UimaContext_ImplBase.java:565)
>   at
> org.apache.uima.analysis_component.CasMultiplier_ImplBase.getEmptyCAS(CasMultiplier_ImplBase.java:109)
>   at
> dk.infopaq.nlp.repository.connector.HBaseReadCasMultiplier.next(HBaseReadCasMultiplier.java:123)
>   at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentNext(PrimitiveAnalysisEngine_impl.java:489)
>   ... 12 more
>
> For me it looks like that I have to do some cleanup after the first run, but
> which methods must be called
> after I am done with processing ?
>
> Currently I only call collectionProcessigComplete() on my AE. I tried to
> call destory(), but that
> did not help. The AAE contains a CasMultiplier and thats also the AE in
> which it fails inside getEmptyCAS().
>
> Thanks,
> Jörn
>