Apache Wicket - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
Asked Answered
H

1

0

Need guidance regarding fixing of class not found error at runtime. I have checked all the similar answers, however wasn't able to solve the issue I'm facing.

The project compiles, war file gets deployed on Tomcat successfully without issues The following stacktrace comes when the first URL is hit, at runtime

cglib in my case comes as dependency of Apache Wicket IOC, which is dependent on wicketstuff-restannotations. wicketstuff-restannotations is added as a dependency in my build.sbt provided below.

  • I did tried to add cglib dependency manually as well in build.sbt. It shows in dependencyTree but still same exception at run time
  • Tried adding cglib-nodep as well as a dependency
  • I tried excluding cglib from wicketstuff-restannotations and from all wicket library dependencies, and then adding cglib along with cglib-nodep dependency manually. Still same issue.

StackTrace

javax.servlet.ServletException: Filter execution threw an exception
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:149)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:178)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
    org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
Root Cause

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
    org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:182)
    org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:166)
    org.apache.wicket.injection.Injector.inject(Injector.java:111)
    org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124)
    org.apache.wicket.Application.fetchCreateAndSetSession(Application.java:1523)
    org.apache.wicket.Session.get(Session.java:181)org.apache.wicket.request.cycle.RequestCycleListenerCollection$2.notify(RequestCycleListenerCollection.java:85)
    org.apache.wicket.request.cycle.RequestCycleListenerCollection$2.notify(RequestCycleListenerCollection.java:81)
    org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:144)
    org.apache.wicket.request.cycle.RequestCycleListenerCollection.onEndRequest(RequestCycleListenerCollection.java:80)
    org.apache.wicket.request.cycle.RequestCycleListenerCollection$2.notify(RequestCycleListenerCollection.java:85)
    org.apache.wicket.request.cycle.RequestCycleListenerCollection$2.notify(RequestCycleListenerCollection.java:81)
    org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:144)
    org.apache.wicket.request.cycle.RequestCycleListenerCollection.onEndRequest(RequestCycleListenerCollection.java:80)
    org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:266)
    org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:277)
    org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:208)
    org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:307)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:149)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:218)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:178)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
    org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)

relevant and updated build.sbt

version numbers

// val wicket_version = "9.2.0"
// val spring_version = "5.4.5"
// val spring_security_version = "5.4.5"
// val spring_security_saml_version = "1.0.10.RELEASE"
// val spring_boot_starter_version = "2.4.4"

dependencies

libraryDependencies ++= Seq(
    "cglib" % "cglib" % "3.3.0",
    "cglib" % "cglib-nodep" % "3.3.0",
    "org.apache.wicket" % "wicket" % wicket_version exclude("cglib","cglib"),
    "org.apache.wicket" % "wicket-auth-roles" % wicket_version exclude("cglib","cglib"),
    "org.apache.wicket" % "wicket-spring" % wicket_version exclude("cglib","cglib"),
    "org.apache.wicket" % "wicket-extensions" % wicket_version exclude("cglib","cglib"),
    "org.apache.wicket" % "wicket-datetime" % wicket_datetime_version,
    "org.wicketstuff" % "wicketstuff-restannotations" % wicket_version exclude("cglib","cglib"),
    "org.wicketstuff" % "wicketstuff-select2" % wicket_version exclude("cglib","cglib"),
    "com.fasterxml.jackson.dataformat" % "jackson-dataformat-csv" % "2.12.2",
    "com.googlecode.wicket-jquery-ui" % "wicket-jquery-ui" % wicket_version exclude("cglib","cglib"),
    "org.springframework.boot" % "spring-boot-starter-web" % spring_boot_starter_version,
    "org.springframework.boot" % "spring-boot-starter-security" % spring_boot_starter_version,
    "org.springframework.security" % "spring-security-ldap" % spring_version,
    "org.springframework.security" % "spring-security-oauth2-client" % spring_version,
    "org.springframework.security" % "spring-security-oauth2-jose" % spring_version,
    "org.springframework.security.extensions" % "spring-security-saml2-core" % spring_security_saml_version excludeAll(
        ExclusionRule(organization = "ca.juliusdavies", name = "not-yet-commons-ssl"),
        ExclusionRule(organization = "org.opensaml", name = "opensaml"),
        ExclusionRule(organization = "xml-apis", name = "xml-apis")
    ),
    "org.springframework" % "spring-jdbc" % "5.3.5",
    "org.opensaml" % "opensaml" % "2.6.4",
    "xml-apis" % "xml-apis" % "2.0.2",
    "org.apache.commons" % "commons-dbcp2" % "2.8.0",
    "mysql" % "mysql-connector-java" % "6.0.6",
    "javax.servlet" % "javax.servlet-api" % "4.0.1" % "provided",
)

