javaspringmavenwicket-7

java.lang.NoClassDefFoundError: org/springframework/core/ResolvableType


I'm learning to develop with apache wicket, and I tried to integrate Spring

this is the dependency into the pom.xml file

</dependency>
        -->
        <dependency>
             <groupId>org.apache.wicket</groupId>
             <artifactId>wicket-spring</artifactId>
             <version>${wicket.version}</version>
        </dependency>
        <!-- spring dependency -->
        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-core</artifactId>
           <version>3.0.5.RELEASE</version>
        </dependency>

        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-context</artifactId>
           <version>3.0.5.RELEASE</version>
        </dependency>


        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-web</artifactId>
           <version>3.0.5.RELEASE</version>
        </dependency>

and this is the SpringIntegrationPage.java

public class SpringIntegrationPage extends WebPage {

    private static final long serialVersionUID = 1L;
    @ SpringBean(name="userModel")
    private UserModel userModel;
    public SpringIntegrationPage(){
        add(new Label("namelbl", new PropertyModel<String>(userModel, "name")));
        add(new Label("genderlbl", new PropertyModel<String>(userModel, "gender")));
        }
}  

I get org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.beton.SpringIntegrationPage() Caused by: java.lang.NoClassDefFoundError: org/springframework/core/ResolvableType

org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.beton.SpringIntegrationPage()'. An exception has been thrown during construction!
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:194) ~[wicket-core-7.8.0.jar:7.8.0]
    at 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) [catalina.jar:7.0.12]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) [catalina.jar:7.0.12]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) [catalina.jar:7.0.12]
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) [catalina.jar:7.0.12]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.12]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) [catalina.jar:7.0.12]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) [tomcat-coyote.jar:7.0.12]
    at 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_45]
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:175) ~[wicket-core-7.8.0.jar:7.8.0]
    ... 32 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/ResolvableType

Solution

  • Seems like this type (ResolvableType) was introduced in Spring 4.0, thus it wont we there in 3.0.5.RELEASE. check this page

    So you might want to consider upgrading Spring version or use compatible version of wicket.