Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-5054

JCas returning generic class instead of JCas cover class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.1SDK
    • None
    • Collection Processing
    • None

    Description

      A DKPro Core user reported that when deploying an AE in a CPE
      he was unable to access a JCas cover class in the
      entityProcessComplete(...) CPE callback. See: https://groups.google.com/d/msg/dkpro-core-user/-DtO5Ivnk9I/sjQAPPv1BwAJ

              public void entityProcessComplete(CAS cas, EntityProcessStatus status) {
                  try {
                      JCas jcas = cas.getJCas();
                      // here getting a JCas cover class fails. Instead,
                      // an AnnotationImpl is returned from the jcas.
                  } catch (CASException e) {
                      e.printStackTrace();
                  }
              }
      

      The problem appears to be that the static CAS classloaders are restored
      before invoking the entityProcessComplete() callback (CPMEngine 3468):

            try {
              if (null != cas)
                ((CASImpl)cas).switchClassLoaderLockCas(statCL);
              statCL.entityProcessComplete(cas, eps);
            } finally {
              if (null != cas) 
                ((CASImpl)cas).restoreClassLoaderUnlockCas();
            }
      

      Is there any reason that the classloaders are switched out before invoking the callback? If not, any objection if I change the code such that the callback is invoked before the classloaders are switched out?

      Thread [[Procesing Pipeline#7 Thread]::] (Suspended (breakpoint at line 1021 in CASImpl))	
      	CASImpl.setLocalFsGenerators(FSGenerator<FeatureStructure>[]) line: 1021	
      	FSClassRegistry.swapInGeneratorsForClassLoader(ClassLoader, CASImpl) line: 225	
      	JCasImpl.switchClassLoader(ClassLoader) line: 548	
      	CASImpl.switchClassLoader(ClassLoader) line: 4195	
      	CASImpl.switchClassLoaderLockCasCL(ClassLoader) line: 4183	
      	CASImpl.switchClassLoaderLockCas(Object) line: 4176	
      	CPMEngine.callEntityProcessCompleteWithCAS(StatusCallbackListener, CAS, EntityProcessStatus) line: 3472	
      	ProcessingUnit.doNotifyListeners(Object, boolean, EntityProcessStatus) line: 1650	
      	ProcessingUnit.notifyListeners(Object, boolean, EntityProcessStatus) line: 1592	
      	ProcessingUnit.processNext(Object[], ProcessTrace) line: 917	
      	ProcessingUnit.run() line: 575	
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rec Richard Eckart de Castilho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: