Skip to content

ClassNotFoundException Caused by Missing Separator between Package and Class #524

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

Open
library233 opened this issue Jul 22, 2021 · 0 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@library233
Copy link

library233 commented Jul 22, 2021

Description

It is trying to get a fully qualified class name, using the package (PKG) joined by (+) the simple class name (clazz.getSimpleName()) as below.

String classInternalName = PKG + clazz.getSimpleName() + CLASS_LABEL + counter.getAndIncrement();

However, there is no separator, i.e. slash (/) between the package and the class.

Furthermore, there is also no trailing slash (/) for the package which is defined as below.

private static final String PKG = "org/springextensions/gef/serialization";

Eventually, the result like org/springextensions/gef/serializationCommandResponseInstantiator$Synthetic2, is incorrect.

Note there is supposed to be a slash (/) between serialization and Command actually.

Expected result would be like org/springextensions/gef/serialization/CommandResponseInstantiator$Synthetic2 instead.

Next, it will replace all of the slashes (/) by dots (.) and then try to load the class by the string, which leads to ClassNotFoundException further.

Example error message

The message below was generated by a simple project powered by spring-boot-starter-web, spring-data-geode and geode-core which does nothing other than just starting up.

InstantiatorRecoveryTask - Error ClassNotFoundException: org.springextensions.gef.serializationCommandResponseInstantiator$Synthetic2

Test case

Currently the test case is just simply checking for the symbol of inner class ($) as below, with no further validation.

@Test
public void testGeneratedClassName() throws Exception {
Instantiator instantiator = asmFactory.getInstantiator(SomeClass.class, 100);
assertTrue(instantiator.getClass().getName().contains("$"));
}

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants