The issue arose from using the Maven Assembly Plugin to naively build an executable jar with uimaFit components. Files supplied by different dependencies overwrote each other during packaging and some types could not be detected at runtime. The uimaFit documentation has this issue recorded in chapter 9: https://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#ugr.tools.uimafit.packaging <https://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#ugr.tools.uimafit.packaging>. We resolved the issue using the Maven Shade Plugin as shown in the document.
Thanks, Andrew > On Aug 23, 2017, at 2:06 PM, Jean-Karlo Accetta <[email protected]> > wrote: > > Hi Marshall, > > I work with Andrew. Thanks for the reply, this definitely helps! > > Best regards, > J.K. Accetta > > > > On 8/23/17 8:50 AM, Marshall Schor wrote: >> Hi, >> >> Those two listing of the type system appear to show that the *working* >> version >> does not have cTakes, and the *failing* version has cTakes. >> >> Any ideas why this might be so? >> >> The stack trace appears to show that the "FileSystemCollectionReader" class >> is >> running the getNext method, and that is attempting to create an instance of >> the >> JCas class com.clinacuity.deid.annotations.DocumentInformationAnnotation. >> >> The error message indicates that whatever causes the class >> com.clinacuity.deid.annotations.DocumentInformationAnnotation to be "loaded" >> & >> "initialized" by Java's class loader is happening before the type system has >> been committed. >> >> It seems that the FileSystemCollectionReader is being run in some separate >> thread. If your system design is permitting this to happen in a race with >> another thread which is setting up the type system and committing it, you >> could >> get this error. The fact that a big type system might take longer to set up >> might account for why that one fails (the shorter one wins the race). >> >> Of course, for reliable operation, the race must be eliminated; a fix would >> be >> to delay starting threads that depend on the type system, until the type >> system >> has been committed. >> >> Does this help? >> >> -Marshall >> >> >> >> On 8/18/2017 8:55 AM, Andrew Trice wrote: >>> I am working with UIMA-Alpha02 and am currently trying to build a jar to >>> make a standalone application. (not pear because we want our users to have >>> just the JDK and not require ecilpse or UIMA) In many cases we use maven to >>> build and package the jar and it runs fine. Other times the jar is broken >>> so that the pipeline will always fail with this stacktrace: >>> 2017-08-17 14:53:54 [ERROR] DeidRunnerController.203: Throwing >>> java.lang.ExceptionInInitializerError: null >>> at >>> com.clinacuity.deid.ae.FileSystemCollectionReader.getNext(FileSystemCollectionReader.java:105) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> at com.clinacuity.deid.ae.DeidPipeline.execute(DeidPipeline.java:109) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> at >>> com.clinacuity.deid.gui.DeidPipelineTask.call(DeidPipelineTask.java:41) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> at >>> com.clinacuity.deid.gui.DeidPipelineTask.call(DeidPipelineTask.java:9) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) >>> ~[jfxrt.jar:?] >>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) >>> ~[?:1.8.0_121] >>> at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_121] >>> Caused by: org.apache.uima.cas.CASRuntimeException: A JCas class field >>> "documentType" is being initialized by non-framework (user) code before >>> Type System Commit for a type system with a corresponding type. Either >>> change the user load code to not do initialize, or to defer it until after >>> the type system commit. >>> at >>> org.apache.uima.cas.impl.TypeSystemImpl.getAdjustedFeatureOffset(TypeSystemImpl.java:2564) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> at >>> com.clinacuity.deid.annotations.DocumentInformationAnnotation.<clinit>(DocumentInformationAnnotation.java:23) >>> ~[deid-0.0.1-SNAPSHOT-jar-with-dependencies.jar:?] >>> ... 7 more >>> >>> I logged the JCas type system before this error occurs with this command: >>> jCas.getTypeSystem(), when it *passes* it shows the type system as this: >>> >>> TypeSystem: Type System <2,016,464,189>: >>> uima.cas.TOP: super: <null> >>> uima.cas.Integer: super: uima.cas.TOP >>> uima.cas.Float: super: uima.cas.TOP >>> uima.cas.String: super: uima.cas.TOP >>> uima.cas.ArrayBase: super: uima.cas.TOP >>> uima.cas.ListBase: super: uima.cas.TOP >>> uima.cas.Boolean: super: uima.cas.TOP >>> uima.cas.Byte: super: uima.cas.TOP >>> uima.cas.Short: super: uima.cas.TOP >>> uima.cas.Long: super: uima.cas.TOP >>> uima.cas.Double: super: uima.cas.TOP >>> uima.cas.Sofa: super: uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> sofaNum/uima.cas.Integer/F, >>> sofaID/uima.cas.String/F, >>> mimeType/uima.cas.String/F, >>> sofaArray/uima.cas.TOP/T, >>> sofaString/uima.cas.String/F, >>> sofaURI/uima.cas.String/F] >>> uima.cas.AnnotationBase: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> sofa/uima.cas.Sofa/F] >>> com.clinacuity.deid.uima.core.type.Lemma: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> key/uima.cas.String/F, >>> posTag/uima.cas.String/F] >>> com.clinacuity.deid.uima.core.type.OntologyConcept: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> codingScheme/uima.cas.String/F, >>> code/uima.cas.String/F, >>> oid/uima.cas.String/F] >>> >>> but when it *fails* I get this: >>> >>> TypeSystem: Type System <815,926,310>: >>> uima.cas.TOP: super: <null> >>> uima.cas.Integer: super: uima.cas.TOP >>> uima.cas.Float: super: uima.cas.TOP >>> uima.cas.String: super: uima.cas.TOP >>> uima.cas.ArrayBase: super: uima.cas.TOP >>> uima.cas.ListBase: super: uima.cas.TOP >>> uima.cas.Boolean: super: uima.cas.TOP >>> uima.cas.Byte: super: uima.cas.TOP >>> uima.cas.Short: super: uima.cas.TOP >>> uima.cas.Long: super: uima.cas.TOP >>> uima.cas.Double: super: uima.cas.TOP >>> uima.cas.Sofa: super: uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> sofaNum/uima.cas.Integer/F, >>> sofaID/uima.cas.String/F, >>> mimeType/uima.cas.String/F, >>> sofaArray/uima.cas.TOP/T, >>> sofaString/uima.cas.String/F, >>> sofaURI/uima.cas.String/F] >>> uima.cas.AnnotationBase: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> sofa/uima.cas.Sofa/F] >>> org.apache.ctakes.typesystem.type.refsem.Element: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> id/uima.cas.Integer/F, >>> >>> ontologyConcept/org.apache.ctakes.typesystem.type.refsem.OntologyConcept/F, >>> >>> mentions/org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation[]/F, >>> discoveryTechnique/uima.cas.Integer/F, >>> confidence/uima.cas.Double/F, >>> conditional/uima.cas.Boolean/F, >>> generic/uima.cas.Boolean/F, >>> subject/uima.cas.String/F, >>> polarity/uima.cas.Integer/F, >>> uncertainty/uima.cas.Integer/F, >>> historyOf/uima.cas.Integer/F] >>> org.apache.ctakes.typesystem.type.refsem.EventProperties: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> contextualModality/uima.cas.String/F, >>> contextualAspect/uima.cas.String/F, >>> permanence/uima.cas.String/F, >>> category/uima.cas.String/F, >>> aspect/uima.cas.String/F, >>> docTimeRel/uima.cas.String/F, >>> degree/uima.cas.String/F, >>> polarity/uima.cas.Integer/F] >>> org.apache.ctakes.typesystem.type.refsem.OntologyConcept: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> codingScheme/uima.cas.String/F, >>> code/uima.cas.String/F, >>> oid/uima.cas.String/F, >>> oui/uima.cas.String/F, >>> score/uima.cas.Double/F, >>> disambiguated/uima.cas.Boolean/F] >>> org.apache.ctakes.typesystem.type.relation.Relation: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> id/uima.cas.Integer/F, >>> category/uima.cas.String/F, >>> discoveryTechnique/uima.cas.Integer/F, >>> confidence/uima.cas.Double/F, >>> polarity/uima.cas.Integer/F, >>> uncertainty/uima.cas.Integer/F, >>> conditional/uima.cas.Boolean/F] >>> org.apache.ctakes.typesystem.type.relation.RelationArgument: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> id/uima.cas.Integer/F, >>> argument/uima.tcas.Annotation/F, >>> role/uima.cas.String/F, >>> participatesIn/uima.cas.FSList/F] >>> org.apache.ctakes.typesystem.type.structured.Demographics: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> birthDate/uima.cas.String/F, >>> deathDate/uima.cas.String/F, >>> gender/uima.cas.String/F, >>> firstName/uima.cas.String/F, >>> middleName/uima.cas.String/F, >>> lastName/uima.cas.String/F, >>> firstNameSoundex/uima.cas.String/F, >>> lastNameSoundex/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.structured.DocumentClassification: >>> super: uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> label/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.structured.DocumentID: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> documentID/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.structured.DocumentIdPrefix: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> documentIdPrefix/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.structured.DocumentPath: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> documentPath/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.structured.Metadata: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> patientID/uima.cas.Long/F, >>> providerID/uima.cas.LongArray/F, >>> sourceData/org.apache.ctakes.typesystem.type.structured.SourceData/F, >>> >>> demographics/org.apache.ctakes.typesystem.type.structured.Demographics/F] >>> org.apache.ctakes.typesystem.type.structured.SourceData: super: >>> uima.cas.TOP, FeaturesIntroduced/Range/multiRef: [ >>> noteTypeCode/uima.cas.String/F, >>> noteSubTypeCode/uima.cas.String/F, >>> authorSpecialty/uima.cas.String/F, >>> documentStandard/uima.cas.String/F, >>> sourceInstanceId/uima.cas.String/F, >>> sourceRevisionNbr/uima.cas.Integer/F, >>> sourceRevisionDate/uima.cas.String/F, >>> sourceOriginalDate/uima.cas.String/F, >>> sourceInstitution/uima.cas.String/F, >>> sourceEncounterId/uima.cas.String/F, >>> sourceApplication/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.syntax.Lemma: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> key/uima.cas.String/F, >>> posTag/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.util.Pair: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> attribute/uima.cas.String/F, >>> value/uima.cas.String/F] >>> org.apache.ctakes.typesystem.type.util.Pairs: super: uima.cas.TOP, >>> FeaturesIntroduced/Range/multiRef: [ >>> pairs/org.apache.ctakes.typesystem.type.util.Pair[]/F] >>> >>> Note that cTakes is an external library built on top of UIMA, we used the >>> UIMA 3 migration tool to modify the type system of cTakes (with the >>> <Optional> bug fixed that was in UIMA 3 in the spring). >>> >>> Is anyone familiar with any issues with UIMA 3, maven, or jars that would >>> cause a race condition that occurs only on build? I'm really scratching my >>> head on this one. >>> I can provide more code related to creating the TypeSystemDescription, the >>> FileSystemCollectionReader, and the DocumentInformationAnnotation if needed. >>> >>> Thanks, >>> Andrew >>> >
