I have a webservice on axis2, and in this class a function starts a thread, another function checks if the thread is still running, but when i do a request for the function that checks of the thread is still runnning, i get this error:
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method isTaskRunning at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at be.kdg.cosys.thesis.ExecutorStub.isTaskRunning(ExecutorStub.java:487) at be.kdg.cosys.thesis.AllToPublicScheduler.executeTask(AllToPublicScheduler.java:158) at be.kdg.cosys.thesis.AllToPublicScheduler.incomingApplication(AllToPublicScheduler.java:106) at be.kdg.cosys.thesis.ParserToScheduler.run(ParserToScheduler.java:111) at java.lang.Thread.run(Unknown Source)
Here's is the webservice class:
public class Executor {
private Task task = null;
private long startTime = 0;
private long runTime = 0;
private Thread taskThread=null;
public void execute(byte[] object){
ObjectInputStream in = null;
try {
in = new ObjectInputStream(new ByteArrayInputStream(object));
task = (Task) in.readObject();
in.close();
} catch (IOException | ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
runTime = task.getRunTime();
startTime = System.currentTimeMillis();
taskThread=new Thread(task);
taskThread.start();
}
public long timeToFinish()
{
return runTime-(System.currentTimeMillis()-startTime);
}
public boolean isTaskRunning()
{
return taskThread.isAlive();
}
public byte[] getTask()
{
byte[] ser=null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
try {
out = new ObjectOutputStream(bos);
out.writeObject(task);
ser = bos.toByteArray();
out.close();
bos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ser;
}
}
On the server of the webservice i get a nullpointerexeception (log of catalina)
Can anyone help me?
Yorick