View Java 21 migration changes
The document outlines the key code changes introduced with the migration from Java 8 to Java 21 in the bot execution and WebHarvest Control Tower (CT) Worker projects, starting with Work.AI v10.3.
Refer to the Work.AI v10.3 release notes for specific library versions. For detailed implementation guidance, consult the official documentation for each updated library.
Bot execution project
With the bot execution project using Java 21, the following modifications are introduced.
Modified components
| Component | Change description | Before | After | Additional notes |
|---|---|---|---|---|
| Spring Framework | The HttpStatus.toString() method return has been modified. | Returns "code". | Returns "code name". | Update any code that parses the HttpStatus string representation. |
| Groovy | Group ID is renamed. | org.codehaus.groovy | org.apache.groovy | |
| Groovy | EasySSLProtocolSocketFactory is no longer available. | EasySSLProtocolSocketFactory | Can be replaced with SSLProtocolSocketFactory from commons-httpclient-3.1-jenkins-3.jar | |
| MVEL2 | The dependency was updated in the date-format plugin and other MVEL2-based libraries. | mvel2.version=2.1.3.Final | mvel2.version=2.5.2.Final | |
| Apache Tika | The dependency structure is reworked. | Single tika-parsers dependency | Three separate dependencies:
| All existing functionality remains without code changes. |
| Woodstox | The dependency is separated from Tika. | Previously within Tika. | com.fasterxml.woodstox:woodstox-core | XML processing capabilities remain the same, with no code changes required. |
| Apache POI | Cell types are removed from the org.apache.poi.ss.usermodel.Cell class. | org.apache.poi.ss.usermodel.Cell | org.apache.poi.ss.usermodel.CellType | |
| JSoup | The core class is renamed. | org.jsoup.safety.Whitelist | org.jsoup.safety.Safelist | |
| JAXB | New explicit JAXB dependencies are added. | New dependencies:
| The dependencies are automatically included and do not require code changes for the existing JAXB usage. | |
| SLF4J Bridge | SLF4J Bridge is added to avoid Log4j usage. | org.apache.logging.log4j:log4j-to-slf4j | All logging is through SLF4J. |
Deprecations
| Component | Change description | Before | After | Additional notes |
|---|---|---|---|---|
| WSS4J Base64 | The common Base64 utility class is replaced with a Java standard library. | org.apache.ws.security.util.Base64 | java.util.Base64 | |
| WSS4J UUID | The common UUIDGenerator utility class is replaced with a Java standard library. | org.apache.ws.security.util.UUIDGenerator | java.util.UUID | |
| OpenNLP | The OpenNLP dependency and associated split plugin are removed. | Evaluate and integrate alternative libraries if the natural language processing functionality is required. |
WebHarvest Control Tower Worker
Starting with Work.AI v10.3, the WebHarvest CT Worker project is also built using Java 21.
Modified components
| Component | Change description | Before | After |
|---|---|---|---|
| Byte Buddy | A new dependency is added. | New dependencies:
| |
| JNA | The Java Native Access (JNA) dependencies are now explicitly managed instead of being transitively taken from APM tracing. | Previously within APM. | New dependencies:
|
Broken backward compatibility
Be aware of broken backward compatibility between WebHarvest CT Worker Java 8 vs Java 21. The following constants, classes, and methods applicable for WebHarvest CT Worker Java 8 are deprecated and replaced with new alternatives for WebHarvest CT Worker Java 21:
| WebHarvest CT Worker Java 8 | WebHarvest CT Worker Java 21 |
|---|---|
|
|
applicationHost+applicationContextPath. |
|
internalApplicationHost+internalApplicationContextPath. |
|
ApplicationHost+ApplicationContextPath. |
|
internalApplicationHost + internalApplicationContextPath. |
|
workspaceApiInternalHost + workspacePath. |
|
workspaceApiInternalHost + workspacePath. |
|
|
|
|
|
The filter(String document, double confidenceThreshold) method from the com.workfusion.utils.extraction.TextAggregationProcessor class | Deprecated |
Class com.freedomoss.crowdcontrol.webharvest.plugin.datastore.dto.AnswerInfoDTO | The Set<String> excludedFromComparisonAnswers field from the class is deprecated. |
Class com.freedomoss.crowdcontrol.webharvest.plugin.datastore.dto.AutomationInfoDto | The following fields from the class are deprecated:
|
Class com.freedomoss.crowdcontrol.webharvest.extractor.text.SiteTextExtractor | The class is deprecated. Use TikaUtils for text extraction instead. |
Class com.freedomoss.crowdcontrol.webharvest.plugin.s3.AbstractS3Plugin | The following methods from the class are deprecated:
|
Class com.freedomoss.crowdcontrol.webharvest.plugin.s3.S3Plugin | The integration with S3 has been refactored to use the third-party s3-connector service. The following methods from the class are deprecated:
|
com.freedomoss.crowdcontrol.webharvest.web.Page | Deprecated |
com.freedomoss.crowdcontrol.webharvest.plugin.export.ExportPluginResult | Deprecated. Use com.workfusion.spa.bot.bep.output.v1.BotTaskResultData instead. |
Class: com.freedomoss.crowdcontrol.webharvest.plugin.export.MultiColumnPlugin | The boolean isResult fields from the class is deprecated. |
Package com.freedomoss.crowdcontrol.webharvest.plugin.security.provider | This package was necessary to maintain backward compatibility with the old ODF. However, with Java 21, it is no longer required and is deprecated. The ODF must also be updated accordingly. |
Class com.workfusion.spa.bot.bep.output.BotTaskExportResultData | Deprecated |
Class com.workfusion.spa.bot.bep.output.BotTaskReleaseResultData | Deprecated |
Class com.freedomoss.crowdcontrol.webharvest.web.dto.SecureEntryDTO | Deprecated. Use com.workfusion.bot.service.SecureEntryDTO instead. |
The javax package with the javax.xml.bind name | The jakarta package with the jakarta.xml.bind name |
Perform the following actions to make sure your code is up to date:
Replace all deprecated
WebHarvestConstantswith their new equivalents.Update configuration files and property references accordingly.
Replace
SiteTextExtractorusage withTikaUtilsfor text extraction functionality.Update S3 plugin implementations to use the new S3 connector instead of deprecated methods.
Replace
ExportPluginResultwithBotTaskResultDatain export operations.Update DTO imports to use the new
SecureEntryDTOpackage location.Remove deprecated fields from
AnswerInfoDTOandAutomationInfoDto.Remove calls to the deprecated
filter()method fromTextAggregationProcessor.Remove references to deprecated export result data classes.
WebHarvest plugin changes
| Plugin | Changes in WebHarvest CT Worker Java 21 |
|---|---|
| single-column | The deprecated xpath attribute is removed together with related code. |
| secure-store-delete | Deprecated. Use the secrets-vault-delete plugin instead. |
| secure-store-get | Deprecated. Use the secrets-vault-get plugin instead. |
| secure-store-put | Deprecated. Use the secrets-vault-put plugin instead. |
| secure-store-reset | Deprecated. Use the secrets-vault-reset plugin instead. |
| secure-store-update | Deprecated. Use the secrets-vault-update plugin instead. |
| export | The following deprecated attributes and related code are removed:
|
| secrets-vault-get | The deprecated provider attribute is removed. |
| split | Deprecated. |
| robot | The deprecated node-id attribute is removed. |
| selenium-flow | Deprecated. Use the robotics-flow plugin instead. |
| selenium | Deprecated. Use the robotic plugin instead. |
| automl-execute | Deprecated. Use the Model step functionality instead. |
| automation-extract | Deprecated. Use the Model step functionality instead. |
| s3-put-public | Deprecated. Use the s3-put plugin instead. |
| s3-put-private | Deprecated. Use the s3-put plugin instead. |
| s3-put-private | Deprecated. Use the s3-put plugin instead. |
Migration recommendations
Based on the changes above, consider the following recommendations:
- Refer to Work.AI v10.3 release notes for specific library versions. For more details, consult the official documentation for each updated library.
- Update all deprecated constants, classes, and methods listed in the Deprecations section for the Bot execution project and Broken backward compatibility for WebHarvest CT Worker.
- Verify all document extraction and parsing functionality with the new Tika structure.
- Test the XML processing functionality with a separate Woodstox dependency.
- Test all MVEL2 expressions, especially in the date-format plugin and custom libraries. Also, check for any deprecated MVEL2 API usage.
- Test all JSON serialization and deserialization operations and make sure your custom JSON processing logic works correctly.
- Verify the APM monitoring and tracing functionality.
- Test the JNA-based native library access functionality and verify that platform-specific operations work correctly.
- Update the Spring Framework
HttpStatusstring parsing logic where needed. - Change Groovy dependency group IDs from
org.codehaus.groovytoorg.apache.groovyin yourpom.xml. Make sure to replaceEasySSLProtocolSocketFactoryusage withSSLProtocolSocketFactory. - Update Apache POI cell type handling to use
CellTypeenum. - Test all the HTTP client functionality with updated OkHttp.
- Verify that the JAXB functionality works with new Jakarta dependencies.
- Update servlet imports from
javax.servlettojakarta.servletdue to the Java Servlet API being replaced with the Jakarta Servlet API. - Replace WSS4J utility classes with Java standard library equivalents.
- Remove any OpenNLP and split plugin dependencies and functionality.
- Ensure all logging is through SLF4J.