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

Solution to java.lang.NoSuchMethodException for org.zkoss.zel.BeanELResolver.__resetCache() in ZKPlugin #568

Closed
ignaciomarinreyes opened this issue Aug 18, 2024 · 1 comment

Comments

@ignaciomarinreyes
Copy link
Contributor

ignaciomarinreyes commented Aug 18, 2024

I encountered a NoSuchMethodException while upgrading from ZK Framework version 5.0.9 to 9.6.0.1, using HotSwap Agent 1.4.1, Java 1.8.0_121, and transitioning from Tomcat 8.5 to Tomcat 9. The error occurred as follows:

java.lang.NoSuchMethodException: org.zkoss.zel.BeanELResolver.__resetCache() at java.lang.Class.getDeclaredMethod(Class.java:2130) at org.hotswap.agent.plugin.zk.ZkPlugin$1.executeCommand(ZkPlugin.java:154) at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:43)

The method __resetCache() does not exist in the new ZK version. This problem arises because, in ZK 5.0.9, ConcurrentCache was an inner class of BeanELResolver. In ZK 9.6.0.1, it has been relocated and is no longer an inner class but a standalone class in a different package.

To resolve this reflection issue, the reference to ConcurrentCache needs to be updated in the source code. Here's the required change in the code:

this.cache = new org.zkoss.zel.BeanELResolver.ConcurrentCache(CACHE_SIZE);

this.cache = new org.zkoss.zel.impl.util.ConcurrentCache(CACHE_SIZE);

By updating the package path, the reflection mechanism can successfully locate and utilize the ConcurrentCache class, allowing the __resetCache method to be added without triggering a NoSuchMethodException.

This change ensures that the application remains compatible with the structural changes in the ZK Framework between versions 5 and 9.

In ZK9 HotSwap Agent 1.4.1 doesn´t work, you have to make this change and it works. You have to reset the cache.

@skybber
Copy link
Contributor

skybber commented Aug 18, 2024

Could you, please, create PR?

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

2 participants