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

  • WHY....... DataAccessException

    So Im using spring-3.0.1. Websphere 6.1
    Im using JDBCTemplate class.
    I get an exception thrown
    Have my datasource set up in websphere,
    in my spring servlet I have
    Code:
    <jee:jndi-lookup id="dataSource" jndi-name="jdbc/BS"/>
    In my class I have
    Code:
    import com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource;
    and
    Code:
    	private JdbcTemplate jdbcTemplate;
        @Autowired
        public void setDataSource(WSJdbcDataSource dataSource) {
            this.jdbcTemplate = new JdbcTemplate(dataSource);
        }
    My exception looks like this....
    Injection of autowired dependencies failed; nested exception is java.lang.NoClassDefFoundError: org.springframework.dao.DataAccessException

    yes. I cannot find the DataAccessException, in fact I cannot find the org.springframework.dao..... at all. The jar does not exist?

    frustrated developer.....

  • #2
    1) You should be programming to interface, you will get a DataSource not a WSJdbcDataSource

    2) Include the correct jar files, spring-tx.jar is the one you are looking for....

    3) If you use maven or ant/ivy you don't need to have this the dependencies are then managed foryou... saves you a lot of frustration (also adds some ) and searching the internet.

    Comment


    • #3
      So, the DataAccessException is hidden in the transactions jar, Thanks alot...
      Yes, offcause, I should use interfaces...
      Yes, Im a maven-fan, jumping into a maintainance project for a couple of weeks, there is no time for rearranging the codebase :-(

      /Mike

      Comment

      Working...
      X