Announcement Announcement Module
Collapse
No announcement yet.
Spring Batch StoredProcedure problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch StoredProcedure problem

    I am very new to Spring batch .
    I am facing the below error when i am executing a sproc using org.springframework.batch.item.database.StoredProc edureItemReader

    ----
    SEVERE: Encountered an error executing the step
    org.springframework.batch.item.ItemStreamException : Failed to initialize the reader
    at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.open(AbstractItemCou ntingItemStreamItemReader.java:137)
    at org.springframework.batch.item.support.CompositeIt emStream.open(CompositeItemStream.java:98)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.open(TaskletStep.java:288)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:193)
    at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:135)
    at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:135)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:48)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:114)
    at com.bofa.test.MainClass.main(MainClass.java:26)
    Caused by: org.springframework.jdbc.UncategorizedSQLException : Executing stored procedure; uncategorized SQLException for SQL [{call PKG_TASK_FUNCTIONS.GET_CONFIG_VALUE(?, ?, ?, ?)}]; SQL state [99999]; error code [17041]; Missing IN or OUT parameter at index:: 2; nested exception is java.sql.SQLException: Missing IN or OUT parameter at index:: 2
    at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80)
    at org.springframework.batch.item.database.StoredProc edureItemReader.openCursor(StoredProcedureItemRead er.java:221)
    at org.springframework.batch.item.database.AbstractCu rsorItemReader.doOpen(AbstractCursorItemReader.jav a:401)
    at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.open(AbstractItemCou ntingItemStreamItemReader.java:134)
    ... 14 more
    Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 2
    at oracle.jdbc.driver.OraclePreparedStatement.process CompletedBindRow(OraclePreparedStatement.java:1821 )
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:3571)
    at oracle.jdbc.driver.OraclePreparedStatement.execute (OraclePreparedStatement.java:3677)
    at oracle.jdbc.driver.OracleCallableStatement.execute (OracleCallableStatement.java:4714)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper. execute(OraclePreparedStatementWrapper.java:1374)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.execute(DelegatingPreparedStatement.java:169)
    at org.springframework.batch.item.database.StoredProc edureItemReader.openCursor(StoredProcedureItemRead er.java:205)
    ... 16 more
    -------------


    Below is my code :

    <bean id="SPItemReader" class="org.springframework.batch.item.database.Sto redProcedureItemReader">
    <property name="procedureName" value="PKG_TASK_FUNCTIONS.get_config_value"/>
    <!-- <property name="refCursorPosition" value="1"/> -->
    <property name="rowMapper">
    <bean class="com......rowmapper.SPRowMapper"/>
    </property>
    <property name="dataSource" ref="dataSource"/>
    <property name="parameters">
    <list>
    <bean class="org.springframework.jdbc.core.SqlParameter" >
    <constructor-arg index="0" value="p_key" />
    <constructor-arg index="1">
    <util:constant static-field="java.sql.Types.VARCHAR" />
    </constructor-arg>
    </bean>
    <bean class="org.springframework.jdbc.core.SqlParameter" >
    <constructor-arg index="0" value="entity" />
    <constructor-arg index="1">
    <util:constant static-field="java.sql.Types.INTEGER" />
    </constructor-arg>
    </bean>
    <bean class="org.springframework.jdbc.core.SqlParameter" >
    <constructor-arg index="0" value="get_default_value" />
    <constructor-arg index="1">
    <util:constant static-field="java.sql.Types.BOOLEAN"/>
    </constructor-arg>
    </bean>
    <bean class="org.springframework.jdbc.core.SqlOutParamet er">
    <constructor-arg index="0" value="p_value" />
    <constructor-arg index="1">
    <util:constant static-field="java.sql.Types.VARCHAR"/>
    </constructor-arg>
    </bean>
    </list>
    </property>
    <property name="preparedStatementSetter" ref="parameterSetter"/>
    </bean>

    My Storedproc syntax is below :
    PROCEDURE get_config_value (
    p_key config_key.NAME%TYPE,
    entity entity.entity_id%TYPE,
    get_default_value NUMBER,
    key_value OUT VARCHAR2
    );


    Please help me in resolving this problem

  • #2
    identified the problem , my store proc do not return result set

    Comment

    Working...
    X