Announcement Announcement Module
Collapse
No announcement yet.
How to fix this : org/springframework/dao/DuplicateKeyException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    The jar containing class DuplicateKeyException is missing from your class path.

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

    Comment


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

      Comment

      Working...
      X