Announcement Announcement Module
Collapse
No announcement yet.
NoSuchMethodError in Spring JDBC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchMethodError in Spring JDBC

    Hi,

    I'm using Spring JDBC and get an exception whenever I try to use it:

    Code:
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    db = builder.setType(EmbeddedDatabaseType.H2).addScript("file:" + getClass().getResource("trades.sql").getPath()).build();
    Code:
    Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.util.StringUtils.hasText(Ljava/lang/CharSequence;)Z
    	at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.splitSqlScript(ResourceDatabasePopulator.java:274)
    	at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.executeSqlScript(ResourceDatabasePopulator.java:162)
    	at org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.populate(ResourceDatabasePopulator.java:120)
    	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.populateDatabase(EmbeddedDatabaseFactory.java:153)
    	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:139)
    	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:114)
    	at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:112)
    The following jars are in my build path:

    org.springframework.aop-3.0.5.RELEASE.jar
    org.springframework.asm-3.0.5.RELEASE.jar
    org.springframework.aspects-3.0.5.RELEASE.jar
    org.springframework.beans-3.0.5.RELEASE.jar
    org.springframework.context-3.0.5.RELEASE.jar
    org.springframework.context.support-3.0.5.RELEASE.jar
    org.springframework.core-3.0.5.RELEASE.jar
    org.springframework.expression-3.0.5.RELEASE.jar
    org.springframework.instrument-3.0.5.RELEASE.jar
    org.springframework.instrument.tomcat-3.0.5.RELEASE.jar
    org.springframework.jdbc-3.0.5.RELEASE.jar
    org.springframework.jms-3.0.5.RELEASE.jar
    org.springframework.orm-3.0.5.RELEASE.jar
    org.springframework.oxm-3.0.5.RELEASE.jar
    org.springframework.spring-library-3.0.5.RELEASE.libd
    org.springframework.test-3.0.5.RELEASE.jar
    org.springframework.transaction-3.0.5.RELEASE.jar
    org.springframework.web-3.0.5.RELEASE.jar
    org.springframework.web.portlet-3.0.5.RELEASE.jar
    org.springframework.web.servlet-3.0.5.RELEASE.jar
    org.springframework.web.struts-3.0.5.RELEASE.jar
    h2-1.3.161.jar
    hibernate-3.3.1.GA.jar
    hibernate-annotations.jar
    hibernate-c3p0-3.3.1.GA.jar

    Does anyone have any ideas where I'm going wrong?

    Thanks

  • #2
    Hello

    Code:
    Exception in thread "main" java.lang.NoSuchMethodError: 
    org.springframework.util.StringUtils.hasText(Ljava/lang/CharSequence;)Z
    It is a conflict of versions. Could you update to the last version of Spring (3.1) and Hibernate?

    Same consideration for h2

    Let me know your advance

    Comment

    Working...
    X