Cannot instantiate process definition testing:1:85607f56-6306-11ec-a7fe-080027e0c096: couldn't execute activity <serviceTask id="say-hello" ...>: com.mysql.jdbc.Driver

Hi Team,
I am getting this error - Cannot instantiate process definition testing:1:85607f56-6306-11ec-a7fe-080027e0c096: couldn’t execute activity <serviceTask id=“say-hello” …>: com.mysql.jdbc.Driver

Please help me
.Processing: process.zip…
process.bpmn (4.8 KB)

Source Inventory code is also here-

package anishinventory.testing;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;

public class SourceInventory implements JavaDelegate {
private List inv1 = new ArrayList();
@Override
public void execute(DelegateExecution execution) throws Exception {
// TODO Auto-generated method stub
String url = “jdbc:mysql://localhost/inv”;
String user = “root”;
String pass = “37May@2154”;

	Class.forName("com.mysql.jdbc.Driver");
	Connection con = DriverManager.getConnection(url, user, pass);
	Statement st = con.createStatement();
	ResultSet rs = st.executeQuery("Select * from port where ProvisionStatus = 'Available'");
	
	while(rs.next())
	{
		inv1.add(rs.getInt("PortID"));
	}
	
	int rollno = (int) execution.getVariable("RollNo");
	

	if(inv1.contains(rollno))
	{
		System.out.println("Inventory found from source inventory");
		
		execution.setVariable("inventoryfound", true);
	}
	else
	{
		execution.setVariable("inventoryfound", false);
	}
}

}

Hey @AnishYadav ,

have you copied the qualified name of the Java class to link it to your process model? It could be the reason that the class can’t be located in runtime.

You could also use for the Servicetask the Implementation Delegate Expression with #{className}
In your class you have to use the @Named Annotation to avoid links to direct locations.

I hope that helps
Kind regards
Nele

Sir,
I have given Java class to process model and it has accepted because they are showing [com.mysql.jdbc.Driver . and [com.mysql.jdbc.Driver is within the java class.