Announcement Announcement Module
Collapse
No announcement yet.
Can not see any log Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can not see any log

    Hi all,

    I am trying to read data from database and want to print those data to see if it is working. But the problem is that while I am trying to print the record in Mapper class I can not see anything else though there is one record present in resultset.
    As I am a newbie I want to know that while processing the input records I should see the records in this Mapper class while setting values in VO.right?

    How can I connect the resultset with the writer?
    Please give me the code which will print this resultset in Console.None of my print is giving output. Please help.

    My codes are given below:-

    Code:
    <job id="counterJob">
    		<step id="fetchRecord">
    			<tasklet>
    				<chunk reader="inputMemberSource" writer="opWriter" 
    	                   commit-interval="1" />
    			</tasklet>
    		</step>
    	</job>
    	
    	
    	<beans:bean id="inputMemberSource" class="org.springframework.batch.item.database.JdbcCursorItemReader">
    		<beans:property name="dataSource" ref="dataSource" />
    		<beans:property name="rowMapper">
    			<beans:bean class="com.test.dao.MemberDetailsMapper" />
    		</beans:property>
    		<beans:property name="sql">
    			<beans:value>SELECT * FROM XX</beans:value>
    		</beans:property>
    	</beans:bean>
    	
    	<beans:bean id="opWriter" class="com.test.dao.OpWriter">
    	<beans:property name="dataSource" ref="dataSource" />	
    	</beans:bean>
    Code:
    public class OpWriter extends SimpleJdbcDaoSupport implements ItemWriter<MembersDetails>{
    
    	private Logger log = Logger.getLogger(OpWriter.class); 
    	public void write(List<? extends MembersDetails> mbrs) throws Exception {
    		log.info("SIZE............."+mbrs.size());
    		for(MembersDetails mbr: mbrs)
    		{
    			log.info("log............."+log);
    			log.info("getTransactionId............."+mbr.getTransactionId());
    			System.out.println("O|P->>>>>");
    			System.out.println("getTransactionId...."+mbr.getTransactionId());
    			System.out.println("getMemberId....."+mbr.getMemberId());
    			System.out.println("getPartnerShipId...."+mbr.getPartnerShipId());
    		}
    	}
    Code:
    public class MemberDetailsMapper implements ParameterizedRowMapper<MembersDetails>{
    
    	private Logger log = Logger.getLogger(MemberDetailsMapper.class); 
    	
    	public MembersDetails mapRow(ResultSet rs, int number) throws SQLException {
    		MembersDetails mbrDetails = new MembersDetails();
    		System.out.println("MemberDetailsMapper/mapRow-> "+rs.getString("TRANSACTIONID"));
    		log.info("MemberDetailsMapper/mapRow-> "+rs.getString("TRANSACTIONID"));
    ......
    return mbrDetails;
    Log:-

    18:14:08,636 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() PropertyOverrideConfigur
    er:178 - Loading properties file from class path resource [batch-oracle.properties]
    18:14:08,683 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() ClassPathXmlApplicationC
    ontext:1196 - Bean 'jobRegistry' is not eligible for getting processed by all BeanPostProcessors (for example: not el
    igible for auto-proxying)
    18:14:08,698 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() DefaultListableBeanFacto
    ry:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@16de067
    : defining beans [jobLauncher,org.springframework.batch.core.configu ration.support.JobRegistryBeanPostProcessor#0,job
    Repository,incrementerFactory,jobOperator,jobExplo rer,jobRegistry,jdbcTemplate,logAdvice,eventAdvice ,dataSource,trans
    actionManager,environment,overrideProperties,place holderProperties,org.springframework.batch.core.sc ope.internalStepS
    cope,org.springframework.beans.factory.config.Cust omEditorConfigurer,fetchRecord,counterJob,inputMem berSource,opWrite
    r]; root of factory hierarchy
    18:14:08,901 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleJobLauncher:156 -
    No TaskExecutor has been set, defaulting to synchronous executor.
    18:14:18,199 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleJobLauncher:109 -
    Job: [FlowJob: [name=counterJob]] launched with the following parameters: [{}]
    18:14:18,230 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractJob:238 - Job ex
    ecution starting: JobExecution: id=0, startTime=null, endTime=null, lastUpdated=Mon Oct 04 18:14:17 IST 2010, status=
    STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=0, JobParameters=[{}], Job=[counterJob]]

    18:14:18,512 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleFlow:135 - Resumin
    g state=fetchRecord with status=UNKNOWN
    18:14:18,512 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleFlow:143 - Handlin
    g state=fetchRecord
    18:14:19,418 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractJob:347 - Execut
    ing step: [TaskletStep: [name=fetchRecord]]
    18:14:19,418 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractStep:182 - Execu
    ting: id=0
    18:14:23,715 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:463 - Sta
    rting repeat context.
    18:14:23,715 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:365 - Rep
    eat operation about to start at count=1
    18:14:23,762 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:463 - Sta
    rting repeat context.
    18:14:23,762 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:365 - Rep
    eat operation about to start at count=1
    18:14:23,762 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:436 - Rep
    eat is complete according to policy and result value.
    18:14:23,762 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() TaskletStep:275 - Applyi
    ng contribution: [StepContribution: read=0, written=0, filtered=0, readSkips=0, writeSkips=0, processSkips=0, exitSta
    tus=EXECUTING]
    18:14:24,059 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() TaskletStep:299 - Saving
    step execution after commit: StepExecution: id=0, name=fetchRecord, status=STARTED, exitStatus=EXECUTING, readCount=
    0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, commitCount=1, rollbackCount=0, exitDescription=
    18:14:24,371 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() RepeatTemplate:436 - Rep
    eat is complete according to policy and result value.
    18:14:24,371 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractStep:210 - Step
    execution success: id=0
    18:14:24,965 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractStep:264 - Step
    execution complete: StepExecution: id=0, name=fetchRecord, status=COMPLETED, exitStatus=COMPLETED, readCount=0, filte
    rCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, commitCount=1, rollbackCount=0
    18:14:25,246 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleFlow:152 - Complet
    ed state=fetchRecord with status=COMPLETED
    18:14:25,246 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleFlow:143 - Handlin
    g state=end1
    18:14:25,246 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleFlow:152 - Complet
    ed state=end1 with status=COMPLETED
    18:14:25,246 DEBUG org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() AbstractJob:251 - Job ex
    ecution complete: JobExecution: id=0, startTime=Mon Oct 04 18:14:18 IST 2010, endTime=null, lastUpdated=Mon Oct 04 18
    :14:18 IST 2010, status=COMPLETED, exitStatus=exitCode=COMPLETED;exitDescription=, job=[JobInstance: id=0, JobParamet
    ers=[{}], Job=[counterJob]]
    18:14:25,543 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() SimpleJobLauncher:111 -
    Job: [FlowJob: [name=counterJob]] completed with the following parameters: [{}] and the following status: [COMPLETED]

    18:14:25,543 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() ClassPathXmlApplicationC
    ontext:815 - Closing org.springframework.context.support.ClassPathXmlAp plicationContext@109de5b: display name [org.sp
    ringframework.context.support.ClassPathXmlApplicat ionContext@109de5b]; startup date [Mon Oct 04 18:14:07 IST 2010]; r
    oot of context hierarchy
    18:14:25,543 INFO org.springframework.batch.core.launch.support.Comm andLineJobRunner.main() DefaultListableBeanFacto
    ry:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@16de067: defin
    ing beans [jobLauncher,org.springframework.batch.core.configu ration.support.JobRegistryBeanPostProcessor#0,jobR eposit
    ory,incrementerFactory,jobOperator,jobExplorer,job Registry,jdbcTemplate,logAdvice,eventAdvice,dataSo urce,transactionM
    anager,environment,overrideProperties,placeholderP roperties,org.springframework.batch.core.scope.int ernalStepScope,or
    g.springframework.beans.factory.config.CustomEdito rConfigurer,fetchRecord,counterJob,inputMemberSour ce,opWriter]; roo
    t of factory hierarchy
    Last edited by kousik.majumder; Oct 4th, 2010, 07:55 AM.

  • #2
    Solved

    My problem is solved. Actually resultset had no record.
    Sorry.

    Comment

    Working...
    X