Results 1 to 3 of 3

Thread: How to fix this : org/springframework/dao/DuplicateKeyException

  1. #1
    Join Date
    Mar 2012
    Posts
    21

    Default How to fix this : org/springframework/dao/DuplicateKeyException

    Hi,i am trying to update records in DataBase using spring batch
    I have customReader and customWriter classes to read and write to databse
    when i run job i am able to read from database but while updating the records
    I am getting following exception:

    java.lang.NoClassDefFoundError: org/springframework/dao/DuplicateKeyException


    My Update method is as follows :

    public void update(String col,String val){
    System.out.println("IN update method");
    ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("applicationDB.xml" );
    DataSource dataSource = (DataSource) appContext.getBean("dataSource");
    String sql="update person set fname = ? where fname = ? ";
    jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update(
    sql,
    new Object[] {col, val}
    );
    }

  2. #2

    Default

    The jar containing class DuplicateKeyException is missing from your class path.

    Include the jar in your class path and try to run again.

  3. #3
    Join Date
    Mar 2012
    Posts
    21

    Default

    sorry for replying late....my problem solved, it was due to mistake in query i wrote..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •