EJB를 사용하여 목록을 채우려는 배치도에 문제가 있습니다. JSR-352 Batchlet ejb nullPointerException
나는이 프로젝트를 시작
, 글래스 피쉬 플래그 오류 :@Named
public class getPingStatusBatchlet extends AbstractBatchlet {
private static GetPingStatus gps = new GetPingStatus();
private List<Node> nodes = null;
@EJB
private NodeFacade nodeEJB;
@Override
public String process() throws NamingException {
nodes = nodeEJB.findAll();
for (Node item : nodes) {
gps.getPingStatus(item.getIpv4());
}
return "COMPLETED";
}
@Override
public void stop() throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
내가 실행하려고 :
Caught exception executing step: com.ibm.jbatch.container.exception.BatchContainerRuntimeException: java.lang.NullPointerException
글래스 피시 버전은 내 batchlet의 코드는 4.1.1
입니다 디버그에서 응용 프로그램을 검사하고 nodeEJB를 검사하면 항상 null 값을 유지합니다.
내 배치 표에 EJB를 어떻게 사용할 수 있습니까?
NodeFacade 코드 :
@Stateless
public class NodeFacade extends AbstractFacade<Node> {
@PersistenceContext(unitName = "powwoPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public NodeFacade() {
super(Node.class);
}
}
beans.xml 환경 :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"/>
getNetworkStatusB 당신의 도움이
Ersch
편집에 대한
감사합니다 atch.xml :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<job version="1.0" id="getNetworkStatusBatch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/jobXML_1_0.xsd" xmlns="http://xmlns.jcp.org/xml/ns/javaee" >
<step id="getNetworkStatusBatchlet">
<batchlet ref="com.powwo.app.batchlet.getPingStatusBatchlet"/>
</step>
</job>
myBackgroundJobManager.java :
@Singleton
@Startup
public class BackgroundJobManager {
@Schedule(minute = "*", hour = "*", second = "*/10", persistent = false)
public void myBackgroundJobManager() {
BatchRuntime.getJobOperator().start("getNetworkStatusBatch", null);
}
}
NodeFacade.java의 내용을 게시 해주세요. – D00de
안녕하세요. 게시글을 추가했습니다. – Ersch
삽입해야하며 null로 평가되지 않아야합니다. 프로젝트를 github에 게시 할 수 있습니까? 어떤 Glassfish 버전을 사용하고 있습니까? – D00de