您好,我正在尝试在春季批处理中运行一项工作,但它给了我这个我不知道如何解决的错误:
`$` C:\Program Files\Microsoft Visual Studio 8\VC>java -jar C:\Workspacetest\testpro
ject\target\ams-eod-0.0.1-SNAPSHOT.jar copyJob 1 `$`
Exception in thread "main" java.lang.NullPointerException
at sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:399)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)
然而,这是我的应用程序上下文。有人可以帮我解决这个错误吗?几句话来描述这项工作的作用,这项工作从数据库中读取一些记录,然后对每条记录(行 * 3.75)执行计算,然后更新记录。
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
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.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
<beans:bean id="itemReader" class="org.spr...JdbcCursorItemReader">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="sql" value="select * from Trans WHERE id =?"/>
<beans:property name="rowMapper" ref= "CustomerCreditRowMapper"/>
<beans:property name="preparedStatementSetter" ref="idSetter"/>
</beans:bean>
<beans:bean id="transactionProcessor" class="">
<beans:property name="targetObject" ref="Processing"/>
<beans:property name="targetMethod" value="process"/>
</beans:bean>
<beans:bean id="jdbcWriter"
class="org.springframework.batch.item.database.JdbcBatchItemWriter">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="sql" value="update Trans set (amount) values (?)"/>
<beans:property name="preparedStatementSetter" ref="idSetter"/>
</beans:bean>
<step id="CopyFileStep">
<tasklet>
<chunk reader="itemReader"
processor="transactionProcessor"
writer="jdbcWriter"
commit-interval="10"/>
</tasklet>
</step>
<job id="copyJob">
<step id="step1" parent="CopyFileStep"/>
</job>
<beans:bean id="preparedStatementSetter"
class="sa.com.anb.itg.dev.settlement.batch.Itemwriter"/>
<beans:bean id="idSetter" class="sa.com.anb.itg.dev.settlement.batch.idSetter"
scope="step">
<beans:property name="id" value="#{jobParameters[id]}"/>
</beans:bean>
<beans:bean id="CustomerCreditRowMapper"
class="sa.com.anb.itg.dev.settlement.batch.CustomerCreditRowMapper"/>
<beans:bean id="AmountToTransactionItemProcessor"
class="sa.com.anb.itg.dev.settlement.batch.AmountToTransactionItemProcessor">
<beans:property name="TransactionDAO" ref="TransactionDAO"/>
</beans:bean>
<beans:bean id="TransactionDAO" class="sa.com.anb.itg.dev.settlement.batch.TransactionDAO">
<beans:property name="datasource" ref="dataSource"/>
</beans:bean>
<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<beans:property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<beans:property name="url" value="jdbc:oracle:thin:@192.168.84.208:1556:pay10g" />
<beans:property name="username" value="ams_recon" />
<beans:property name="password" value="ams_recon" />
</beans:bean>
<beans:bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="transactionManager" ref="transactionManager"/>
</beans:bean>
<beans:bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<beans:property name="jobRepository" ref="jobRepository" />
</beans:bean>
<beans:bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
<beans:property name="dataSource" ref="dataSource"/>
</beans:bean>
</beans:beans>