Skip to main content
Version: 10.3.2

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.

info

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

ComponentChange descriptionBeforeAfterAdditional notes
Spring FrameworkThe HttpStatus.toString() method return has been modified.Returns "code".Returns "code name".Update any code that parses the HttpStatus string representation.
GroovyGroup ID is renamed.org.codehaus.groovyorg.apache.groovy
GroovyEasySSLProtocolSocketFactory is no longer available.EasySSLProtocolSocketFactoryCan be replaced with SSLProtocolSocketFactory from commons-httpclient-3.1-jenkins-3.jar
MVEL2The dependency was updated in the date-format plugin and other MVEL2-based libraries.mvel2.version=2.1.3.Finalmvel2.version=2.5.2.Final
Apache TikaThe dependency structure is reworked.Single tika-parsers dependencyThree separate dependencies:
  • org.apache.tika:tika-core
  • org.apache.tika:tika-handler-boilerpipe
  • org.apache.tika:tika-parsers-standard-package
All existing functionality remains without code changes.
WoodstoxThe dependency is separated from Tika.Previously within Tika.com.fasterxml.woodstox:woodstox-coreXML processing capabilities remain the same, with no code changes required.
Apache POICell types are removed from the org.apache.poi.ss.usermodel.Cell class.org.apache.poi.ss.usermodel.Cellorg.apache.poi.ss.usermodel.CellType
JSoupThe core class is renamed.org.jsoup.safety.Whitelistorg.jsoup.safety.Safelist
JAXBNew explicit JAXB dependencies are added.New dependencies:
  • jakarta.xml.bind:jakarta.xml.bind-api
  • org.glassfish.jaxb:jaxb-runtime
  • jakarta.annotation:jakarta.annotation-api
The dependencies are automatically included and do not require code changes for the existing JAXB usage.
SLF4J BridgeSLF4J Bridge is added to avoid Log4j usage.org.apache.logging.log4j:log4j-to-slf4jAll logging is through SLF4J.

Deprecations

ComponentChange descriptionBeforeAfterAdditional notes
WSS4J Base64The common Base64 utility class is replaced with a Java standard library.org.apache.ws.security.util.Base64java.util.Base64
WSS4J UUIDThe common UUIDGenerator utility class is replaced with a Java standard library.org.apache.ws.security.util.UUIDGeneratorjava.util.UUID
OpenNLPThe 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

ComponentChange descriptionBeforeAfter
Byte BuddyA new dependency is added.New dependencies:
  • net.bytebuddy:byte-buddy
  • net.bytebuddy:byte-buddy-agent
JNAThe Java Native Access (JNA) dependencies are now explicitly managed instead of being transitively taken from APM tracing.Previously within APM.New dependencies:
  • net.java.dev.jna:jna
  • net.java.dev.jna:jna-platform

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 8WebHarvest CT Worker Java 21
  • WebHarvest constant: WebHarvestConstants.AUTOMATION_URL
  • WebHarvest context variable: automationAppUrl
  • WebHarvest constant: WebHarvestConstants.AUTOML_SERVICES_ENDPOINT
  • Webharvest context variable: automlServicesEndpoint
  • WebHarvest constant:WebHarvestConstants.APPLICATION_HOST
  • WebHarvest context variable: applicationHost
The pattern is to use applicationHost+applicationContextPath.
  • WebHarvest constant:WebHarvestConstants.CT_APP_API_URL
  • WebHarvest context variable: ctAppApiUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.INTERNAL_APPLICATION_HOST
  • WebHarvest context variable: internalApplicationHost
The pattern is to use internalApplicationHost+internalApplicationContextPath.
  • WebHarvest constant: WebHarvestConstants.CT_BOT_PLUGIN_API_URL
  • WebHarvest context variable: ctIntegrationBotPluginApiUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.APPLICATION_CONTEXT_PATH
  • WebHarvest context variable: ApplicationContextPath
The pattern is to use ApplicationHost+ApplicationContextPath.
  • WebHarvest constant: WebHarvestConstants.CT_APP_API_URL
  • WebHarvest context variable: ctAppApiUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.INTERNAL_APPLICATION_CONTEXT_PATH
  • WebHarvest context variable: internalApplicationHost
The pattern is to use internalApplicationHost + internalApplicationContextPath.
  • WebHarvest constant: WebHarvestConstants.CT_BOT_PLUGIN_API_URL
  • WebHarvest context variable: ctIntegrationBotPluginApiUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.WORKSPACE_INTERNAL_HOST
  • WebHarvest context variable: workspaceApiInternalHost
The pattern is to use workspaceApiInternalHost + workspacePath.
  • WebHarvest constant: WebHarvestConstants.WORKSPACE_API_INTERNAL_URL
  • WebHarvest context variable: workspaceApiInternalUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.WORKSPACE_PATH
  • WebHarvest context variable: workspacePath
The pattern is to use workspaceApiInternalHost + workspacePath.
  • WebHarvest constant: WebHarvestConstants.WORKSPACE_API_INTERNAL_URL
  • WebHarvest context variable: workspaceApiInternalUrl
