Closed liukeshao closed 2 years ago
JEP 396: Strongly Encapsulate JDK Internals by Default 由于JEP 396的原因,现在需要使用参数--illegal-access=permit 即使等jdk 17,这个也是需要支持的,希望可以先支持这个
Could you please list some issues cause Dubbo not support JDK16
使用dubbo 2.7.11版本,抛以下异常 如果使用 --illegal-access=permit 则可以正常启动
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-05-17 16:59:24.454 ERROR 33521 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Failed to create adaptive instance: java.lang.IllegalStateException: Can't create adaptive extension interface org.apache.dubbo.metadata.report.MetadataReportFactory, cause: Failed to compile class, cause: null, class: org.apache.dubbo.metadata.report.MetadataReportFactory$Adaptive, code:
package org.apache.dubbo.metadata.report;
import org.apache.dubbo.common.extension.ExtensionLoader;
public class MetadataReportFactory$Adaptive implements org.apache.dubbo.metadata.report.MetadataReportFactory {
public org.apache.dubbo.metadata.report.MetadataReport getMetadataReport(org.apache.dubbo.common.URL arg0) {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
String extName = ( url.getProtocol() == null ? "redis" : url.getProtocol() );
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.metadata.report.MetadataReportFactory) name from url (" + url.toString() + ") use keys([protocol])");
org.apache.dubbo.metadata.report.MetadataReportFactory extension = (org.apache.dubbo.metadata.report.MetadataReportFactory)ExtensionLoader.getExtensionLoader(org.apache.dubbo.metadata.report.MetadataReportFactory.class).getExtension(extName);
return extension.getMetadataReport(arg0);
}
}
, stack: java.lang.ExceptionInInitializerError:
java.lang.ExceptionInInitializerError
at javassist.util.proxy.DefineClassHelper.
at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:600) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.metadata.report.MetadataReportInstance.init(MetadataReportInstance.java:47) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.startMetadataCenter(DubboBootstrap.java:647) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.initialize(DubboBootstrap.java:528) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:872) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:69) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:62) ~[dubbo-2.7.11.jar:2.7.11]
at com.alibaba.spring.context.OnceApplicationContextEventListener.onApplicationEvent(OnceApplicationContextEventListener.java:52) ~[spring-context-support-1.0.10.jar:na]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.6.jar:5.3.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) ~[spring-boot-2.4.5.jar:2.4.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.5.jar:2.4.5]
at provicer.Application.main(Application.java:16) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Can't create adaptive extension interface org.apache.dubbo.metadata.report.MetadataReportFactory, cause: Failed to compile class, cause: null, class: org.apache.dubbo.metadata.report.MetadataReportFactory$Adaptive, code:
package org.apache.dubbo.metadata.report;
import org.apache.dubbo.common.extension.ExtensionLoader;
public class MetadataReportFactory$Adaptive implements org.apache.dubbo.metadata.report.MetadataReportFactory {
public org.apache.dubbo.metadata.report.MetadataReport getMetadataReport(org.apache.dubbo.common.URL arg0) {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
String extName = ( url.getProtocol() == null ? "redis" : url.getProtocol() );
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.metadata.report.MetadataReportFactory) name from url (" + url.toString() + ") use keys([protocol])");
org.apache.dubbo.metadata.report.MetadataReportFactory extension = (org.apache.dubbo.metadata.report.MetadataReportFactory)ExtensionLoader.getExtensionLoader(org.apache.dubbo.metadata.report.MetadataReportFactory.class).getExtension(extName);
return extension.getMetadataReport(arg0);
}
}
, stack: java.lang.ExceptionInInitializerError:
java.lang.ExceptionInInitializerError
at javassist.util.proxy.DefineClassHelper.
at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:1031) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:596) ~[dubbo-2.7.11.jar:2.7.11]
... 21 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to compile class, cause: null, class: org.apache.dubbo.metadata.report.MetadataReportFactory$Adaptive, code:
package org.apache.dubbo.metadata.report;
import org.apache.dubbo.common.extension.ExtensionLoader;
public class MetadataReportFactory$Adaptive implements org.apache.dubbo.metadata.report.MetadataReportFactory {
public org.apache.dubbo.metadata.report.MetadataReport getMetadataReport(org.apache.dubbo.common.URL arg0) {
if (arg0 == null) throw new IllegalArgumentException("url == null");
org.apache.dubbo.common.URL url = arg0;
String extName = ( url.getProtocol() == null ? "redis" : url.getProtocol() );
if(extName == null) throw new IllegalStateException("Failed to get extension (org.apache.dubbo.metadata.report.MetadataReportFactory) name from url (" + url.toString() + ") use keys([protocol])");
org.apache.dubbo.metadata.report.MetadataReportFactory extension = (org.apache.dubbo.metadata.report.MetadataReportFactory)ExtensionLoader.getExtensionLoader(org.apache.dubbo.metadata.report.MetadataReportFactory.class).getExtension(extName);
return extension.getMetadataReport(arg0);
}
}
, stack: java.lang.ExceptionInInitializerError:
java.lang.ExceptionInInitializerError
at javassist.util.proxy.DefineClassHelper.
at org.apache.dubbo.common.compiler.support.AbstractCompiler.compile(AbstractCompiler.java:62) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.common.compiler.support.AdaptiveCompiler.compile(AdaptiveCompiler.java:45) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtensionClass(ExtensionLoader.java:1047) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtensionClass(ExtensionLoader.java:1040) ~[dubbo-2.7.11.jar:2.7.11]
at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:1029) ~[dubbo-2.7.11.jar:2.7.11]
... 22 common frames omitted
@liukeshao It seems as if is the issue of javassist?
javassist 升级到 3.28.0-GA 异常信息: module java.base does not "opens java.lang" to unnamed module @4278a03f
异常栈如下: java.lang.IllegalStateException: Failed to create adaptive instance: java.lang.IllegalStateException: Can't create adaptive extension interface org.apache.dubbo.metadata.report.MetadataReportFactory, cause: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4278a03f at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:600) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.metadata.report.MetadataReportInstance.init(MetadataReportInstance.java:47) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.config.bootstrap.DubboBootstrap.startMetadataCenter(DubboBootstrap.java:647) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.config.bootstrap.DubboBootstrap.initialize(DubboBootstrap.java:528) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:872) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:69) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:62) ~[dubbo-2.7.11.jar:2.7.11] at com.alibaba.spring.context.OnceApplicationContextEventListener.onApplicationEvent(OnceApplicationContextEventListener.java:52) ~[spring-context-support-1.0.10.jar:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.6.jar:5.3.6] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:782) ~[spring-boot-2.4.5.jar:2.4.5] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:774) ~[spring-boot-2.4.5.jar:2.4.5] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-2.4.5.jar:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.5.jar:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1340) ~[spring-boot-2.4.5.jar:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.5.jar:2.4.5] at provicer.Application.main(Application.java:16) ~[classes/:na] Caused by: java.lang.IllegalStateException: Can't create adaptive extension interface org.apache.dubbo.metadata.report.MetadataReportFactory, cause: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4278a03f at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:1031) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtension(ExtensionLoader.java:596) ~[dubbo-2.7.11.jar:2.7.11] ... 21 common frames omitted Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4278a03f at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[na:na] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na] at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na] at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na] at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:159) ~[javassist-3.28.0-GA.jar:na] at javassist.util.proxy.DefineClassHelper$JavaOther.defineClass(DefineClassHelper.java:213) ~[javassist-3.28.0-GA.jar:na] at javassist.util.proxy.DefineClassHelper$Java11.defineClass(DefineClassHelper.java:52) ~[javassist-3.28.0-GA.jar:na] at javassist.util.proxy.DefineClassHelper.toClass(DefineClassHelper.java:260) ~[javassist-3.28.0-GA.jar:na] at javassist.ClassPool.toClass(ClassPool.java:1240) ~[javassist-3.28.0-GA.jar:na] at javassist.CtClass.toClass(CtClass.java:1392) ~[javassist-3.28.0-GA.jar:na] at org.apache.dubbo.common.compiler.support.JavassistCompiler.doCompile(JavassistCompiler.java:82) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.compiler.support.AbstractCompiler.compile(AbstractCompiler.java:58) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.compiler.support.AdaptiveCompiler.compile(AdaptiveCompiler.java:45) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtensionClass(ExtensionLoader.java:1047) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.extension.ExtensionLoader.getAdaptiveExtensionClass(ExtensionLoader.java:1040) ~[dubbo-2.7.11.jar:2.7.11] at org.apache.dubbo.common.extension.ExtensionLoader.createAdaptiveExtension(ExtensionLoader.java:1029) ~[dubbo-2.7.11.jar:2.7.11] ... 22 common frames omitted
According to https://github.com/jboss-javassist/javassist/issues/369, maybe we should change some compiler code.
什么时间支持jdk 17呀 JEP 403: Strongly Encapsulate JDK Internals
现在有做JAVA 17的支持吗?
java 17需要加上这个参数: --add-opens java.base/java.lang=ALL-UNNAMED
Java 16 is not a LTS version , I think we should wait for Java 17