Hi robin,
now i want run batch using DB-JOBREPOSITORY.xml and i had created the DB instances like the following way....
Code:
CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID NUMBER NOT NULL);
CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID NUMBER NOT NULL)
CREATE TABLE BATCH_JOB_SEQ (ID NUMBER NOT NULL)
CREATE TABLE BATCH_JOB_INSTANCE
(
JOB_INSTANCE_ID NUMBER PRIMARY KEY ,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(2500)
)
Code:
CREATE TABLE BATCH_JOB_PARAMS
(
JOB_INSTANCE_ID NUMBER NOT NULL,
TYPE_CD VARCHAR(6) NOT NULL,
KEY_NAME VARCHAR(100) NOT NULL,
STRING_VAL VARCHAR(250),
DATE_VAL DATE,
LONG_VAL NUMBER,
DOUBLE_VAL DOUBLE PRECISION,
CONSTRAINT JOB_INSTANCE_PARAMS_FK FOREIGN KEY (JOB_INSTANCE_ID) REFERENCES BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
)
CREATE TABLE BATCH_JOB_EXECUTION
(
JOB_EXECUTION_ID NUMBER PRIMARY KEY ,
VERSION NUMBER,
JOB_INSTANCE_ID NUMBER NOT NULL,
CREATE_TIME DATE NOT NULL,
START_TIME DATE NULL,
END_TIME DATE NULL,
STATUS VARCHAR(10),
EXIT_CODE VARCHAR(20),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED DATE,
CONSTRAINT JOB_INSTANCE_EXECUTION_FK FOREIGN KEY (JOB_INSTANCE_ID) REFERENCES BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
)
CREATE TABLE BATCH_STEP_EXECUTION
(
STEP_EXECUTION_ID NUMBER PRIMARY KEY ,
VERSION NUMBER NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID NUMBER NOT NULL,
START_TIME TIMESTAMP NOT NULL,
END_TIME TIMESTAMP NULL,
STATUS VARCHAR(10),
COMMIT_COUNT NUMBER,
READ_COUNT NUMBER,
FILTER_COUNT NUMBER,
WRITE_COUNT NUMBER,
READ_SKIP_COUNT NUMBER,
WRITE_SKIP_COUNT NUMBER,
PROCESS_SKIP_COUNT NUMBER,
ROLLBACK_COUNT NUMBER,
EXIT_CODE VARCHAR(20),
EXIT_MESSAGE VARCHAR(2500),
LAST_UPDATED TIMESTAMP,
CONSTRAINT JOB_EXECUTION_STEP_FK FOREIGN KEY (JOB_EXECUTION_ID) REFERENCES BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
)
CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT
(
JOB_EXECUTION_ID NUMBER PRIMARY KEY,
SHORT_CONTEXT VARCHAR2(2500) NOT NULL,
SERIALIZED_CONTEXT VARCHAR2(4000),
CONSTRAINT JOB_EXEC_CTX_FK FOREIGN KEY (JOB_EXECUTION_ID) REFERENCES BATCH_JOB_EXECUTION (JOB_EXECUTION_ID)
)
CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT
(
STEP_EXECUTION_ID NUMBER PRIMARY KEY,
SHORT_CONTEXT VARCHAR2(2500) NOT NULL,
SERIALIZED_CONTEXT VARCHAR2(4000),
CONSTRAINT STEP_EXEC_CTX_FK FOREIGN KEY (STEP_EXECUTION_ID) REFERENCES BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)
)
and my DB-JOBREPOSITORY.xml is
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="jobRepository-dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@1X.XXX.XX.XXX:XXXX:XXXX" />
<property name="username" value="XXXXX" /> <!-- your user id. e.g. root-->
<property name="password" value="XXXXX" /> <!-- your password-->
<property name="maxIdle" value="10"/>
<property name="maxActive" value="100"/>
<property name="maxWait" value="10000"/>
<property name="validationQuery" value="select 1 from dual"/>
<property name="testOnBorrow" value="true"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1200000"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
<property name="numTestsPerEvictionRun" value="5"/>
<property name="defaultAutoCommit" value="false"/>
</bean>
<bean id="jobRepository-transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
<property name="dataSource" ref="jobRepository-dataSource" />
</bean>
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="jobRepository-dataSource" />
<property name="transactionManager" ref="jobRepository-transactionManager"/>
<property name="databaseType" value="oracle" />
<property name="tablePrefix" value="batch_"/>
</bean>
<bean id="asyncTaskExecutor"
class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
<bean id="syncTaskExecutor"
class="org.springframework.core.task.SyncTaskExecutor" />
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository"/>
</bean>
<bean id="jobExplorer"
class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
p:dataSource-ref="jobRepository-dataSource" p:tablePrefix="batch_" />
</beans>
and i am getting the following error...
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [DB-JOBREPOSITORY.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:190)
at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:254)
at FileToTableMain.main(FileToTableMain.java:8)
Caused by: java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.init(XStreamExecutionContextStringSerializer.java:65)
at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.afterPropertiesSet(XStreamExecutionContextStringSerializer.java:60)
at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.afterPropertiesSet(JdbcExecutionContextDao.java:155)
at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.createExecutionContextDao(JobRepositoryFactoryBean.java:169)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.getTarget(AbstractJobRepositoryFactoryBean.java:139)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.initializeProxy(AbstractJobRepositoryFactoryBean.java:129)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.afterPropertiesSet(AbstractJobRepositoryFactoryBean.java:135)
at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:126)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 17 more
can you please correct me............
can any body correct me here..........