Open justin2004 opened 3 years ago
using the same example.tar.gz file i am able to instantiate that class with clojure. so i think that tells us there is something about ABCL's classloader that is having trouble.
project.clj
(defproject hl7 "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/java.classpath "1.0.0"]]
:resource-paths ["shared-things-1.0.0-jar-with-dependencies.jar" "."]
:repl-options {:init-ns hl7.core})
(ns hl7.core)
(new io.github.linuxforhealth.hl7.HL7ToFHIRConverter)
> #object[io.github.linuxforhealth.hl7.HL7ToFHIRConverter 0x167b4a07 "io.github.linuxforhealth.hl7.HL7ToFHIRConverter@167b4a07"]
I believe you don't have all the dependencies correctly assembled in "shared-things-1.0.0-jar-with-dependencies.jar".
When I build the jar from https://github.com/LinuxForHealth/hl7v2-fhir-converter, and try to instantiate the
CL-USER> (java:add-to-classpath "/home/mevenson/work/hl7v2-fhir-converter/build/libs/hl7v2-fhir-converter-1.0.1-SNAPSHOT.jar
T
CL-USER> (jss:new "io.github.linuxforhealth.hl7.HL7ToFHIRConverter")
; Evaluation aborted on #<JAVA-EXCEPTION java.lang.NoClassDefFoundError: ca/uhn/hl7v2/HL7Exception {14A98F82}>.
which is telling me I don't have all the necessary runtime dependencies to instantiate this class, as it depends in the presence of ca.uhn.hl7v2.HL7Exception
.
I tried downloading the necessary artifacts from Maven, but the dependency chain fails with errors in finding com.ibm.fhir:fhir-term.jar:4.4.0
If you can give me a simple, reproducible recipe for assembling the artifacts necessary to run this thing, perhaps via Maven coordinates that actually resolve, perhaps I can help you further.
I see no evidence that the ABCL classloader is broken, more that it isn't easy to get a handle on the necessary dependencies to instantiate this class.
I believe you don't have all the dependencies correctly assembled in "shared-things-1.0.0-jar-with-dependencies.jar".
correct. which is why i included a tar.gz file which includes a directory called "io" which has the correct path structure and .class files necessary to instantiate io.github.linuxforhealth.hl7.HL7ToFHIRConverter. and then i add the pwd
to the classpath so that ./io/github/linuxforhealth/hl7/HL7ToFHIRConverter.class, for example, exists.
the combination of shared-things-1.0.0-jar-with-dependencies.jar and the "io" subdirectory on the classpath are necessary.
my pwd
was /mnt so i did
(java:add-to-classpath "/mnt/")
also there are a few other files in the tar.gz that are needed to successfully instantiate that class. e.g. config.properties
and i was able to instantiate that class by extracting the contents in my pwd
(not with ABCL, however).
@easye i think the bug might be due to the particular way that some .class files are in a jar and some are in the filesystem. do you want me to package this example up in a different way?
@easye do you want me to package this example up in a different way?
Yes, I would like you to try to distill the simplest case of your problem. I really don't want to download 106 Mib of unreproducible artifacts jar'd together: it tells me virtually nothing, other than there is some nightmare Java dependency hell being slopped together without understanding in the hopes that something might just work if we add this…
If you believe that it is a problem with .class files in a jar, and some on the filesystem, why not make the simplest possible test case that fails. Is one class in the jar sufficient to make things fail? Then provide that jar. And so on.
while attempting to instantiate the the primary class from this repo: https://github.com/LinuxForHealth/hl7v2-fhir-converter i noticed that ABCL runs into trouble.
without ABCL we can instantiate the class:
with ABCL 1.8.0 we can't instantiate it:
i'll attach the tar.gz file.