当我尝试运行此代码来执行批处理作业时:
JobOperator jo = BatchRuntime.getJobOperator();
Properties props = new Properties();
long jobId = jo.start("tweetimport", props);我一直收到一个错误。当我试图从servlet运行它时,我得到了这个错误:
Severe: Could not instantiate service: com.ibm.jbatch.container.impl.BatchKernelImpl due to exception:java.lang.reflect.InvocationTargetException
Warning: StandardWrapperValve[KwetterServlet]: Servlet.service() for servlet KwetterServlet threw exception
java.util.ServiceConfigurationError: javax.batch.operations.JobOperator: Provider com.ibm.jbatch.container.api.impl.JobOperatorImpl could not be instantiated当我从一个普通的java类运行它时,我得到了这个错误:
mrt 21, 2016 10:19:08 AM javax.batch.runtime.BatchRuntime getJobOperator
WARNING: The ServiceLoader was unable to find an implementation for JobOperator. Check classpath for META-INF/services/javax.batch.operations.JobOperator file.
Exception in thread "main" java.lang.NullPointerException我在Other Sources > src/main/resources >META-INF.批处理作业中有这个tweetimport.xml文件
<job id="tweetimport" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
<properties>
<property name="input_file" value="/KwetterBackend/kwetter-input.json"/>
</properties>
<step id="process">
<chunk item-count="100">
<reader ref="TweetReader"></reader>
<processor ref="TweetProcessor"></processor>
<writer ref="TweetWriter"></writer>
</chunk>
</step>
我不明白为什么我会得到这个错误。The link to my project
发布于 2016-03-21 18:06:20
我已经找到了答案,我必须启动这个程序: glassfish-4.1\bin\asadmin,然后执行下面这行:
set-batch-runtime-configuration --datasourcelookupname nameofyourJDBCdatasource现在它工作得很好。
https://stackoverflow.com/questions/36127480
复制相似问题