WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1650
Open
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
Open
WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1650lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
Conversation
…NoClassDefFoundError Detect Hibernate availability once at class-load time via Class.forName() and short-circuit all Hibernate-related methods immediately when absent. This eliminates repeated NoClassDefFoundError exceptions that cause significant performance degradation in applications without Hibernate on the classpath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0aa13da to
98a3c1c
Compare
98a3c1c to
2eede24
Compare
|
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()inProxyUtilisHibernateProxy(),isHibernateProxyMember(), andgetHibernateProxyTarget()immediately when Hibernate is absentcatch (NoClassDefFoundError)blocks as safety net (intentionally narrower thanLinkageError— broken Hibernate installs should fail visibly)Problem
When Hibernate is not on the application classpath, every call to Hibernate proxy detection methods throws and catches
NoClassDefFoundError. SinceisProxy()andisProxyMember()are invoked on every OGNL evaluation, this produces hundreds of thousands of caught exceptions, causing severe performance degradation.Backport of #1649 (Struts 7) to
release/struts-6-8-x.Fixes WW-5622
Test plan
SpringProxyUtilTest— 3 tests passutil.**tests — 89 pass (4 failures in unrelatedDefaultFileManagerTest)🤖 Generated with Claude Code