我一直在使用JDK 9&10和CXF codegen插件3.2.5和3.2.6没有问题,但今天我正在尝试将我的代码库从Oracle JDK 10更新到OpenJDK 11 build 28,但我总是得到同样的错误:
[INFO] Error occurred during initialization of boot layer
[INFO] java.lang.module.FindException: Module java.xml.ws not found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.747 s
[INFO] Finished at: 2018-10-17T16:38:38+02:00
[INFO] Final Memory: 17M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.2.6:wsdl2java (cerberus-wsdl) on project cerberus:
[ERROR] Exit code: 1
[ERROR] Command line was: /opt/prod_jdk/bin/java --add-modules java.activation,java.xml.bind,java.xml.ws --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.marshaller=ALL-UNNAMED --add-opens java.xml.ws/javax.xml.ws.wsaddressing=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens …Run Code Online (Sandbox Code Playgroud) 实验性地在Java 9中引入的HttpClient现在在Java 11中是稳定的,但毫不奇怪,很少有项目似乎实际使用它.文档几乎不存在.
在进行HTTP调用时,最常见的一个问题是记录请求/响应.你如何使用HttpClient,而不是在每次通话中手动记录它?是否有像所有其他HTTP客户端提供的拦截器机制?
我的模块化 JavaFX 应用程序有问题。我创建了一个 JavaFX 项目并添加了 JavaFX 库和 JavaFX 模块得到认可。但是,我不断收到这些错误消息:
Run Code Online (Sandbox Code Playgroud)Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found
完整设置的图像在此附上:
编辑:
这是所有错误消息:
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -Djava.library.path=
/home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib --module-
-path=~/Documents/JavaTools/javafx-sdk-11.0.1/lib
--add-modules=javafx.controls,javafx.fxml
--add-modules javafx.base,javafx.graphics --add-reads
-javaagent:/home/thenekolite/idea-IU-183.4588.61/
lib/idea_rt.jar=35937:/home/thenekolite/idea-IU-183.4588.61/bin
-Dfile.encoding=UTF-8 -classpath /home/thenekolite/IdeaProjects/
Latihan1/out/production/Latihan1:/home thenekolite/Documents/JavaTools/
javafx-sdk-11.0.1/lib/src.zip:/home/thenekolite/Documents/JavaTools/
javafx-sdk-11.0.1/lib/javafx-swt.jar:/homehome/thenekolite/Documents
/JavaTools/javafx-sdk-11.0.1/lib/javafx.fxml.jar:/home/thenekolite/
Documents/JavaTools/javafx-sdk-11.0.1/libjavafx.media.jar:
/home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib/
/javafx.swing.jar:/home/thenekolite/Documents/JavaTools/javafx
sdk-11.0.1/lib/javafx.controls.jar:/home/thenekolite/
Documents/JavaTools/javafx-sdk-11.0.1/lib/javafx.graphics.jar
-p /home/thenekolite/Documents/JavaTools/javafx-sdk-11.0.1/lib/
/javafx.base.jar:/home/thenekolite/Documents/
JavaTools/javafx-sdk-11.0.1/lib/javafx.graphics.jar sample.Main
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
Run Code Online (Sandbox Code Playgroud)
我还添加了 vm 选项:
但是,我仍然收到此错误消息。
有没有办法java.net.http.HttpClient立即释放它所持有的资源?
在内部,它包含一个选择器,一个连接池和一个Executor(当使用默认值时).但它没有实现Closeable/ AutoCloseable.
据我了解,Java JRE 是向后兼容的,如果您使用 Java (JDK) 7 编写程序,它将与 Java (JRE) 8 一起运行。
我有几个用 Java 8 开发的程序,并且有我在完成它们时构建的 .jar 和 EXE 文件,它们总是运行良好。但是,在安装 Java JDK 11 (11.0.2) 后,这些旧的 .jar 文件会损坏...
我知道这个类和其他一些 javax 类已从 JDK 11 中删除,因此从开发的角度来看,如果没有 Maven 等工具,您将无法再使用它们。但我不明白为什么安装 JDK 11 对我的旧 jar 有任何影响,因为我没有安装新的 JRE,即使有一个,它也应该向后兼容?
另外,我使用 Apache NetBeans 10,它在 Java 8 上运行良好,但是在我安装 JDK 11 后,NetBeans 10 仍然运行,但它的加载窗口又大又模糊,IDE 的图像也很模糊,所有文本都是大。
那么为什么安装 JDK 11 会对旧程序产生这些负面影响呢?
注意 - 我已经尝试将 jars/EXE 与 JRE 版本 8 (201) 中的 javaw.exe 相关联,但是,它们仍然存在相同的问题。
在通过 HTTP/2 测试 Open JDK 11 HTTP 客户端时,有一个服务器端错误,看起来像是 JDK 11 错误。
该测试针对 Tomcat 9 服务器运行多个线程,测试所有线程是否使用 HTTP/2 和 TLS1.3。
令人担忧的是错误在“sun.security.ssl.SSLHandshake.produce”内部,这意味着它不是Tomcat,而是导致错误的JDK。
任何人都可以确认您在对 JDK 11 的 HTTP 层进行负载测试时有相同的经验吗?如果是这样,我会向 Open JDK 团队报告。
该错误仅在运行负载测试时才明显:
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:148) ~[na:na]
at java.base/sun.security.ssl.ServerHello$T13ServerHelloProducer.produce(ServerHello.java:551) ~[na:na]
at java.base/sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:436) ~[na:na]
at java.base/sun.security.ssl.ClientHello$T13ClientHelloConsumer.goServerHello(ClientHello.java:1224) ~[na:na]
at java.base/sun.security.ssl.ClientHello$T13ClientHelloConsumer.consume(ClientHello.java:1160) ~[na:na]
at java.base/sun.security.ssl.ClientHello$ClientHelloConsumer.onClientHello(ClientHello.java:849) ~[na:na]
at java.base/sun.security.ssl.ClientHello$ClientHelloConsumer.consume(ClientHello.java:810) ~[na:na]
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) ~[na:na] ...
Run Code Online (Sandbox Code Playgroud)
这个github项目用于测试。有关更多详细信息,请参阅项目自述文件。
在 Java 8 中,我通过执行以下步骤全局注册了 Bouncy Castle 安全提供程序:
jre/lib/extsecurity.provider.<N>=org.bouncycastle.jce.provider.BouncyCastleProvider jre/lib/security/java.security一切都工作得很好!
java.security现在在 Java 11 中,我在 中找到了conf/security/,这很好,但lib/ext在 Java 11 中就没有了。
在Java 11中全局注册Bouncy Castle的方法是什么?
我尝试创建 docker 镜像:
这是我的 Dockerfile:
FROM maven:3-jdk-11
# Common files and utils for build
RUN apt-get update && apt-get install -y make fakeroot rpm dpkg-dev apt-utils wget unzip
RUN apt-get install -y -q software-properties-common desktop-file-utils
# Then Wine with all deps
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get install -y --install-recommends wine
RUN apt-cache search openjdk
RUN apt-get install -y openjdk-11-jdk
RUN apt install -y openjfx11 libopenjfx-java libopenjfx-jni
RUN apt-get install -y --install-recommends wine32
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV …Run Code Online (Sandbox Code Playgroud) 有人可以帮助我理解我所看到的是 Java11 中故意的、正确的行为还是某种泄漏吗?让我们看一个愚蠢简单的 hello world 应用程序:
package com.example;
public class HelloWorld {
public static void main(String[] args) throws InterruptedException {
for( int i =0 ; i < 50; i++){
Thread.sleep(1000);
System.out.println("hello " + i);
}
}
}
Run Code Online (Sandbox Code Playgroud)
唯一有趣的部分是 jar 依赖项。它可以是任何 jar,但为了让问题更加引人注目,让我们使用一个大的 - 旧的 gwt-user jar,它重 30MB:
plugins {
id 'java'
}
group 'com.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/com.google.gwt/gwt-user
compile group: 'com.google.gwt', name: 'gwt-user', version: '2.7.0'
}
Run Code Online (Sandbox Code Playgroud)
运行应用程序,打开 jvisualvm,进行转储并查找保留的一组java.util.zip.ZipFile$Source:
类路径中的 jar(实际上从未使用过)占用 1.5MB 的堆。它不会在 GC …
Jdk : JAVA 11
无法在项目构建工具上执行目标 org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor): 执行目标 org.apache.maven.plugins:maven-plugin-plugin 的默认描述符: 3.2:descriptor failed: Index 22273 out of bounds for length 88 -> [Help 1]
<artifactId>buildtools</artifactId>
<packaging>maven-plugin</packaging>
<name>MYPojo</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<executions>
<execution>
<id>mojo-descriptor</id>
<phase>process-classes</phase>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- for maven plugin -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.6.3</version>
</dependency>
<!-- dependencies to annotations -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.6.3</version>
</dependency> …Run Code Online (Sandbox Code Playgroud) java-11 ×10
java ×8
maven ×3
bouncycastle ×1
debian ×1
docker ×1
heap-dump ×1
java-9 ×1
javafx-11 ×1
logging ×1
maven-plugin ×1
memory-leaks ×1
openjdk-11 ×1
openjfx ×1