Some more information: If I put the external file in the same module it works using this code .. And I am using the daffodil-built-in-catalog.xml to provide the location of the schema.
So if I set the logging as you suggested this output is produced: 2019-05-09 15:14:51:480 org.apache.daffodil.dsom.Import Resolver[Computing resolvedLocation] 2019-05-09 15:14:51:483 org.apache.daffodil.dsom.Import Resolver[ importElementNS='None' resolvedNamespaceURI='None' schemaLocationProperty='Some(file:/var/folders/4m/d8xs244900sd8ypzndkf4_3w0000gn/T/s7Schema3372165014658428820.dfdl.xsd)' resolvedSchemaLocation='Some(org.apache.daffodil.api.URISchemaSource@bd8ade61)'] 2019-05-09 15:14:51:485 org.apache.daffodil.dsom.DFDLSchemaFile Resolver[Loading file:/var/folders/4m/d8xs244900sd8ypzndkf4_3w0000gn/T/s7Schema3372165014658428820.dfdl.xsd.] 2019-05-09 15:14:51:493 org.apache.daffodil.xml.DFDLCatalogResolver Resolver[nsURI = http://www.w3.org/2001/XMLSchema, baseURI = file:/var/folders/4m/d8xs244900sd8ypzndkf4_3w0000gn/T/s7Schema3372165014658428820.dfdl.xsd, systemId = null] 2019-05-09 15:14:51:493 org.apache.daffodil.xml.DFDLCatalogResolver Resolver[Unable to resolve.] 2019-05-09 15:14:51:560 org.apache.daffodil.xml.DFDLCatalogResolver Resolver[nsURI = http://plc4x.apache.org/s7, baseURI = file:/var/folders/4m/d8xs244900sd8ypzndkf4_3w0000gn/T/s7Schema3372165014658428820.dfdl.xsd, systemId = null] 2019-05-09 15:14:51:561 org.apache.daffodil.xml.DFDLCatalogResolver Resolver[Found via XML Catalog: file:/Users/christofer.dutz/Projects/Apache/PLC4X/protocols/s7/target/classes/org/apache/plc4x/protocols/s7/protocol.dfdl.xsd.] org.apache.daffodil.exceptions.Abort: Invariant broken. Unexpected exception type org.apache.daffodil.exceptions.Abort: Invariant broken. found resource but couldn't open org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129) org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175) org.apache.daffodil.xml.DFDLCatalogResolver.resolveResource(DaffodilXMLLoader.scala:244) org.apache.xerces.util.DOMEntityResolverWrapper.resolveEntity(Unknown Source) org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129) org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175) org.apache.daffodil.dsom.DFDLSchemaFile.$anonfun$iiXMLSchemaDocument$1(DFDLSchemaFile.scala:155) org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129) at org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175) at org.apache.daffodil.dsom.DFDLSchemaFile.$anonfun$iiXMLSchemaDocument$1(DFDLSchemaFile.scala:155) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.DFDLSchemaFile.iiXMLSchemaDocument$lzycompute(DFDLSchemaFile.scala:137) at org.apache.daffodil.dsom.DFDLSchemaFile.iiXMLSchemaDocument(DFDLSchemaFile.scala:137) at org.apache.daffodil.dsom.Import.$anonfun$mapPair$3(Import.scala:66) at scala.Option.getOrElse(Option.scala:121) at org.apache.daffodil.dsom.Import.$anonfun$mapPair$1(Import.scala:45) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.Import.mapPair(Import.scala:43) at org.apache.daffodil.dsom.IIBase.$anonfun$notSeenThisBefore$1(IIBase.scala:140) at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.IIBase.notSeenThisBefore(IIBase.scala:139) at org.apache.daffodil.dsom.IIBase.$anonfun$iiSchemaFileMaybe$1(IIBase.scala:257) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.IIBase.iiSchemaFileMaybe(IIBase.scala:256) at org.apache.daffodil.dsom.IIBase.$anonfun$seenAfter$1(IIBase.scala:165) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.IIBase.seenAfter(IIBase.scala:164) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$getImportsOrIncludes$1(SchemaDocIncludesAndImportsMixin.scala:147) at scala.collection.TraversableOnce.$anonfun$foldLeft$1(TraversableOnce.scala:157) at scala.collection.TraversableOnce.$anonfun$foldLeft$1$adapted(TraversableOnce.scala:157) at scala.collection.Iterator.foreach(Iterator.scala:944) at scala.collection.Iterator.foreach$(Iterator.scala:944) at scala.collection.AbstractIterator.foreach(Iterator.scala:1432) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:157) at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:155) at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.getImportsOrIncludes(SchemaDocIncludesAndImportsMixin.scala:143) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.getImportsOrIncludes$(SchemaDocIncludesAndImportsMixin.scala:139) at org.apache.daffodil.dsom.XMLSchemaDocument.getImportsOrIncludes(SchemaDocument.scala:64) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$ismli_$1(SchemaDocIncludesAndImportsMixin.scala:158) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.ismli_(SchemaDocIncludesAndImportsMixin.scala:157) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.importStatementsMap(SchemaDocIncludesAndImportsMixin.scala:155) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.importStatementsMap$(SchemaDocIncludesAndImportsMixin.scala:155) at org.apache.daffodil.dsom.XMLSchemaDocument.importStatementsMap(SchemaDocument.scala:64) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.$anonfun$sali_$1(SchemaDocIncludesAndImportsMixin.scala:165) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.sali_(SchemaDocIncludesAndImportsMixin.scala:164) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.seenAfter(SchemaDocIncludesAndImportsMixin.scala:162) at org.apache.daffodil.dsom.SchemaDocIncludesAndImportsMixin.seenAfter$(SchemaDocIncludesAndImportsMixin.scala:162) at org.apache.daffodil.dsom.XMLSchemaDocument.seenAfter(SchemaDocument.scala:64) at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.$anonfun$allSchemaFiles$1(SchemaSetIncludesAndImportsMixins.scala:63) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:583) at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:581) at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.allSchemaFiles(SchemaSetIncludesAndImportsMixins.scala:61) at org.apache.daffodil.dsom.SchemaSetIncludesAndImportsMixin.allSchemaFiles$(SchemaSetIncludesAndImportsMixins.scala:61) at org.apache.daffodil.dsom.SchemaSet.allSchemaFiles(SchemaSet.scala:61) at org.apache.daffodil.dsom.SchemaSet.$anonfun$isValid$2(SchemaSet.scala:128) at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60) at org.apache.daffodil.dsom.SchemaSet.isValid$lzycompute(SchemaSet.scala:127) at org.apache.daffodil.dsom.SchemaSet.isValid(SchemaSet.scala:126) at org.apache.daffodil.compiler.ProcessorFactory.$anonfun$isError$3(Compiler.scala:110) at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60) at org.apache.daffodil.compiler.ProcessorFactory.$anonfun$isError$1(Compiler.scala:109) at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58) at org.apache.daffodil.ExecutionMode$.$anonfun$usingCompilerMode$1(ExecutionMode.scala:64) at org.apache.daffodil.compiler.ProcessorFactory.isError(Compiler.scala:109) at org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:320) at org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory.compileProcessor(DaffodilTDMLDFDLProcessor.scala:94) at org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory.$anonfun$getProcessor$1(DaffodilTDMLDFDLProcessor.scala:112) at org.apache.daffodil.tdml.SchemaCache.doCompile$lzycompute$1(SchemaCache.scala:95) at org.apache.daffodil.tdml.SchemaCache.doCompile$1(SchemaCache.scala:95) at org.apache.daffodil.tdml.SchemaCache.$anonfun$compileAndCache$1(SchemaCache.scala:108) at scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:82) at org.apache.daffodil.tdml.SchemaCache$Cache.getOrElseUpdate(SchemaCache.scala:51) at org.apache.daffodil.tdml.SchemaCache.compileAndCache(SchemaCache.scala:107) at org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory.getProcessor(DaffodilTDMLDFDLProcessor.scala:112) at org.apache.daffodil.tdml.TestCase.run(TDMLRunner.scala:759) at org.apache.daffodil.tdml.DFDLTestSuite.runOneTest(TDMLRunner.scala:382) at org.apache.plc4x.protocols.AbstractProtocolTest.lambda$getTestsuiteTests$0(AbstractProtocolTest.java:59) at org.junit.jupiter.engine.descriptor.JupiterTestDescriptor.executeAndMaskThrowable(JupiterTestDescriptor.java:141) at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:41) at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:24) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:113) at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$0(HierarchicalTestExecutor.java:115) at java.base/java.util.Optional.ifPresent(Optional.java:183) at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.lambda$invokeTestMethod$1(TestFactoryTestDescriptor.java:92) at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40) at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.invokeTestMethod(TestFactoryTestDescriptor.java:79) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:113) at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:121) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:121) at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:121) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:121) at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Does that help any further? Chris Am 09.05.19, 14:45 schrieb "Steve Lawrence" <[email protected]>: Yeah, this looks like a bug. Based on where that exception is thrown, it does look like it's able to find the file in the jar, but cannot open it for some reason. Unfortunately, our code to open it looks like this: try { uri.toURL.openStream() // This will work. } catch { case _: java.io.IOException => Assert.invariantFailed("found resource but couldn't open") } So the comment "This will work" is clearly wrong, and we end up masking the reason why it failed. That definitely needs to be fixed. If you bump the log level to LogLevel.Resolver, e.g.: Daffodil.setLoggingLevel(LogLevel.Resolver); Then it should output to the console a log starting with "Found on classpath" followed by the URI that import resolved to. That might help us figure out why it can't open a stream to the file if something looks off. - Steve On 5/9/19 8:04 AM, Christofer Dutz wrote: > Hi Steve, > > well if that's the case, then I am having trouble doing this. > > So In this case I have a base schema in "base.jar" and I add a dependency to this in "protocol" module. > If I try to use it I get an error message that daffodil has found something but it unable to open it. > > [ERROR] getTestsuiteTests[40] Time elapsed: 0.013 s <<< ERROR! > org.apache.daffodil.exceptions.Abort: > Invariant broken. Unexpected exception type org.apache.daffodil.exceptions.Abort: Invariant broken. found resource but couldn't open > org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129) > org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175) > org.apache.daffodil.xml.DFDLCatalogResolver.resolveResource(DaffodilXMLLoader.scala:244) > org.apache.xerces.util.DOMEntityResolverWrapper.resolveEntity(Unknown Source) > org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:129) > org.apache.daffodil.exceptions.Assert$.invariantFailed(Assert.scala:175) > org.apache.daffodil.dsom.DFDLSchemaFile.$anonfun$iiXMLSchemaDocument$1(DFDLSchemaFile.scala:155) > org.apache.daffodil.oolag.OOLAG$OOLAGValue.liftedTree1$1(OOLAG.scala:585) > at org.apache.plc4x.protocols.AbstractProtocolTest.lambda$getTestsuiteTests$0(AbstractProtocolTest.java:54) > > > Chris > > > > Am 09.05.19, 13:25 schrieb "Steve Lawrence" <[email protected]>: > > You should be able to import/include files in jars on the classpath > using the full path inside the jar, i.e. what "jar -jt foo.jar" outputs. > So if foo.jar was on your classpath and contained the following > > $ jar -jt foo.jar > META-INF/MANIFEST.MF > com/foo/dfdl/types.dfdl.xsd > > Your schema could reference the types.dfdl.xsd file with: > > <xs:include schemaLocation="com/foo/dfdl/types.dfdl.xsd" /> > > You don't need to specify which jar to import from or even that the > file comes from a jar. Daffodil will just search for that path in all > jars on the classpath. > > - Steve > > > On 5/9/19 6:19 AM, Christofer Dutz wrote: > > Hi all, > > > > after solving my last problem, I am stuck with another one … as I mentioned in > > the other thread I have one DFDL schema, which defines all the simple types that > > will be used by any PLC4X schema. > > > > In order to do so, this is located in a dedicated maven module and a dedicated jar. > > > > Now I added a dependency to that jar an now want to reference this in my > > protocol jar. > > > > No matter what I try, DFDL always complains about not being able to resolve this. > > > > So how can I reference and/or import schemas contained in another jar that’s in > > my classpath? > > > > Chris > > > > >
