java-11

In Java 11 HttpClient how to solve restricted header name: Date

北慕城南 提交于 2019-12-19 06:39:09
问题 The following java 11 code: HttpRequest request = HttpRequest.newBuilder() .uri(uri) .header("Digest", digest) .header("Date", date) .build(); gives the following error: Exception in thread "main" java.lang.IllegalArgumentException: restricted header name: "Date" The problem is that the digest is based on the date, so I cannot simply rely on the http client date, because that will make the digest invalid. I need a way to either set the Date header, or to retrieve the Date header and then set

In Java 11 HttpClient how to solve restricted header name: Date

安稳与你 提交于 2019-12-19 06:38:03
问题 The following java 11 code: HttpRequest request = HttpRequest.newBuilder() .uri(uri) .header("Digest", digest) .header("Date", date) .build(); gives the following error: Exception in thread "main" java.lang.IllegalArgumentException: restricted header name: "Date" The problem is that the digest is based on the date, so I cannot simply rely on the http client date, because that will make the digest invalid. I need a way to either set the Date header, or to retrieve the Date header and then set

JDK 11+ and Javadoc

蓝咒 提交于 2019-12-19 04:09:07
问题 Exit code: 1 - javadoc: error - The code being documented uses packages in the unnamed module, but the packages defined in https://docs.oracle.com/en/java/javase/11/docs/api/ are in named modules. Has anyone been able to make javadoc work without having to change the source version to 1.8 (as suggested in other forums)? I'm using JDK v11.0.5 and the issue still present (also with JDK 12+). Edit: This error originated from maven and thrown by the maven-javadoc-plugin. I have not been able to

JShell access to variables defined outside of jshell instance

无人久伴 提交于 2019-12-19 02:49:07
问题 From inside jShell script, is it possible to access or register variables that are defined in code that's also creating JShell? Currently there seems to be no mechanism to either access or register a variable to Shell instance, or return none string types from inside JShell (like objects or lambda etc.) ex: import jdk.jshell.JShell; import jdk.jshell.JShellException; import jdk.jshell.SnippetEvent; import java.util.List; public class Main { public static void main(String[] args) throws

How to log request/response using java.net.http.HttpClient?

℡╲_俬逩灬. 提交于 2019-12-18 15:35:42
问题 The HttpClient introduced experimentally in Java 9 is now stable in Java 11, but not surprisingly, very few projects seem to actually use it. Documentation is almost non-existing. One of the most commons asks while making a HTTP call is logging of request/response. How would you do that using the HttpClient , without of course, logging it manually in every single call? Is there an interceptor mechanism like that offered by all other HTTP clients? 回答1: If we look at jdk.internal.net.http

Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource” (tomcat 9.0.12) [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-18 08:28:21
问题 This question already has answers here : What is the replacement for javax.activation package in java 9? (3 answers) Replacements for deprecated JPMS modules with Java EE APIs (7 answers) Closed last year . I'm migrating java project use JDK8 to use JDK 11 then has error occurred relate of javax activation. Following migration guide from Oracle, I see java.activation that module was removed from JDK 11. After that, I give a suggest to added third parties **activation-1.0.2.jar* but still, an

Migration to JDK 11 has error occure “java.lang.NoClassDefFoundError: javax/activation/DataSource” (tomcat 9.0.12) [duplicate]

孤者浪人 提交于 2019-12-18 08:28:18
问题 This question already has answers here : What is the replacement for javax.activation package in java 9? (3 answers) Replacements for deprecated JPMS modules with Java EE APIs (7 answers) Closed last year . I'm migrating java project use JDK8 to use JDK 11 then has error occurred relate of javax activation. Following migration guide from Oracle, I see java.activation that module was removed from JDK 11. After that, I give a suggest to added third parties **activation-1.0.2.jar* but still, an

Move to OpenJDK-11 but compile in Java 8

本小妞迷上赌 提交于 2019-12-18 05:54:55
问题 I have an existing Spring boot App that i build through gradle . All these days I have been using JDK / JRE 8 and now I am trying to use JDK-11 So to check the Compatability, I am setting the JAVA_HOME to JDK-11 but trying to compile in Java 8 mode I added the below block in my build.gradle compileJava { targetCompatibility = '1.8' } and then I set JAVA_HOME explicitly set JAVA_HOME=C:\Users\arun\Desktop\jdk-11.0.1 and then execute gradlew clean build But I am stopped with the below exception

JDK 11 SSL Error on valid certificate (working in previous versions)

亡梦爱人 提交于 2019-12-18 02:42:38
问题 The following code throws an error in JDK 11: HttpURLConnection con = (HttpURLConnection) new URL("https://sis.redsys.es/sis/realizarPago").openConnection(); con.setRequestMethod("GET"); con.getResponseCode(); The error is: javax.net.ssl.SSLHandshakeException: extension (10) should not be presented in server_hello at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128) at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117) at java.base/sun.security.ssl

Is there a replacement library for CORBA in JDK 11

爷,独闯天下 提交于 2019-12-17 23:06:09
问题 JDK-11 will remove a lot of older parts of the JDK (JEP-320). For some of them (e.g. JAXB) functionality will be provided as regular library. You simply add another dependency and everything works fine again. But not so for CORBA, because There is no significant interest in developing modern applications with CORBA in Java I am however in the painful situation of needing to maintain older applications that still require CORBA while still wanting to update to JDK-11. Is there a replacement