Relevant and updated part of dependencyTree:

Also did a find of cglib in full dependencyTree and it is available as dependency shown in dependencyTree just at one place

[info]   |     |   
[info]   |     +-org.springframework:spring-core:5.3.5
[info]   |       +-org.springframework:spring-jcl:5.3.5
[info]   |       
[info]   +-cglib:cglib-nodep:3.3.0
[info]   +-cglib:cglib:3.3.0
[info]   | +-org.ow2.asm:asm:7.1 (evicted by: 9.0)
[info]   | +-org.ow2.asm:asm:9.0
[info]   | 
[info]   +-com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.12.2
[info]   | +-com.fasterxml.jackson.core:jackson-annotations:2.12.2
[info]   | +-com.fasterxml.jackson.core:jackson-core:2.12.2
[info]   | +-com.fasterxml.jackson.core:jackson-databind:2.12.2
[info]   |   +-com.fasterxml.jackson.core:jackson-annotations:2.12.2
[info]   |   +-com.fasterxml.jackson.core:jackson-core:2.12.2
[info]   |   
[info]   +-com.googlecode.wicket-jquery-ui:wicket-jquery-ui:9.2.0
[info]   | +-com.googlecode.wicket-jquery-ui:wicket-jquery-ui-core:9.2.0
[info]   | 
[info]   +-org.apache.wicket:wicket-auth-roles:9.2.0
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | 
[info]   +-org.apache.wicket:wicket-datetime:8.0.0-M7
[info]   | +-joda-time:joda-time:2.9.9
[info]   | +-org.apache.wicket:wicket-core:8.0.0-M7 (evicted by: 9.2.0)
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | 
[info]   +-org.apache.wicket:wicket-extensions:9.2.0
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | 
[info]   +-org.apache.wicket:wicket-ioc:9.2.0
[info]   | +-javax.inject:javax.inject:1
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.ow2.asm:asm:9.0
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | 
[info]   +-org.apache.wicket:wicket-spring:9.2.0
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.apache.wicket:wicket-ioc:9.2.0
[info]   | | +-javax.inject:javax.inject:1
[info]   | | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | | +-com.github.openjson:openjson:1.0.12
[info]   | | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | | 
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.ow2.asm:asm:9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | +-org.springframework:spring-context:5.3.1 (evicted by: 5.3.5)
[info]   | +-org.springframework:spring-context:5.3.5
[info]   |   +-org.springframework:spring-aop:5.3.5
[info]   |   | +-org.springframework:spring-beans:5.3.5
[info]   |   | | +-org.springframework:spring-core:5.3.5
[info]   |   | |   +-org.springframework:spring-jcl:5.3.5
[info]   |   | |   
[info]   |   | +-org.springframework:spring-core:5.3.5
[info]   |   |   +-org.springframework:spring-jcl:5.3.5
[info]   |   |   
[info]   |   +-org.springframework:spring-beans:5.3.5
[info]   |   | +-org.springframework:spring-core:5.3.5
[info]   |   |   +-org.springframework:spring-jcl:5.3.5
[info]   |   |   
[info]   |   +-org.springframework:spring-core:5.3.5
[info]   |   | +-org.springframework:spring-jcl:5.3.5
[info]   |   | 
[info]   |   +-org.springframework:spring-expression:5.3.5
[info]   |     +-org.springframework:spring-core:5.3.5
[info]   |       +-org.springframework:spring-jcl:5.3.5
[info]   |       
[info]   +-org.apache.wicket:wicket:9.2.0
[info]   | +-org.apache.wicket:wicket-core:9.2.0
[info]   | | +-com.github.openjson:openjson:1.0.12
[info]   | | +-org.apache.wicket:wicket-request:9.2.0
[info]   | | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | | +-commons-io:commons-io:2.8.0
[info]   | | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | | 
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.apache.wicket:wicket-util:9.2.0
[info]   | | | +-commons-fileupload:commons-fileupload:1.4
[info]   | | | +-commons-io:commons-io:2.8.0
[info]   | | | +-org.apache.commons:commons-collections4:4.4
[info]   | | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | | 
[info]   | | +-org.danekja:jdk-serializable-functional:1.9.0
[info]   | | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | | +-org.slf4j:slf4j-api:1.7.30
[info]   | | 
[info]   | +-org.slf4j:slf4j-api:1.7.25 (evicted by: 1.7.30)
[info]   | +-org.slf4j:slf4j-api:1.7.30
[info]   | 
[info]   +-org.springframework.boot:spring-boot-starter-security:2.4.4
[info]   | +-org.springframework.boot:spring-boot-starter:2.4.4
[info]   | | +-jakarta.annotation:jakarta.annotation-api:1.3.5
[info]   | | +-org.springframework.boot:spring-boot-autoconfigure:2.4.4
[info]   | | | +-org.springframework.boot:spring-boot:2.4.4
[info]   | | |   +-org.springframework:spring-context:5.3.5
[info]   | | |   | +-org.springframework:spring-aop:5.3.5
[info]   | | |   | | +-org.springframework:spring-beans:5.3.5
[info]   | | |   | | | +-org.springframework:spring-core:5.3.5
[info]   | | |   | | |   +-org.springframework:spring-jcl:5.3.5
[info]   | | |   | | |   
[info]   | | |   | | +-org.springframework:spring-core:5.3.5
[info]   | | |   | |   +-org.springframework:spring-jcl:5.3.5
[info]   | | |   | |   
[info]   | | |   | +-org.springframework:spring-beans:5.3.5
[info]   | | |   | | +-org.springframework:spring-core:5.3.5
[info]   | | |   | |   +-org.springframework:spring-jcl:5.3.5

