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

  • Issues with JdbcPagingItemReader

    Hi,

    I am trying to use JdbcPagingItemReader to read records from database in batch size 10K.

    I am getting error while starting the app.

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.batch.item.database.support.S qlPagingQueryProviderFactoryBean#c2ff5': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: No DataSource specified
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.getObjectFromFactoryBean(Factor yBeanRegistrySupport.java:109)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveInnerBean(BeanDefinitio nValueResolver.java:274)
    ... 16 more

    Caused by: java.lang.IllegalArgumentException: No DataSource specified
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:97)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:77)
    at org.springframework.jdbc.support.JdbcUtils.extract DatabaseMetaData(JdbcUtils.java:280)
    at org.springframework.jdbc.support.JdbcUtils.extract DatabaseMetaData(JdbcUtils.java:320)
    at org.springframework.batch.support.DatabaseType.fro mMetaData(DatabaseType.java:93)
    at org.springframework.batch.item.database.support.Sq lPagingQueryProviderFactoryBean.getObject(SqlPagin gQueryProviderFactoryBean.java:139)
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:142)
    ... 18 more

    Error:

    Here is the spring config.

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName"><value>${jdbc.db.driver.cla ss}</value></property>
    <property name="url"><value>${jdbc.db.url}</value></property>
    <property name="username"><value>${jdbc.db.user.name}</value></property>
    <property name="password"><value>${jdbc.db.user.password}</value></property>
    </bean>

    <bean id="itemReader" class="org.springframework.batch.item.database.Jdb cPagingItemReader">
    <property name="dataSource" ref="dataSource"/>
    <property name="queryProvider">
    <bean class="org.springframework.batch.item.database.sup port.SqlPagingQueryProviderFactoryBean">
    <property name="selectClause" value="select ID, MODIFICATIONDATE, TRADEID"/>
    <property name="fromClause" value="from POS"/>
    <property name="sortKey" value="ID"/>
    </bean>
    </property>
    <property name="pageSize" value="10000"/>
    <property name="rowMapper" ref="myRowMapper"/>
    </bean>
    <bean id="myRowMapper"
    class="com...MyRowMapper">
    </bean>

    any help would be greatly appreciated...

    jmonkey...

  • #2
    Hi jmonkey,

    Please check your property file (that contain jdbc.db.driver.class, etc..) is avaiable in ur classpath.

    Comment


    • #3
      Pleae use [ code][/coe ] tags when posting code, that way it remains readable.

      Next have you actually read the stacktrace? You must inject the datasource into the SqlPagingQueryProviderFactoryBean that is what the stacktrace is telling you.... (And it is indeed missing from your configuration).

      Comment

      Working...
      X