Wednesday, February 25, 2015

java.sql.SQLException: ORA-04068: existing state of packages has been discarded

 

Symptom/Problem/Error:

Three possible reasons for this error:

Cause 1: Object used within a session

If the error comes from the same Database session that created or altered the object, most likely this is due to incomplete transaction. To solve this issue COMMIT or ROLLBACK.

Cause 2: Another Session used Object

If the error comes from Oracle Client (SQL Plus, TOAD, SQL Developer, etc), another session either has incomplete transaction or current session has incomplete transaction.

Resolution Steps:

Commit session that has incomplete transaction

Make sure you disconnect each session that has used the package or have the session do a DBMS_SESSION.RESET_PACKAGE to reset the package state.

BEGIN

DBMS_SESSION.RESET_PACKAGE;

END;

/

Cause 3: The Object is used indirectly within Java Servlet

When a package is called from a Java Servlet, the same error may happen even if the proper steps are done

Resolution Steps:

Close current browsers & clients

Do steps mentioned in “Cause 2”

Abort and Restart OA Core Servers

{ echo <pwd> ; }| admanagedsrvctl.sh abort oacore_server1 @-nopromptmsg

{ echo <pwd> ; }| admanagedsrvctl.sh start oacore_server1 @-nopromptmsg

 

Keywords:

SQLException, ORA-04068, existing state of packages has been discarded, ASADMIN, Transaction, COMMIT, ROLLBACK