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
Not found JDK 11 java.net.http.HttpClient #419
Comments
I believe (without actually trying it just now) that the solution will be to include PL/Java does not (yet) treat your code as modular; effectively, it puts your code on the class path, not the module path. That would normally give your code the "unnamed module" behavior where dependencies don't have to be declared. PL/Java itself, however, is modular, so there is a restricted module graph in effect before your code is loaded, and your code can only use the modules that graph includes. So |
The existing modules documentation in PL/Java , I see, does not explain this very well. I will add to it. |
PL/Java code loaded with install_jar is treated as unnamed-module, legacy classpath code. Such code is advertised as having access to all readable modules, without having to declare dependencies (as it can't declare dependencies; it would have to be a named module to do that). Ah, but what are "all readable modules"? Only the ones enumerated at JVM startup, using as root modules PL/Java itself and anything named with --add-modules. So that option must be used if any Java modules will be needed beyond the ones PL/Java itself depends on. This added documentation addresses #419.
PR #446, #443, #442, #441, #445, #444. Addresses issues: Bug #416 crash with SQL_ASCII database and bad vmoptions Doc #419 better document the use of --add-modules in vmoptions Bug #425 install_jar from http URLs, add test to CI Feature #426 allow functions declared on an interface as well as a class Track PG #434 postgres/postgres@b9b21ac broke unpackaged ALTER UPDATE Track JDK #435 check and reject Java 20 builds with JDK-8309515 bug
Resolved in 1.6.5 by adding documentation for |
I have a simple PL/Java program of using JDK 11 (also tried 17) java.net.http.HttpClient to request another restful service. Successfully compiling by maven and
install_jar
andset_classpath
in PostgreSQL, but when executing the function, an error is thrown for 'java.lang.NoClassDefFoundError: java/net/http/HttpClient'.Have tried to add
java.net.http
jmod path topljava.module_path
, but not solve it. Could anyone help?The text was updated successfully, but these errors were encountered: