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

java.lang.ClassNotFoundException: sun.reflect.ReflectionFactory #82

Open
omasseau opened this issue Apr 21, 2023 · 1 comment
Open

java.lang.ClassNotFoundException: sun.reflect.ReflectionFactory #82

omasseau opened this issue Apr 21, 2023 · 1 comment

Comments

@omasseau
Copy link

omasseau commented Apr 21, 2023

Running subzero on Wildlfy with JDK 11 I get this error :

java.lang.ClassNotFoundException: sun.reflect.ReflectionFactory from [Module "deployment.AofWeb.war" from Service Module Loader]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at deployment.AofWeb.war//info.jerrinot.subzero.relocated.org.objenesis.instantiator.sun.SunReflectionFactoryHelper.getReflectionFactoryClass(SunReflectionFactoryHelper.java:54)
@omasseau
Copy link
Author

Got the solution here :

https://stackoverflow.com/a/51592708/1879731

Still I'm not sure using sun.reflect.ReflectionFactory is a good idea as starting from jdk 9 classes in the sun.* package should not be used :

The sun.* packages are not part of the supported, public interface.

A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.

See: https://openjdk.org/jeps/260

java.lang.reflect.* package should be used instead.

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

1 participant