Ilya Kasnacheev created IGNITE-12483:
----------------------------------------
Summary: ReflectionFactory is essential thanks to
PlatformDotNetSessionLockResult
Key: IGNITE-12483
URL: https://issues.apache.org/jira/browse/IGNITE-12483
Project: Ignite
Issue Type: Bug
Components: binary
Reporter: Ilya Kasnacheev
We currently treat ReflectionFactory as a nice-to-have thing, so we silently
ignore failures of its reflection:
{code}
try {
Class<?> refFactoryCls =
Class.forName("sun.reflect.ReflectionFactory");
refFac =
refFactoryCls.getMethod("getReflectionFactory").invoke(null);
ctorFac =
refFac.getClass().getMethod("newConstructorForSerialization", Class.class,
Constructor.class);
}
catch (NoSuchMethodException | ClassNotFoundException |
IllegalAccessException | InvocationTargetException ignored) {
// No-op.
}
{code}
However, it is now essential thanks to the class
PlatformDotNetSessionLockResult, which is always registered during note
start-up and which does not have empty constructor.
So not having access to ReflectionFactory (JBoss will hide it, for example)
will lead to the following cryptic exception (courtesy stack overflow):
{code}
2019-12-19 09:11:39,355 SEVERE [org.apache.ignite.internal.IgniteKernal]
(ServerService Thread Pool -- 81) Got exception while starting (will rollback
startup routine).: class org.apache.ignite.binary.BinaryObjectException: Failed
to find empty constructor for class:
org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockResult
at
deployment.StreamsApp.ear//org.apache.ignite.internal.binary.BinaryClassDescriptor.constructor(BinaryClassDescriptor.java:981)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.binary.BinaryClassDescriptor.<init>(BinaryClassDescriptor.java:267)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.binary.BinaryContext.registerPredefinedType(BinaryContext.java:1063)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.binary.BinaryContext.registerPredefinedType(BinaryContext.java:1048)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.binary.BinaryContext.<init>(BinaryContext.java:350)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.start(CacheObjectBinaryProcessorImpl.java:208)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1700)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1013)
at
deployment.StreamsApp.ear//org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2038)
at
[email protected]//org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:88)
{code}
My suggestions are the following:
- Introduce a warning when ReflectionFactory not found instead of ignoring
exception.
- Add empty constructor to PlatformDotNetSessionLockResult and make sure no
other classes need reflection during start-up.
- (optionally) instead, introduce an error when ReflectionFactory not found.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)