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

JDK 9+ compatibility: DataHandler missing #107

Open
n2o opened this issue Feb 27, 2020 · 4 comments
Open

JDK 9+ compatibility: DataHandler missing #107

n2o opened this issue Feb 27, 2020 · 4 comments

Comments

@n2o
Copy link

n2o commented Feb 27, 2020

In JDK9+, DataHandler appears to be dropped. Therefore, an error is thrown:

#error {
 :cause javax.activation.DataHandler
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message Syntax error compiling at (postal/message.clj:1:1).
   :data #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source postal/message.clj}
   :at [clojure.lang.Compiler load Compiler.java 7648]}
  {:type java.lang.ClassNotFoundException
   :message javax.activation.DataHandler
   :at [java.net.URLClassLoader findClass URLClassLoader.java 436]}]}

To add a workaround, one can add this dependency to your project:

[com.sun.activation/javax.activation "1.2.0"]

Tested with AdoptOpenJDK 13

But this is just a workaround. Please update the corresponding lines in the code base.

Thanks!

@dancek
Copy link

dancek commented May 11, 2020

Adding a dependency seems to also be the correct fix per JEP 320, though [javax.activation/javax.activation-api "1.2.0"] is suggested.

The JavaMail API still uses javax.activation.DataHandler legitimately.

@caleb
Copy link

caleb commented Sep 14, 2020

So I shouldn't have issues with postal an JDK > 8 if I add that dependency?

Would a solution for postal be to include that library or to include a mention in the README?

@dancek
Copy link

dancek commented Sep 15, 2020

We've been using the dependency and postal in production since May, and have had no issues.

I'm not sure if adding the dependency in postal itself causes issues in JDK 8 but it's what I would do.

@wildwestrom
Copy link

wildwestrom commented Aug 29, 2021

Even after adding [com.sun.activation/javax.activation "1.2.0"] as a dependency, when I call send-message I get this:

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling postal/message.clj at (1:1)
   #:clojure.error{:phase :compile-syntax-check,
                   :line 1,
                   :column 1,
                   :source "postal/message.clj"}

1. Caused by java.lang.ClassNotFoundException
   javax.mail.Message
   [stacktrace....]
java --version
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment Homebrew (build 16.0.2+0)
OpenJDK 64-Bit Server VM Homebrew (build 16.0.2+0, mixed mode, sharing)

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

No branches or pull requests

4 participants