Resolve Error ORA-04068: existing state of packages has been discarded

If you receive a java.sql.SQLException: ORA-04068: existing state of packages has been discarded error, then perform the following tasks.

  1. Ensure that the stored procedure is stateless.
  2. Avoid using global variables.