我正在尝试使用以下命令将 JDK 17 安装到 macOS BigSur (11.5.2)brew install openjdk@17
> brew install openjdk@17
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 3 formulae.
openjdk is already installed but outdated (so it will be upgraded).
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/manifests/17.0.1_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/blobs/sha256:75ee17c1331022fa8bf1e63f00fe903f23fe31d3a09021117d46b5f6ed1e26e1
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:75ee17c1331022fa8bf1e63f00fe903f23fe31d3a09021117d46b5f6ed1e26e1?se=2021-12-09T20%3A25%3A00Z&sig=NnB%2FO%2BGQF5ec6iqdKA4w29
######################################################################## 100.0%
==> Pouring openjdk--17.0.1_1.big_sur.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
openjdk is …Run Code Online (Sandbox Code Playgroud) 最近我正在将项目从 JDK 11 升级到 JDK 17。升级后,powermock 似乎出现问题。运行 AUT 时,出现以下错误:
java.lang.RuntimeException: PowerMock internal error: Should never throw exception at this level
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @3fc34119
Run Code Online (Sandbox Code Playgroud)
您是否知道此问题的任何解决方法,如果可以,请提供解决方案。
我在 spring boot 中有一个带有 oauth2 的小项目,我想运行资源服务器
设置:
当我想运行我的应用程序时,我有例外:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.12.jar:5.3.12]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
at …Run Code Online (Sandbox Code Playgroud) 现在正在测试将某些服务升级到 Java 17,因为 Java 17 已正式发布,但在编译 Gradle 7.2 Spring Boot 应用程序时遇到了以下问题:
> Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
An exception has occurred in the compiler (17). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you. …Run Code Online (Sandbox Code Playgroud) 我使用OpenJDK 17和来自Spring Initializr的 Maven Wrapper 3.8.2 (Maven 项目、JAR 打包、Java 17、Spring Boot 2.6.0)。没有额外的依赖项。
Run Code Online (Sandbox Code Playgroud)user@DESKTOP-U2OU5HG MINGW64 /c/Projects/my-project (master) $ java -version openjdk version "17" 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
运行任何./mvnw.cmd -version或 后./mvnw.cmd clean install,我总是收到以下消息:
Run Code Online (Sandbox Code Playgroud)Unrecognized VM option 'MaxPermSize=512m' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
切换到OpenJDK 16.0.2可以解决该问题,但是,我需要使用 Java 17。
如何让它运行?没有地方MaxPermSize=512m设置。
我找到了一个资料来源,描述了使用的默认 gc 根据可用资源而变化。看来jvm使用g1gc或serial gc取决于硬件和操作系统。
在某些硬件和操作系统配置上默认选择串行收集器
有人可以指出关于具体标准是什么以及如何在 dockerized/kubernetes 环境中应用的更详细的资料来源吗?换句话说:
可以将k8s中pod的资源请求设置为例如。1500 mCpu 让 jvm 使用串行 gc 并更改为 2 Cpu 将默认 gc 更改为 g1gc?何时使用哪个 gc 的限制是否会根据 jvm 版本(11 与 17)而变化?
Lombok添加lib后出现如下错误
An error has occurred. See error log for more details.
Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @1d1c37d5
Run Code Online (Sandbox Code Playgroud) 将 Java 版本更改为 17 后,我无法构建 Gradle 项目。
我正在使用 Gradle 7.3.1 版本,并且 Gradle 属性中有以下行:
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xms1g -Xmx4g -XX:+UseG1GC -XX:+CMSClassUnloadingEnabled
Run Code Online (Sandbox Code Playgroud)
然后我得到以下错误
Unrecognized VM option 'CMSClassUnloadingEnabled'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Run Code Online (Sandbox Code Playgroud)
如果我删除-XX:+CMSClassUnloadingEnabled然后我收到此错误:
Unable to make field private int java.lang.reflect.Field.modifiers accessible: module java.base does not "opens java.lang.reflect" to unnamed module @1b9ee3e0
Run Code Online (Sandbox Code Playgroud) 我们正在研究将应用程序从 JDK8 迁移到 JDK17。我们的一些模块使用基于 wsdl 的 Web 服务,其他一些模块使用 .xsd 模式等。无论如何,我们使用 JAXWS 和 JAXB api,这些 API 现在已从 JDK 版本 11 中删除并移至 Jakarta。
我已成功开始使用 jakarta 依赖项从 .wsdl 和 .xsd 文件生成源代码,并且使用 jakarta 导入正确生成了源代码
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElementRef;
Run Code Online (Sandbox Code Playgroud)
而以前它使用的javax.xml.bind.东西在编译时不再可用。我的问题是,虽然我已经成功生成了基于模式的源,但新生成器生成了不同的代码(类名、访问器等),我想在继续重构之前确认这是预期的行为。
例子:
我们的 .xsd 包含以下内容:
<xsd:complexType name="ForkStepType">
<xsd:annotation>
<xsd:appinfo>
<jxb:class name="ForkStep"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:LinearStepType">
<xsd:sequence/>
<xsd:attribute name="forkLevel" type="tns:ForkLevelType" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
使用 jaxb 版本的旧xjc生成器2.2.11将生成一个名为 的类ForkStep,我根据该jxb:class元素猜测。3.0.1另一方面,雅加达生成器生成一个名为ForkStepType我猜测来自 …
java ×10
java-17 ×10
gradle ×3
spring-boot ×2
aspectj ×1
eclipse ×1
homebrew ×1
jakarta-ee ×1
java-11 ×1
java-platform-module-system ×1
jenv ×1
jvm ×1
lombok ×1
macos ×1
maven ×1
mocking ×1
openjdk-17 ×1
powermock ×1
powermockito ×1
spring ×1
xsd ×1