edit: hmpf can't edit the nonsensical thread title
I am using a StoredProcedureItemReader to read data from an Oracle stored procedure.
The problem is the connection will be over a vpn, and when the vpn is not up, the error that happens is not available to a step listener via onReadError(), but this happens:
It seems the reader opens the connection during initializing, which means the exception wont end up in a StepListener.Code:ERROR 15.04.2010 13:53:58: -- org.springframework.batch.core.step.AbstractStep - Encountered an error executing the step org.springframework.batch.item.ItemStreamException: Failed to initialize the reader . . . . Caused by: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
so how to solve this? I need to catch basically all exceptions and make sure they're properly logged and notified about via email.
edit: current config if it helps any:
all this works fine if the connection is up when the job starts, if its down, the exceptions go unnoticed by the listener
Code:<b:job id="my-job" incrementer="jobParametersIncrementer" restartable="false"> <b:step id="my-step-id" parent="baseStep" > <b:tasklet> <b:chunk reader="myReader" writer="myWriter" /> <b:listeners> <b:listener ref="listener" /> </b:listeners> </b:tasklet> </b:step> </b:job> <bean id="listener" class="my.package.MyFailureLoggerListener"> <property name="errorChannel" ref="errorChannel" /> <!-- spring integration default error channel --> </bean> <bean id="myReader" parent="baseReader" p:procedureName="mystoredprocedure"> <property name="parameters"> <list> ... </list> </property> <property name="preparedStatementSetter"> <bean class="my.Package.MyParameterSetter" /> </property> </bean> <bean id="baseReader" class="org.springframework.batch.item.database.StoredProcedureItemReader" abstract="true"> <property name="dataSource" ref="myDataSource"/> <property name="refCursorPosition" value="3"/> <property name="rowMapper"> <!-- preserves column order --> <bean class="org.springframework.jdbc.core.ColumnMapRowMapper"/> </property> </bean>



Reply With Quote