Hello ,
I created a form in a user task in the modeler and successfully deployed it.
I also created a java delegate (task worker) to retrieve data from a restful web service.
NB: The executable option is marked as true.
I haven’t set a form key
I call the delegate class in the task worker that proceeds the user task. ( implementation::Java Class, Java Class: CustomerServiceDelegate)
However, I keep getting this error.
Also, the war file containing the java class is named delegate-version.war
The process could not be started. : Cannot instantiate process definition Process_custRetrieval:9:34fd2605-d685-11e8-923a-80c5f219eb4d: ENGINE-09008 Exception while instantiating class ‘CustomerServiceDelegate’: ENGINE-09017 Cannot load class ‘CustomerServiceDelegate’: CustomerServiceDelegate
Imports …
public class CustomerServiceDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
String firstname = (String) execution.getVariable(“firstname”);
System.out.println(firstname);
System.out.println("INFO: Making request to service");
HttpURLConnection connection = createConnection();
try {
BufferedReader get = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String JSONResponse = get.readLine();
Customer customer = deSerializeJson(JSONResponse);
System.out.println("INFO: Setting customer values");
execution.setVariable("lastname", customer.getLastName());
execution.setVariable("account", customer.getAccount());
execution.setVariable("gender", customer.getGender());
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("INFO: Task completed");
}
Customer deSerializeJson(String json){
Gson gson = new Gson();
return gson.fromJson(json,Customer.class);
}
public static HttpURLConnection createConnection(){
try {
URL resource = new URL("http://localhost:3000/customer");
HttpURLConnection connection = (HttpURLConnection) resource.openConnection();
connection.setRequestMethod("GET");
return connection;
}catch (MalformedURLException ex){
System.out.println("Wrong URL");
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
class Customer {
}
}