Temporal 101 with Java trouble executing first practice assignment

I get the following runtime warning and error executing the first practice assignment. I am trying to start the Worker
This is the command I execute.
mvn compile exec:java -D"exec.mainClass"=“helloworkflow.HelloWorkflowWorker”

What am I doing wrong?

thanks

[INFO]
[INFO] — exec-maven-plugin:3.3.0:java (default-cli) @ hello-workflow-practice —
[WARNING]
java.lang.NoClassDefFoundError: io/grpc/stub/ClientCalls$GrpcFuture
at io.grpc.stub.ClientCalls.futureUnaryCall (ClientCalls.java:226)
at io.grpc.stub.ClientCalls.blockingUnaryCall (ClientCalls.java:154)
at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.getSystemInfo (WorkflowServiceGrpc.java:4141)
at io.temporal.serviceclient.SystemInfoInterceptor.getServerCapabilitiesOrThrow (SystemInfoInterceptor.java:95)
at io.temporal.serviceclient.ChannelManager.lambda$getServerCapabilities$3 (ChannelManager.java:330)
at io.temporal.internal.retryer.GrpcRetryer.retryWithResult (GrpcRetryer.java:60)
at io.temporal.serviceclient.ChannelManager.connect (ChannelManager.java:297)
at io.temporal.serviceclient.WorkflowServiceStubsImpl.connect (WorkflowServiceStubsImpl.java:161)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at io.temporal.internal.WorkflowThreadMarker.lambda$protectFromWorkflowThread$1 (WorkflowThreadMarker.java:83)
at jdk.proxy3.$Proxy25.connect (Unknown Source)
at io.temporal.worker.WorkerFactory.start (WorkerFactory.java:213)
at helloworkflow.HelloWorkflowWorker.main (HelloWorkflowWorker.java:21)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain (ExecJavaMojo.java:385)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec (ExecJavaMojo.java:374)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:296)
at java.lang.Thread.run (Thread.java:842)
Caused by: java.lang.ClassNotFoundException: io.grpc.stub.ClientCalls$GrpcFuture
at org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader.loadClass (URLClassLoaderBuilder.java:181)
at java.lang.ClassLoader.loadClass (ClassLoader.java:520)
at io.grpc.stub.ClientCalls.futureUnaryCall (ClientCalls.java:226)
at io.grpc.stub.ClientCalls.blockingUnaryCall (ClientCalls.java:154)
at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.getSystemInfo (WorkflowServiceGrpc.java:4141)
at io.temporal.serviceclient.SystemInfoInterceptor.getServerCapabilitiesOrThrow (SystemInfoInterceptor.java:95)
at io.temporal.serviceclient.ChannelManager.lambda$getServerCapabilities$3 (ChannelManager.java:330)
at io.temporal.internal.retryer.GrpcRetryer.retryWithResult (GrpcRetryer.java:60)
at io.temporal.serviceclient.ChannelManager.connect (ChannelManager.java:297)
at io.temporal.serviceclient.WorkflowServiceStubsImpl.connect (WorkflowServiceStubsImpl.java:161)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at io.temporal.internal.WorkflowThreadMarker.lambda$protectFromWorkflowThread$1 (WorkflowThreadMarker.java:83)
at jdk.proxy3.$Proxy25.connect (Unknown Source)
at io.temporal.worker.WorkerFactory.start (WorkerFactory.java:213)
at helloworkflow.HelloWorkflowWorker.main (HelloWorkflowWorker.java:21)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain (ExecJavaMojo.java:385)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec (ExecJavaMojo.java:374)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:296)
at java.lang.Thread.run (Thread.java:842)

And then

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.629 s
[INFO] Finished at: 2024-06-16T17:57:47-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.3.0:java (default-cli) on project hello-workflow-practice: An exception occurred while executing the Java class. io/grpc/stub/ClientCalls$GrpcFuture: io.grpc.stub.ClientCalls$GrpcFuture → [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.3.0:java (default-cli) on project hello-workflow-practice: An exception occurred while executing the Java class. io/grpc/stub/ClientCalls$GrpcFuture
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occurred while executing the Java class. io/grpc/stub/ClientCalls$GrpcFuture

It looks like the gRPC library version is not present or not compatible. Could you post your pom.xml file?

Here it is. It is from the HelloWorkflow practice exercise from temporal 101.
thanks

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.temporal.learn</groupId>
    <artifactId>hello-workflow-practice</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <name>hello-workflow (practice)</name>
    <url>https://learn.temporal.io/</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>

        <dependency>
            <groupId>io.temporal</groupId>
            <artifactId>temporal-sdk</artifactId>
            <version>1.19.1</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>2.0.6</version>
        </dependency>

        <dependency>
            <groupId>io.temporal</groupId>
            <artifactId>temporal-testing</artifactId>
            <version>1.19.1</version>
            <scope>test</scope>
        </dependency>  

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.1.1</version>
            <scope>test</scope>
        </dependency>  
  
    </dependencies>

    <build>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
            <plugins>
                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Can you post your version of Maven and Java? Trying to reproduce on our end. Also, are you performing this in the GitPod environment or on your own personal machine?

I am no longer sure this is an issue with the tutorial. I am going through our company mirror and it’s possible that our mirror doesn’t know how to get to this package.
But here are the details you asked for.

java -version
java version “17.0.9” 2023-10-17 LTS
Java™ SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot™ 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\ss2187\Code\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin..
Java version: 17.0.9, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17
Default locale: en_US, platform encoding: Cp1252
OS name: “windows 11”, version: “10.0”, arch: “amd64”, family: “windows”

Ok. Thanks for the update. If you confirm the issue please let us know :slight_smile:

will do. Thanks for your help.

Hi Mason
Could you help me determine what package and version this failing on?
It’s a grpc library.

The GRPC library is brought in via the Temporal SDK. According to the gradle build sdk-java/build.gradle at master · temporalio/sdk-java · GitHub it’s this package io.grpc.protobuf.services.HealthStatusManager

Mason
thanks a lot.