Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean

    Hello,

    i want to get a test with JUnit. When i want to get to my bean, i have got an error :

    Code :
    protected void setUp() throws Exception {

    try {
    System.out.println("avant======" + articlesDao);

    articlesDao = (IArticlesDao) (new XmlBeanFactory(
    new ClassPathResource((String) "istia/st/articles/db/spring-config-test-dao.xml"))).getBean("articlesDao");
    }
    catch (Exception e) {
    System.out.println("exception ======" + articlesDao);
    e.printStackTrace();
    }
    }

    my bean is :
    public class ArticlesDaoSqlMap implements IArticlesDao {
    //...
    public ArticlesDaoSqlMap(String sqlMapConfigFileName) {
    Reader reader = null;
    UncheckedAccessArticlesException ex = null;
    try {
    System.out.println("Sql file : " + sqlMapConfigFileName);
    reader = Resources.getResourceAsReader(sqlMapConfigFileName );
    System.out.println("READER : " + reader.toString());
    sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
    System.out.println("SQL Map : " + sqlMap);
    }
    catch (Exception ex1) {
    System.out.println("Exception : SQL Map : " + sqlMap);
    ex1.printStackTrace();
    ex = new UncheckedAccessArticlesException(
    "Erreur lors de la construction de l'objet [sqlMap] ? partir du fichier de configuration ["
    + sqlMapConfigFileName + "] : ", ex1);
    }
    }

    And tis error is :
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'articlesDao' defined in class path resource [istia/st/articles/db/spring-config-test-dao.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [istia.st.articles.dao.ArticlesDaoSqlMap]; constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.ibatis.common.resources.Resources.instantiate( Ljava/lang/StringLjava/lang/Object;
    org.springframework.beans.FatalBeanException: Could not instantiate class [istia.st.articles.dao.ArticlesDaoSqlMap]; constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.ibatis.common.resources.Resources.instantiate( Ljava/lang/StringLjava/lang/Object;
    java.lang.NoSuchMethodError: com.ibatis.common.resources.Resources.instantiate( Ljava/lang/StringLjava/lang/Object;
    at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigP arser$10.process(SqlMapConfigParser.java:304)

    Any Idea ?

    Thank's

    Fred

  • #2
    It looks like you have an older version of iBATIS on the classpath than the one Spring was compiled against. Or you may have multiple versions of iBATIS on the classpath.

    Rob

    Comment


    • #3
      Spring 3 and iBatis 2.2

      what is the version of iBatis used to compile Spring 3.0.5?
      I am using Spring 3.0.5 and iBatis 2.2.0 in my project and getting this error.

      Error creating bean: java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigP arser.parse(Ljava/io/InputStream;Ljava/util/PropertiesLcom/ibatis/sqlmap/client/SqlMapClient;

      Would appreciate a reply.

      Comment

      Working...
      X