Update There is a strange behaviour I have noticed. I have multiple servers on which the the same code with normal dependencies (without cglib explicitly defined) is deployed, with different configurations. This issue is coming only on one deployment whereas others are working fine.

The configuration files include - application.properties, log4j.properties, spring-security.xml

Let me know if you need more details about this.

Halverson answered 15/4, 2021 at 17:58 Comment(1)
This exception got resolved by adding asm dependency in project. Referenced answer https://mcmap.net/q/1054842/-could-not-initialize-class-net-sf-cglib-proxy-enhancer. Also, please read the full chat to get more insight into my findings about this issue - chat.stackoverflow.com/rooms/231207/…Halverson
P
0
org.apache.wicket:wicket-datetime:8.0.0-M7

Why do you use 8.0.0-M7 library with Wicket 9.2.0 ?

Please remove the explicit dependencies for cglib and cglib-nodep and all exclusions and try again. If it still fails then please the new dependencyTree output.

Pain answered 16/4, 2021 at 6:1 Comment(12)
It still fails. I removed the both cglib explicit dependencies, removed org.apache.wicket:wicket-datetime and included "org.wicketstuff" % "wicket-datetime" % "9.2.0" to match version. As requested, here's the full dependencyTree - drive.google.com/file/d/1y889r_Usdiuixl4TkmlVmqN3uBfIgmrA/…Halverson
Tried with org.apache.wicket:wicket-datetime instead of "org.wicketstuff" % "wicket-datetime" % "9.2.0" with versions 7.18.0 and 7.17.0. Still has same issue. Please check question update as well for a strange behaviourHalverson
Yes, I figured it wasn't you. Sorry! Please paste the complete exception too.Pain
I have pasted the full exception in question itself. You can check it out from here - data.smart360.me/smart360error/ui/signinHalverson
I don't see what could be the problem. I find it amazing that dependencyTree is 300K lines though! To work it around you can introduce an interface for the class that should be injected at biz.smart360.webapp.security.wicket.BizAuthenticatedSession.<init>(BizAuthenticatedSession.java:81). This way Wicket will use java.lang.reflect.Proxy instead of Cglib. Another way is to add dependency to Objenesis. This way Wicket will use Objenesis instead of Cglib for classes.Pain
Yes it's a big project with lot's of complex dependencies. In your second way, Objenesis should be added explicitly like libraryDependencies += "org.objenesis" % "objenesis" % "3.2" mvnrepository.com/artifact/org.objenesis/objenesis/3.2. I'm trying second way first.Halverson
Try with a breakpoint at github.com/cglib/cglib/blob/… and see whether it fails or not. NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer means that some of its static fields cannot be initialized for some reason.Pain
Remove % Test. It should be runtime dependencyPain
Let us continue this discussion in chat.Halverson
This issue is still there, and it started after upgrade to Apache Wicket 9.x. Things were working fine with Wicket 7.9. In some servers, adding asm version 9.1 dependency works and in some verison 8.0.1 works. In some servers nothings works. I really really need your help in figuring out the problem or to find a solution.Halverson
ASM is a dependency of wicket-ioc (github.com/apache/wicket/blob/…). I don't know why you need to add it manually. SBT should add it as a transitive dependency. If this is broken then probably other dependencies are also missing for the same reason.Pain
Hello Martin-g, I'll try to add all the dependencies and will try that. By changing the ASM versions 8.0.1 and 9.1, I'm able to run it on 2/3 of the servers. When I'll work on 1/3 of servers, then I'll try that, and will let you knowHalverson

© 2022 - 2024 — McMap. All rights reserved.