Installing the Commerce+ Transaction Server Query toolkit environment

Set up a local Query toolkit environment so that you can build and run your search customizations on your own workstation. This procedure replaces the earlier container-based local runtime and lets you develop, build, and test customizations against your target search service before you deploy them.

Before you begin

In earlier releases, you built your search customizations and ran them locally in a container-based runtime. That local runtime is no longer provided. Until the packaged toolkit bundle is available, use this procedure to set up an equivalent environment on your own workstation.

Confirm that the following software is available before you begin:

  • JDK 21, with the JAVA_HOME environment variable configured.
  • An Eclipse IDE for enterprise Java and web developers.
  • The Buildship Gradle Integration and Liberty Tools Eclipse plug-ins.
  • Gradle 8.10.2, provided either through the Gradle wrapper or an extracted local installation.
  • Access details for your target search service endpoint, for use when you configure the application.

About this task

The toolkit environment runs entirely on a local server and connects directly to your search service. Your customizations are implemented as local components, so the environment does not require a separate deployment artifact or a container runtime.

Procedure

  1. Initialize and configure the local Java 21 project.

    Prepare a local Gradle installation - when direct downloads are blocked in your network, extract the approved Gradle 8.10.2 archive locally and verify that the Gradle launcher and the reported JVM version are correct before you continue. The version output must report Gradle 8.10.2 and JVM 21. If a different JVM is reported, correct JAVA_HOME first.

    Create and initialize the project - create the project directory, then run a basic Gradle initialization with the Groovy DSL and the project name ElasticSDK. Initialization creates build.gradle, settings.gradle, and the Gradle metadata. Replace the generated build file with the project build configuration for this environment.

    Generate the Gradle wrapper - generate the wrapper for Gradle 8.10.2, then confirm that gradlew, gradlew.bat, and the wrapper files under gradle/wrapper exist. If the wrapper cannot download Gradle in your network, configure an approved proxy or internal repository, or point the wrapper at your extracted local Gradle installation.

    Create the source directories - create the standard source layout for the main Java sources, the main resources, the Liberty configuration, and the test sources.

  2. Apply the core project versions and Gradle configuration.

    Configure the project to use the following components and roles:

    • Java - JDK 21.
    • Gradle wrapper - 8.10.2.
    • Spring Boot - used through the dependency bill of materials, not as the Spring Boot Gradle plug-in.
    • Servlet API - Jakarta Servlet 6.0.
    • Local runtime - a Java 21-capable server with the servlet-6.0 feature.
    Important: For a standard web application deployment, do not apply the Spring Boot Gradle plug-in in this project. Use the Spring Boot dependency bill of materials and a standard web application configuration instead. Applying the Spring Boot plug-in produces a packaging error when the application is deployed to the local server.
  3. Configure the local server.

    Create the local server configuration that enables the servlet-6.0 feature, defines the HTTP endpoint, and deploys the application at its context root. Save this file in the Liberty configuration directory of your project (src/main/liberty/config/server.xml).

    
    <?xml version="1.0" encoding="UTF-8"?>
    <server description="Standalone search service - Java 21">
        <featureManager>
            <feature>servlet-6.0</feature>
        </featureManager>
        <httpEndpoint id="defaultHttpEndpoint"
                      host="*"
                      httpPort="9080"
                      httpsPort="9443"/>
        <webApplication id="ElasticSDK"
                        location="ElasticSDK.war"
                        contextRoot="/ElasticSDK"/>
    </server>
  4. Configure connectivity to your search service.

    Use external configuration rather than hard-coding the search service address in Java source code. Provide the host, port, scheme, environment prefix, and credentials as external properties, and supply the matching environment values in the server environment file (src/main/liberty/config/server.env).

    Tip: The sample builds the index name as {environment-prefix}.{storeId}.attribute, for example auth.10101.attribute. Confirm that this matches your target Commerce+ Transaction Server index naming and mapping.
  5. Add a connectivity health endpoint.

    Add a health endpoint that reports whether the search service is reachable. After the local server starts, test it at the following local URL:

    http://localhost:9080/ElasticSDK/api/health/elasticsearch
  6. Import and run the project in Eclipse.

    Configure JDK 21 - in the Eclipse preferences, add the JDK 21 installation as a standard VM, select it as the default, and set the same JDK 21 as the Gradle JVM.

    Import the project - import the project as an existing Gradle project, choosing the directory that directly contains build.gradle, settings.gradle, and gradlew.bat. Select the Gradle wrapper, or select the extracted local Gradle 8.10.2 installation when wrapper downloads are blocked. Finish the import, then refresh the Gradle project.

    Start the local server - open the Liberty dashboard, locate the project, and start it in development mode. You can also run the libertyDev Gradle task. Watch the console until the application is deployed and the HTTP port is listening.

  7. Build and run from the command line.

    You can also build and run the environment from the project root, without the IDE.

    Verify Java and Gradle - confirm that both the Java and Gradle version outputs report Java 21.

    Build the web application - run a clean build with tests to produce the deployable web application archive under build/libs.

    Run in development mode - start the local server in development mode, and stop it when you are finished. The first run might download project dependencies and the server runtime. In restricted networks, configure an approved proxy, an internal artifact repository, or a local Gradle installation.

  8. Test the environment.

    After the local server is running, verify the environment with the following local URLs:

    http://localhost:9080/ElasticSDK/api/health
                            http://localhost:9080/ElasticSDK/api/health/elasticsearch
                            http://localhost:9080/ElasticSDK/api/store/10101/attributes/<ATTRIBUTE_ID>

    When these endpoints respond as expected, your local customizations are running against your target search service, and the environment is ready for you to develop and test further customizations.

Results

You now have a local Query toolkit environment in which you can build and run your search customizations, replacing the earlier container-based local runtime. When the packaged toolkit bundle becomes available, you can use the bundle instead of performing these steps manually.