WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1649
Open
lukaszlenart wants to merge 1 commit intomainfrom
Open
WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1649lukaszlenart wants to merge 1 commit intomainfrom
lukaszlenart wants to merge 1 commit intomainfrom
Conversation
… is absent Detect Hibernate availability once at class-load time via Class.forName() and short-circuit all Hibernate-related methods immediately when absent. This eliminates repeated LinkageError/NoClassDefFoundError exceptions that cause significant performance degradation in applications without Hibernate on the classpath. Fixes https://issues.apache.org/jira/browse/WW-5622 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Class.forName()in bothStrutsProxyServiceand deprecatedProxyUtilisHibernateProxy(),isHibernateProxyMember(), andgetHibernateProxyTarget()immediately when Hibernate is absenttry/catch LinkageErrorblocks as safety net for partial classpath scenariosProblem
When Hibernate is not on the application classpath, every call to Hibernate proxy detection methods throws and catches
LinkageError. WhilecomputeIfAbsentcaching in 7.x limits this to one exception per unique class/member, applications with many distinct classes flowing through OGNL still experience thousands of caught exceptions, causing measurable performance degradation. The issue is most severe in Struts 6.x where caching is less effective.Fixes WW-5622
Test plan
StrutsProxyServiceTest— 36 tests passStrutsProxyServiceSpringIntegrationTest— 16 tests passSecurityMemberAccessTest— 98 tests passSpringProxyUtilTest— 6 tests passsupport/6.xbranch🤖 Generated with Claude Code