We recently upgraded from TC 12.4 to 13.1 and our custom sustainability management workflow is now failing at the review stage. The workflow initiates successfully and progresses through data collection, but when it reaches the sustainability review handler, we get a null pointer exception.
The workflow engine logs show:
ERROR WorkflowEngine - NullPointerException
at SustainabilityHandler.execute(line 142)
at EPMHandler.performAction(line 89)
The sustainability data appears to be loading correctly in the UI, and the workflow service is running without errors in the system monitor. This is blocking all our environmental compliance reviews. Has anyone encountered similar issues with custom workflow handlers after upgrading to 13.1?
This sounds like a data mapping issue between your sustainability objects and the workflow context. In TC 13.1, the way workflow variables access related business objects changed. If your handler expects sustainability data to be automatically populated in the workflow context but the new engine requires explicit data mapping configuration, you’d get exactly this NPE pattern. The fact that data shows correctly in UI but fails in workflow suggests the context isn’t being populated. Check your workflow template’s variable assignments and ensure sustainability attributes are explicitly mapped to workflow variables in the process definition.
Here’s the complete solution addressing all three aspects - workflow engine compatibility, sustainability data access, and service configuration:
1. Workflow Engine API Update:
TC 13.1 deprecated direct attribute access in workflow handlers. Update your SustainabilityHandler code:
// Old pattern (causes NPE in 13.1):
String value = target.getAttribute("sustainabilityScore");
// New pattern for 13.1:
String value = PropertyHelper.getPropertyValue(target, "sustainabilityScore", "");
2. Sustainability Data Access:
Use the new SustainabilityDataHelper utility introduced in 13.1. This properly handles the restructured sustainability data model and includes null safety:
SustainabilityDataHelper helper = new SustainabilityDataHelper();
SustainabilityMetrics metrics = helper.getMetrics(workflowTarget);
if (metrics != null && metrics.isValid()) {
// Process sustainability data
}
3. Workflow Service Configuration:
Update your workflow handler registration in site.xconf to use the new service architecture. The handler must be registered under the new WorkflowService2 framework:
<Service name="WorkflowService2">
<Option name="customHandlers">
<Handler class="com.custom.SustainabilityHandler"
version="13.1"
requiresDataMapping="true"/>
</Option>
</Service>
The key issue is that TC 13.1’s workflow engine requires explicit data mapping configuration when handlers access complex business objects like sustainability data. The old automatic context population was removed for performance reasons. After making these changes, restart the workflow service and test with a new workflow instance (existing instances might still fail). Also verify your handler’s JAR is in $WT_HOME/codebase/WEB-INF/lib and not in the old extlib location which 13.1 ignores.
If you still see issues after these updates, enable debug logging for wt.workflow.engine and wt.sustainability packages to see exactly where the data mapping fails. The logs will show if sustainability attributes aren’t being resolved during workflow variable assignment.
Thanks for the suggestions. I checked the handler registration and it looks correct in site.xconf. The getAttribute() theory is interesting - we are using some older API patterns. Could you point me to documentation on the new getPropertyValue() approach? Also, the data mapping angle makes sense since the UI works but workflow doesn’t.
Are you seeing any warnings in the workflow service logs during initialization? TC 13.1 introduced stricter validation for workflow handler registration. If your handler isn’t properly registered with the new service architecture, it might fail silently during handler instantiation but throw NPE when actually invoked. Check your site.xconf for proper handler declarations.
I worked on a similar upgrade project last quarter. Beyond the API changes mentioned, TC 13.1 also changed how sustainability compliance attributes are accessed through workflow context. The old direct reference pattern doesn’t work anymore. You need to use the SustainabilityDataHelper utility class introduced in 13.1 to properly extract sustainability metrics from the workflow target object. This ensures proper null checking and handles the new data structure.
Check your custom handler’s classpath dependencies too. TC 13.1 reorganized some workflow libraries and if your handler has hardcoded references to old JAR locations, it might compile but fail at runtime with NPE when trying to access workflow engine internals. We had this exact issue and had to update our Ant build scripts to reference the new lib structure.
I’ve seen similar NPE issues after TC 13.1 upgrades. The workflow engine API changed slightly in 13.1, particularly around how custom handlers access business object attributes. Check if your SustainabilityHandler is using deprecated getAttribute() methods. You might need to update to the new getPropertyValue() pattern that was introduced in 13.1 for better null safety.