Thursday, March 5, 2015

Business Rules - java.lang.ArrayIndexOutOfBoundsException: -1

Having a composite which uses Business Rules would out of nowhere stop completing properly and just start giving the following errors in the payload:

<bpelFault>
<faultType>0</faultType>
<operationErroredFault>
<part  name="payload">
<errorInfo>
<errorMessage>-1</errorMessage>
</errorInfo>
</part>
</operationErroredFault>
</bpelFault>

The logs would be equally unhelpful:
[2015-03-04T18:32:41.703-06:00] [soa_server1] [ERROR] [] [oracle.soa.services.rules] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\n] [userId: <anonymous>] [ecid: 11d1def534ea1be0:-15391dae:14aac95ef8b:-8000-00000000019021ae,0] [APP: soa-infra] [composite_instance_id: 1983847] [component_instance_id: b39ee544-7266-43b3-b180-3c107ca2f0ad] [composite_name: Dynamic_DirectoryFTP!3.5] [component_name: DynamicDirectoryRules] <.> Error creating the decision document.[[
Error while trying to create the decision document for DynamicDirectoryRules_DecisionService.
Check the underlying exception and correct the error. If the error persists, contact Oracle Support Services.
 Error creating the decision document.
Error while trying to create the decision document for DynamicDirectoryRules_DecisionService.

Check the underlying exception and correct the error. If the error persists, contact Oracle Support Services.   at oracle.bpel.services.rules.impl.DocumentHandler.createElementFromDecision(DocumentHandler.java:417)
    at oracle.bpel.services.rules.fabric.BusinessRulesServiceEngine.createNormalizedMessage(BusinessRulesServiceEngine.java:2747)
    at oracle.bpel.services.rules.fabric.BusinessRulesServiceEngine.request(BusinessRulesServiceEngine.java:1057)
    at oracle.integration.platform.blocks.mesh.SynchronousMessageHandler.doRequest(SynchronousMessageHandler.java:139)
    at oracle.integration.platform.blocks.mesh.MessageRouter.request(MessageRouter.java:182)
    at oracle.integration.platform.blocks.mesh.MeshImpl.request(MeshImpl.java:190)
    at sun.reflect.GeneratedMethodAccessor1925.invoke(Unknown Source)
[.......]
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at com.sun.xml.bind.v2.util.CollisionCheckStack.pushNocheck(CollisionCheckStack.java:132)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:491)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:250)


After trying everything, from starting the composite application from scratch, to undeploying and re-deploying the application, to re-creating only the ruleset, and restarting servers, we eventually found out that there was a patch available for this error:



RELEASE NOTES:
]]   In 11.1.1.6 Rules engine randomly throws 'java.lang.ArrayIndexOutOfBoundsE
]]xception:-1" environment when running a composite application using business 
]]rules.
REDISCOVERY INFORMATION:
  If Rules Engine throws 'java.lang.ArrayIndexOutOfBoundsException:-1' from the
 jaxb marshaller code you might be encountering this bug. 


Applies to:

Oracle(R) BPEL Process Manager - Version 11.1.1.6.0 to 11.1.1.7.0 [Release 11gR1]
Oracle SOA Suite - Version 11.1.1.6.0 to 11.1.1.7.0 [Release 11gR1]
Information in this document applies to any platform.

-----------------------

To apply the patch, we followed these steps:

  1. Went to My Oracle Support and downloaded the patch. The patch includes two folders for different products, we used the "oui" folder for Oracle Business Process Management Suite.
  2. Set the ORACLE_HOME environment variable:
           $ ORACLE_HOME=/u01/local/oracle/Middleware/Oracle_SOA1
  3. Ran the opatch lsinventory to make sure it completed successfully:

          [oracle@ Oracle_SOA1]$ OPatch/opatch lsinventory
    Oracle Interim Patch Installer version 11.1.0.9.9
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.
    Oracle Home       : /u01/local/oracle/Middleware/Oracle_SOA1
    Central Inventory : /u01/local/oracle/oraInventory
       from           : /u01/local/oracle/Middleware/Oracle_SOA1/oraInst.loc
    OPatch version    : 11.1.0.9.9
    OUI version       : 11.1.0.9.0
    Log file location : /u01/local/oracle/Middleware/Oracle_SOA1/cfgtoollogs/opatch/opatch2015-03-05_14-03-08PM_1.log
    OPatch detects the Middleware Home as "/u01/local/oracle/Middleware"
    Lsinventory Output file location : /u01/local/oracle/Middleware/Oracle_SOA1/cfgtoollogs/opatch/lsinv/lsinventory2015-03-05_14-03-08PM.txt
    --------------------------------------------------------------------------------
    Installed Top-level Products (1):
    Oracle SOA Suite 11g      11.1.1.7.0
    There are 1 products installed in this Oracle Home.
    There are no Interim patches installed in this Oracle Home.
    ------------------------------------------------------------------------------
    OPatch succeeded.

  4. Made sure "unzip" and "opatch" were part of my PATH environment variable:

    [oracle@srgismty1-0499 Oracle_SOA1]$ which unzip
    /usr/bin/unzip
    [oracle@srgismty1-0499 Oracle_SOA1]$ which opatch
    /usr/bin/which: no opatch in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin)
    [oracle@srgismty1-0499 Oracle_SOA1]$ PATH=$PATH:/u01/local/oracle/Middleware/Oracle_SOA1/OPatch
    [oracle@srgismty1-0499 Oracle_SOA1]$ which opatch
    /u01/local/oracle/Middleware/Oracle_SOA1/OPatch/opatch
  5. Unzipped the patch: $ unzip p14272172_111170_Generic.zip
  6. Went to the directory where the patch is located: $ cd 14272172/oui/
  7. Applied the patch:

    [oracle@server oui]$ $ORACLE_HOME/OPatch/opatch apply


    Oracle Interim Patch Installer version 11.1.0.9.9
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.


    Oracle Home       : /u01/local/oracle/Middleware/Oracle_SOA1
    Central Inventory : /u01/local/oracle/oraInventory
       from           : /u01/local/oracle/Middleware/Oracle_SOA1/oraInst.loc
    OPatch version    : 11.1.0.9.9
    OUI version       : 11.1.0.9.0
    Log file location : /u01/local/oracle/Middleware/Oracle_SOA1/cfgtoollogs/opatch/14272172_Mar_05_2015_14_15_29/apply2015-03-05_14-15-28PM_1.log


    OPatch detects the Middleware Home as "/u01/local/oracle/Middleware"

    Applying interim patch '14272172' to OH '/u01/local/oracle/Middleware/Oracle_SOA1'
    Verifying environment and performing prerequisite checks...
    All checks passed.

    Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
    (Oracle Home = '/u01/local/oracle/Middleware/Oracle_SOA1')


    Is the local system ready for patching? [y|n]
    y

    User Responded with: Y
    Backing up files...

    Patching component oracle.integration.soainfra, 11.1.1.7.0...

    Verifying the update...
    Patch 14272172 successfully applied
    Log file location: /u01/local/oracle/Middleware/Oracle_SOA1/cfgtoollogs/opatch/14272172_Mar_05_2015_14_15_29/apply2015-03-05_14-15-28PM_1.log

    OPatch succeeded.
  8. Restarted managed and admin servers and the composite was now completing successfully! :)