Includes both the URL and the context.
  • WebHarvest constant: WebHarvestConstants.WORKFUSION_ACCESS_KEY
  • WebHarvest context variable:workfusionAcessKey
  • WebHarvest constant: WebHarvestConstants.S3_ACCESS_KEY
  • WebHarvest context variable:s3AccessKey
  • WebHarvest constant: WebHarvestConstants.WORKFUSION_SECRET_KEY
  • WebHarvest context variable: workfusionSecretKey
  • WebHarvest constant: WebHarvestConstants.S3_SECRET_KEY
  • WebHarvest context variable: s3SecretKey
The filter(String document, double confidenceThreshold) method from the com.workfusion.utils.extraction.TextAggregationProcessor classDeprecated
Class com.freedomoss.crowdcontrol.webharvest.plugin.datastore.dto.AnswerInfoDTOThe Set<String> excludedFromComparisonAnswers field from the class is deprecated.
Class com.freedomoss.crowdcontrol.webharvest.plugin.datastore.dto.AutomationInfoDtoThe following fields from the class are deprecated:
  • private boolean retrainCountChanged;
  • private Long retrainRecordsCount;
  • private String newExperimentGroup;
Class com.freedomoss.crowdcontrol.webharvest.extractor.text.SiteTextExtractorThe class is deprecated. Use TikaUtils for text extraction instead.
Class com.freedomoss.crowdcontrol.webharvest.plugin.s3.AbstractS3PluginThe following methods from the class are deprecated:
  • String constructLinkToFile(String bucket, String path, Scraper scraper)
  • String getEndpointUrl(Scraper scraper)
Class com.freedomoss.crowdcontrol.webharvest.plugin.s3.S3PluginThe integration with S3 has been refactored to use the third-party s3-connector service. The following methods from the class are deprecated:
  • AmazonS3 getConnection(Scraper scraper)
  • TransferManager getTransferManager()
com.freedomoss.crowdcontrol.webharvest.web.PageDeprecated
com.freedomoss.crowdcontrol.webharvest.plugin.export.ExportPluginResultDeprecated. Use com.workfusion.spa.bot.bep.output.v1.BotTaskResultData instead.
Class: com.freedomoss.crowdcontrol.webharvest.plugin.export.MultiColumnPluginThe boolean isResult fields from the class is deprecated.
Package com.freedomoss.crowdcontrol.webharvest.plugin.security.providerThis 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.BotTaskExportResultDataDeprecated
Class com.workfusion.spa.bot.bep.output.BotTaskReleaseResultDataDeprecated
Class com.freedomoss.crowdcontrol.webharvest.web.dto.SecureEntryDTODeprecated. Use com.workfusion.bot.service.SecureEntryDTO instead.
The javax package with the javax.xml.bind nameThe jakarta package with the jakarta.xml.bind name

Perform the following actions to make sure your code is up to date:

  • Replace all deprecated WebHarvestConstants with their new equivalents.

  • Update configuration files and property references accordingly.

  • Replace SiteTextExtractor usage with TikaUtils for text extraction functionality.

  • Update S3 plugin implementations to use the new S3 connector instead of deprecated methods.

  • Replace ExportPluginResult with BotTaskResultData in export operations.

  • Update DTO imports to use the new SecureEntryDTO package location.

  • Remove deprecated fields from AnswerInfoDTO and AutomationInfoDto.

  • Remove calls to the deprecated filter() method from TextAggregationProcessor.

  • Remove references to deprecated export result data classes.

WebHarvest plugin changes

PluginChanges in WebHarvest CT Worker Java 21
single-columnThe deprecated xpath attribute is removed together with related code.
secure-store-deleteDeprecated. Use the secrets-vault-delete plugin instead.
secure-store-getDeprecated. Use the secrets-vault-get plugin instead.
secure-store-putDeprecated. Use the secrets-vault-put plugin instead.
secure-store-resetDeprecated. Use the secrets-vault-reset plugin instead.
secure-store-updateDeprecated. Use the secrets-vault-update plugin instead.
exportThe following deprecated attributes and related code are removed:
  • data-only
  • external-url
  • cost
secrets-vault-getThe deprecated provider attribute is removed.
splitDeprecated.
robotThe deprecated node-id attribute is removed.
selenium-flowDeprecated. Use the robotics-flow plugin instead.
seleniumDeprecated. Use the robotic plugin instead.
automl-executeDeprecated. Use the Model step functionality instead.
automation-extractDeprecated. Use the Model step functionality instead.
s3-put-publicDeprecated. Use the s3-put plugin instead.
s3-put-privateDeprecated. Use the s3-put plugin instead.
s3-put-privateDeprecated. 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 HttpStatus string parsing logic where needed.
  • Change Groovy dependency group IDs from org.codehaus.groovy to org.apache.groovy in your pom.xml. Make sure to replace EasySSLProtocolSocketFactory usage with SSLProtocolSocketFactory.
  • Update Apache POI cell type handling to use CellType enum.
  • Test all the HTTP client functionality with updated OkHttp.
  • Verify that the JAXB functionality works with new Jakarta dependencies.
  • Update servlet imports from javax.servlet to jakarta.servlet due 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.