IBM BPM, V8.0.1, All platforms > Migrating and upgrading your IBM BPM environment > Migrating from other products > Migrating from WebSphere InterChange Server or WebSphere Business Integration Server Express > Troubleshooting migration from WebSphere InterChange Server or WebSphere Business Integration Server Express
Failure trying to serialize an object that is not serializable in a migrated BPEL file
If a serialization failure occurs in a BPEL file generated by the migration, you might be able to modify it to prevent the failure from occurring.
Problem: A serialization failure occurs in a custom snippet node of a business process execution language (BPEL) file generated by migration because an attempt is made to serialize an object that is not serializable.
Cause: In WebSphere InterChange Server or WebSphere Business Integration Server Express , a Collaboration Template is compiled into a single Java™ class. In IBM BPM, each node in a BPEL file might compile into a separate Java class. In WebSphere InterChange Server or WebSphere Business Integration Server Express, a variable can be declared once and shared throughout the various steps of a Collaboration Template. To simulate that behavior in the migrated BPEL file, each variable used in a code snippet must be retrieved at the start of the snippet and saved at the end of the snippet. Variables defined in WebSphere InterChange Server or WebSphere Business Integration Server Express Port definitions become BPEL variables. These are retrieved into BusObj variables at the beginning of each snippet (if referenced in the snippet) and saved back to the BPEL variables at the end of each snippet.For example, a retrieval at the beginning of snippets looks like this:
BusObj tempBusObj = null;if (tempBusObj_var != null) { tempBusObj = new BusObj(tempBusObj_var); };and a save at the end of snippets looks like this:if (tempBusObj == null) { tempBusObj_var = null; } else { tempBusObj_var = tempBusObj.getBusinessGraph(); }Other variables used in the WebSphere InterChange Server or WebSphere Business Integration Server Express snippet code are serialized and stored as a String in a BPEL variable named CollabTemplateName_var. These variables are deserialized at the beginning of each BPEL snippet, and then serialized and saved at the end of each BPEL Snippet that they are referenced in.For example, objects are retrieved like this:
BusObj tempBusObj = (BusObj)BaseCollaboration.deserialize (FrontEndCollab_var.getString("tempBusObj"));and objects are saved like this:FrontEndCollab_var.setString("tempBusObj", BaseCollaboration.serialize(tempBusObj));If the type of the object being serialized is not serializable, then using serialize and deserialize will fail when the BPEL is run.
Solution: After migration, modify the BPEL file as follows:
- For any variable that is not Java-serializable, update the BPEL snippets to remove the serialization and deserialization statements.
If the variable needs to be shared across snippets (instead of being re-created in each snippet) another method must be used to preserve the value of the variable across snippets.
- Manually define BPEL variables for variables of type BusObj that are not declared in the WebSphere InterChange Server or WebSphere Business Integration Server Express Port definitions but are used on Partner Invokes. This is a manual step because variables used during invokes in IBM BPM must be strongly typed, and the migration tools cannot accurately determine that type from the WebSphere InterChange Server or WebSphere Business Integration Server Express snippets.
The naming convention used by the migration tools is to add _var to the name of the variable in the snippet code when naming the BPEL variables.
For example, for a variable called tempBusObj in the snippet code, the migration tools will create a BPEL variable named tempBusObj_var.
- For variables that must be declared manually as BPEL variables, change the BPEL snippet code so that it uses the "deserialize/serialize" method of preserving these variables rather than the "retrieve from/store into BPEL variable" method of preserving these variables.