Experts,
I am new to temporal and exploring its basic,I tried running the basic java but getting the following exception "java.lang.NoClassDefFoundError: io/grpc/BindableService ".
Temporal Version: 28 and is up and running
Following are the jars used
commons-configuration2-2.7.jar
grpc-stub-1.31.0.jar
logback-classic-1.2.3.jar
protobuf-java-2.0.1.jar
slf4j-api-1.7.30.jar
temporal-sdk-0.28.0.jar
Sample Java:
Referred https://docs.temporal.io/docs/java-quick-start/ GettingStarted progm.
Exception: When i try to run this from my Eclipse it gives following exception
Exception in thread āmainā java.lang.NoClassDefFoundError: io/grpc/BindableService
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:34)
at com.sci.sample.helloWorld.GettingStarted.main(GettingStarted.java:37)
Caused by: java.lang.ClassNotFoundException: io.grpc.BindableService
//private static Logger logger = Workflow.getLogger(GettingStarted.class);
@WorkflowInterface
public interface HelloWorld {
@WorkflowMethod
void sayHello(String name);
}
public static class HelloWorldImpl implements HelloWorld {
@Override
public void sayHello(String name) {
System.out.println("Hello " + name + "!");
}
}
public static void main(String[] args) {
try {
System.out.println("--STARTING--");
// gRPC stubs wrapper that talks to the local docker instance of temporal service.
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
// client that can be used to start and signal workflows
WorkflowClient client = WorkflowClient.newInstance(service);
// worker factory that can be used to create workers for specific task queues
WorkerFactory factory = WorkerFactory.newInstance(client);
Worker worker = factory.newWorker("HelloWorldTaskQueue");
worker.registerWorkflowImplementationTypes(HelloWorldImpl.class);
factory.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This is happening again with SDK 1.8.1, it specifies range and pulls 4.0-rc of protobuf please. When I explicitly set dependency to 3.19.4 my project compiles and tests are passing.
gRPC version range has been removed in 1.8.1 (see commit here which is included in 1.8.1).
Iām unable to reproduce 1.8.1 depends pulling proto 4.0.0-rc1 (nor rc2), can you help me reproduce? Share your āgradle dependenciesā output if possible.
SDK defines a range here but has set 3.19.4 as preferred, which should be the one being pulled.
mvn dependency:tree output
[INFO] Scanning for projectsā¦
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.xpansiv.workflows:wf-common:jar:2.0.0-SNAPSHOT
[WARNING] āversionā contains an expression but should be a constant. @ com.xpansiv.workflows:wf-common:2.0.${release}, /Users/kignatyev/dev/reprocases/temporal/pom.xml, line 9, column 14
[WARNING] ābuild.plugins.plugin.versionā for org.apache.maven.plugins:maven-source-plugin is missing. @ com.xpansiv.workflows:wf-common:2.0.${release}, /Users/kignatyev/dev/reprocases/temporal/pom.xml, line 101, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
Downloading from xpansiv-artifactory: JFrog
Progress (1): 1.0 kB
Tested with 1.9.0-SNAPSHOT and the added restriction to the version range no longer pulls from 4.x (it will still for Maven pull the latest 3.x just fyi).
You can set it also manually to 3.19.4, as thatās the preferred version set if you use Gradle.