Skip to content
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

jdk11启动加密后jar失败,是不是xjar与jdk11不兼容呢? #111

Open
1262135749 opened this issue May 19, 2022 · 4 comments
Open

Comments

@1262135749
Copy link

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.xjar.reflection.XReflection (file:/usr/local/services/new.jar) to field java.net.URLClassLoader.ucp
WARNING: Please consider reporting this to the maintainers of io.xjar.reflection.XReflection
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.reflect.InaccessibleObjectException: Unable to make public jdk.internal.loader.Resource jdk.internal.loader.URLClassPath.getResource(java.lang.String) accessible: module java.base does not "exports jdk.internal.loader" to unnamed module @76a3e297
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
at io.xjar.reflection.XReflection.method(XReflection.java:35)
at io.xjar.boot.XBootClassLoader.(XBootClassLoader.java:42)
at io.xjar.boot.XJarLauncher.createClassLoader(XJarLauncher.java:31)
at org.springframework.boot.loader.ExecutableArchiveLauncher.createClassLoader(ExecutableArchiveLauncher.java:92)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:55)
at io.xjar.boot.XJarLauncher.launch(XJarLauncher.java:26)
at io.xjar.boot.XJarLauncher.main(XJarLauncher.java:22)
panic: exit status 1

@1262135749
Copy link
Author

java version "11.0.10"

@tanyaofei
Copy link

这个是由于 jdk9 以上引入了 export module 的概念,启动参数添加这个可以解决 --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
例如:./xjar java --add-opens java.base/jdk.internal.loader=ALL-UNNAMED -jar ./*.xjar

https://www.coder.work/article/61641

@Bahramudin
Copy link

Bahramudin commented Apr 27, 2023

@1262135749 你这个解决了吗?或者有没有什么更好的替代品?谢谢!

@Bahramudin
Copy link

@tanyaofei 我用的是Java17和Springboot3,加上了您说的那些参数 还是报错。这怎么办?谢谢!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants