Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin clojure build image to an older tag #38

Merged
merged 2 commits into from
Sep 16, 2020
Merged

Conversation

gmile
Copy link
Contributor

@gmile gmile commented Sep 9, 2020

My name is Eugene, I'm exploring the possibility of using stencil in Contractbook, the company I work for. When trying to build an image, I've stumbled upon an issue.

With clojure base image tagged as "latest", it is not possible to build that image. The following error is returned:

Step 6/15 : RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" myapp-standalone.jar
 ---> Running in 288116953c6e
Compiling stencil.service.core
java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(server.clj:1:1)
Exception in thread "main" java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(server.clj:1:1)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3700)
  ...
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
  ...

According to https://stackoverflow.com/a/43574427/80851, a specific set of modules is missing from recent versions of Java.

This commit pins clojure image to an older tag, e.g. clojure:lein-2.8.1 to fix building the image.

There only reason I choose clojure:lein-2.8.1 was to pick an old one enough to build the image. There's likely a more appropriate version to choose. Separately, I believe a better solution would be to update the code / dependencies to not rely on deprecated Java modules.

I do not program in Java, so I went with smallest possible fix that unblocks me from building the images.

With clojure base image tagged as "latest", it is not possible to build that
image. The following error is returned:

  Step 6/15 : RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" myapp-standalone.jar
   ---> Running in 288116953c6e
  Compiling stencil.service.core
  java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(server.clj:1:1)
  Exception in thread "main" java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(server.clj:1:1)
          at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3700)
    ...
  Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
          at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
          at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
    ...

According to https://stackoverflow.com/a/43574427/80851, a specific set
of modules is missing from recent versions of Java.

This commit pins clojure image to an older tag, e.g. clojure:lein-2.8.1 to fix
building the image.
@erdos
Copy link
Owner

erdos commented Sep 16, 2020

Hello Eugene, thank you for the contribution. This is a good catch and you are right about the proposed solution: explicit versioning should be used. I will investigate how we can go with more recent versions. Merging now :)

@erdos erdos merged commit 2e4901a into erdos:master Sep 16, 2020
@gmile gmile deleted the fix-docker-build branch September 16, 2020 20:21
@gmile
Copy link
Contributor Author

gmile commented Sep 16, 2020

@erdos thank you, and thanks a lot for the tool! We've successfully deployed it and using it in our staging environment now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants