I frequently run UIMA-AS with scaled up AEs in the same jvm with no
problems. The UIMA-AS calls defineCasPool() once
when all AEs are instantiated.
The uima-core code that throws the exception is in
CasManager_impl.defineCasPool()
private synchronized void defineCasPool(UimaContext aRequestorContext,
String aRequestorContextName, int aMinimumSize,
Properties aPerformanceTuningSettings) throws
ResourceInitializationException {
* int poolSize = getCasPoolSize(aRequestorContextName, aMinimumSize);*
*if (poolSize > 0) {*
CasPool pool = (CasPool)
mRequestorToCasPoolMap.get(aRequestorContextName);
if (pool == null) {
// this requestor hasn't requested a CAS before
pool = new CasPool(poolSize, this, aPerformanceTuningSettings);
populateCasToCasPoolAndUimaContextMaps(pool, aRequestorContext);
mRequestorToCasPoolMap.put(aRequestorContextName, pool);
//register with JMX
registerCasPoolMBean(aRequestorContextName, pool);
} else {
* throw new
UIMARuntimeException(UIMARuntimeException.DEFINE_CAS_POOL_CALLED_TWICE,*
* new Object[] { aRequestorContextName });*
}
}
}
So it looks like something else is calling this method before UIMA-AS does.
You may need to run UIMA-AS in a debugger
to determine what is happening. Just set a break point in defineCasPool and
back trace the call.
Jerry C
On Wed, Jun 5, 2013 at 9:27 PM, GATE User <[email protected]> wrote:
> Here's some additional information:
>
> I recent got the error after commenting out the part of the initialize
> code that gets the external resource, so it might not be connected to that
> after all. I am also running this the broker and delegates in VirtualBox
> VMs. Thanks in advance.
>
>
> ________________________________
> From: GATE User <[email protected]>
> To: "[email protected]" <[email protected]>
> Sent: Wednesday, June 5, 2013 1:10 PM
> Subject: Error when deploying 5 instances of AE with External Resource,
> UIMA-AS 2.4.1 Snapshot
>
>
> Hello all:
>
> I declared a external resource and deployed the analysis engine with 5
> replicated instances on UIMA-AS 2.4.1 snapshot that I compiled from the svn
> repo for uima-as (trunk). Deployment seems to go fine at first, but then
> about 10-20 seconds after the deployment says it's ready for work, the
> threads start to die. The following error message appears in the log file
> 5 times.
>
>
>
> org.apache.uima.UIMARuntimeException: The method
> CasManager.defineCasPool() was called twice by the same Analysis Engine
> (PrimitiveAEService).
> at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:183)
> at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:153)
> at
> org.apache.uima.aae.EECasManager_impl.defineCasPool(EECasManager_impl.java:56)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:97)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:81)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:77)
> at
>
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.postInitialize(PrimitiveAnalysisEngineController_impl.java:303)
> at
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.initializeAnalysisEngine(PrimitiveAnalysisEngineController_impl.java:211)
> at
> org.apache.uima.aae.UimaAsThreadFactory$1.run(UimaAsThreadFactory.java:114)
> at java.lang.Thread.run(Thread.java:722)
>
> 11:40:25.256 - 23:
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.postInitialize:
> WARNING: Service:
> /usr/local/share/applications/uima-as/pear/MgrsRegularExpressionAnnotator
> Runtime Exception
> 11:40:25.256 - 23:
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.postInitialize:
> WARNING:
> org.apache.uima.aae.error.AsynchAEException:
> org.apache.uima.UIMARuntimeException: The method CasManager.defineCasPool()
> was called twice by the same
> Analysis Engine (PrimitiveAEService).
> at
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.postInitialize(PrimitiveAnalysisEngineController_impl.java:333)
> at
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.initializeAnalysisEngine(PrimitiveAnalysisEngineController_impl.java:211)
> at
> org.apache.uima.aae.UimaAsThreadFactory$1.run(UimaAsThreadFactory.java:114)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: org.apache.uima.UIMARuntimeException: The method
> CasManager.defineCasPool() was called twice by the same Analysis Engine
> (PrimitiveAEService).
> at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:183)
> at
> org.apache.uima.resource.impl.CasManager_impl.defineCasPool(CasManager_impl.java:153)
> at
>
> org.apache.uima.aae.EECasManager_impl.defineCasPool(EECasManager_impl.java:56)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:97)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:81)
> at
> org.apache.uima.aae.AsynchAECasManager_impl.initialize(AsynchAECasManager_impl.java:77)
> at
> org.apache.uima.aae.controller.PrimitiveAnalysisEngineController_impl.postInitialize(PrimitiveAnalysisEngineController_impl.java:303)
> ... 3 more
> I am getting the external resource with:
>
> public void initialize(UimaContext aContext) throws
> ResourceInitializationException {
> ...
>
> //External Resources
> try {
> map = (StringMapResource)
> aContext.getResourceObject(exResourceGridZoes);
> } catch (ResourceAccessException e) {
> aContext.getLogger().log(Level.INFO, "Valid makers file not
> accessible.");
> throw new ResourceInitializationException();
> }
> ...
> };
>
> and the analysis engine descriptor has the following:
>
> <externalResourceDependencies>
> <externalResourceDependency>
> <key>ValidGridZones</key>
> <description>A list of valid grid zones.</description>
>
> <interfaceName>uima.resources.implementations.StringMapResource_Impl</interfaceName>
> <optional>false</optional>
> </externalResourceDependency>
> </externalResourceDependencies>
> <resourceManagerConfiguration>
> <externalResources>
> <externalResource>
> <name>ValidGridZonesFile</name>
> <description>A two-column text file that lists all valid grid
> zones and whether the the zone is a normal one or a split one.</description>
> <fileResourceSpecifier>
> <fileUrl>file:uima/resources/file/gridzones</fileUrl>
> </fileResourceSpecifier>
>
> <implementationName>uima.resources.implementations.StringMapResource_Impl</implementationName>
> </externalResource>
> </externalResources>
> <externalResourceBindings>
> <externalResourceBinding>
> <key>ValidGridZones</key>
> <resourceName>ValidMakersFile</resourceName>
> </externalResourceBinding>
> </externalResourceBindings>
> </resourceManagerConfiguration>
>
> I am using the StringMapResource code that was in the examples, modified
> to use a ConcurrentHashMap instead of a regular Hashmap. According to
> logging outputs, I believe that the initialize() methods for all 5
> instances of the analysis engine finished. I believe that the
> StringMapResource_Impl is thread-safe and the errors goes away if I do not
> get the external resource. Am I doing something wrong in terms of the
> getting the external resource? Thanks.
>