Code Monkey home page Code Monkey logo

Comments (14)

J-DK avatar J-DK commented on August 17, 2024 2
i.g.stub.ClientCalls$ThreadlessExecutor : Runnable threw exception
java.lang.NoClassDefFoundError: io/perfmark/PerfMark
at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:106) ~[grpc-core-1.43.0.jar:1.43.0]

I faced the above issue and it is fixed by explicitly adding the below dependency in the build file
implementation 'io.perfmark:perfmark-api:0.25.0'

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024 1

@J-DK It looks like the correct thing to do here. Temporal JavaSDK doesn't use or need perfmark itself, so we are not going to add it as a transitive dependency.

from sdk-java.

kkcmadhu avatar kkcmadhu commented on August 17, 2024

Ok, my understanding was ideally this should not clash, cause library conflicts etc https://temporalio.slack.com/archives/CTT84KXK9/p1591634665191200

could this be the jhipster or @metricautoconfig related?
i dont see these in my spring boot apps, but i don't use the metric or jhipster related annotations as well..

my set of annotation presently are @SpringBootApplication,@EnableTransactionManagement,@EnableJpaRepositories,@EntityScan,@EnableCaching

from sdk-java.

ponson-thankavel-finastra avatar ponson-thankavel-finastra commented on August 17, 2024

I am facing exactly the same problem. @fcruzel, were you able to resolve this problem?

from sdk-java.

fcruzel avatar fcruzel commented on August 17, 2024

@ponson-thankavel-finastra I stopped working on this and couldn't investigate further down

from sdk-java.

J-DK avatar J-DK commented on August 17, 2024

Is there any update on this?

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024

@J-DK Do you experience this issue?
This issue is stale, doesn't have a reproduction, and looks like a misconfigured classpath and logger.

Temporal obviously has nothing to do with ClassNotFoundException, especially from classes Temporal doesn't need and use like java.lang.ClassNotFoundException: io.perfmark.impl.SecretPerfMarkImpl$PerfMarkImpl
Users need to make sure the right classes are available in the classpath.

2020-07-27 09:43:17.509 [main] DEBUG
        i.g.netty.shaded.io.grpc.netty.Utils - Epoll is not available, using Nio. 
java.lang.ExceptionInInitializerError: null
	at io.grpc.netty.shaded.io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.netty.shaded.io.grpc.netty.Utils.isEpollAvailable(Utils.java:284)
	at io.grpc.netty.shaded.io.grpc.netty.Utils.<clinit>(Utils.java:107)
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<clinit>(NettyChannelBuilder.java:74)
	at io.temporal.internal.grpc.WorkflowServiceStubsImpl.<init>(WorkflowServiceStubsImpl.java:108)
	at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:34)
	at my.App.main(App.java:84)
Caused by: java.lang.IllegalStateException: Only supported on Linux
	at io.grpc.netty.shaded.io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:225)
	at io.grpc.netty.shaded.io.netty.channel.epoll.Native.<clinit>(Native.java:58)
	... 9 common frames omitted

This is not even a problem, it's gRPC logging an internal exception and diagnostic information with DEBUG level. Just configure the logger if you don't want to see it.

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024

I'm going to close this issue, it's not actionable and it looks like not a temporal sdk issue, but user side configuration issue.
@J-DK if you experience the issue, feel free to submit a new one and we can investigate there.

from sdk-java.

CharlieReitzel avatar CharlieReitzel commented on August 17, 2024

My application stops at factory.start() because the java.lang.ClassNotFoundException: io.grpc.override.ContextStorageOverride exception is thrown. I'll try to pull in the jar as a direct dependency, but this appears to be a transitive dependency of Temporal that is missing.

The comment in WorkerFactory.java, lines 216-218, looks relevant:

    // Workers check and require that Temporal Server is available during start to fail-fast in case
    // of configuration issues.
    workflowClient.getWorkflowServiceStubs().connect(null);

I am connecting to a remote Temporal instance attempting use a mix of 1 local workflow and some remote activities.

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024

@CharlieReitzel Temporal SDK doesn't use ContextStorageOverride or any classes from "io.grpc.override". So, Temporal will not be providing them.
The only place across all our transitive dependencies that uses this class is this one method in io.grpc.Context from io.grpc:grpc-context and it doesn't throw if the class is not available:

    private static Storage createStorage(
        AtomicReference<? super ClassNotFoundException> deferredStorageFailure) {
      try {
        Class<?> clazz = Class.forName("io.grpc.override.ContextStorageOverride");
        // The override's constructor is prohibited from triggering any code that can loop back to
        // Context
        return clazz.asSubclass(Storage.class).getConstructor().newInstance();
      } catch (ClassNotFoundException e) {
        deferredStorageFailure.set(e);
        return new ThreadLocalContextStorage();
      } catch (Exception e) {
        throw new RuntimeException("Storage override failed to initialize", e);
      }
    }

it just logs it later:

      storage = createStorage(deferredStorageFailure);
      Throwable failure = deferredStorageFailure.get();
      // Logging must happen after storage has been set, as loggers may use Context.
      if (failure != null) {
        log.log(Level.FINE, "Storage override doesn't exist. Using default", failure);
      }

Please post the full exception you are getting.

from sdk-java.

Nishant-Pathak avatar Nishant-Pathak commented on August 17, 2024

Hitting the same issue, not sure if this is Closed in the right way.

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024

It's Closed as unrelated to Temporal and something that can't and will not be addressed in Java SDK as I provided more context above.
JavaSDK doesn't use io.grpc.override.ContextStorageOverride or any other classes from io.grpc.override.*. If your application needs this class for any reason, it's the responsibility of your application to make sure this class is present in a classpath.

I also don't see how this exception

java.lang.ClassNotFoundException: io.grpc.override.ContextStorageOverride
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.Context$LazyStorage.createStorage(Context.java:142)
	at io.grpc.Context$LazyStorage.<clinit>(Context.java:131)
	at io.grpc.Context.storage(Context.java:119)
	at io.grpc.Context.current(Context.java:185)
	at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:118)
	at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:890)
	at io.grpc.internal.ServiceConfigInterceptor.interceptCall(ServiceConfigInterceptor.java:137)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:855)
	at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)

is possible on any modern grpc version, because ClassNotFoundException from the unavailability of io.grpc.override.ContextStorageOverride is getting gracefully handled in grpc-java: https://github.com/grpc/grpc-java/blob/master/context/src/main/java/io/grpc/Context.java#L134

I may be able to help if you submit a reproduction. Otherwise, it's not a java-sdk issue and it doesn't reproduce with the dependencies java-sdk currently uses.

from sdk-java.

Nishant-Pathak avatar Nishant-Pathak commented on August 17, 2024

Sure, here are my setup details

Java version

➜  test git:(prod) java --version
openjdk 17.0.5 2022-10-18
OpenJDK Runtime Environment (build 17.0.5+8-Ubuntu-2ubuntu122.04)
OpenJDK 64-Bit Server VM (build 17.0.5+8-Ubuntu-2ubuntu122.04, mixed mode, sharing)

Spring boot Running Spring Boot 2.7.3

Temporal 'io.temporal:temporal-sdk:1.17.0'

Do let me know if you need more info to reproduce. Else I am happy to jump over call and show the issue.

from sdk-java.

Spikhalskiy avatar Spikhalskiy commented on August 17, 2024

This setup (Java 17, Spring Boot 2.7.3) works just fine and it's one of the configurations we routinely test as a part of our CI. This is not enough information for me to reproduce. Because the problem is with your application, your specific dependencies graph or classpath, not with JavaSDK.
If you need help with your application, I can take a peek. But I need a minimal reproduction: source code that I can run that fails with the same error that you observe. Only then I can tell you what's up with that reproduction and probably your application.

You can also try to post a runtime dependency tree of your project and the specific exception you observe. That may show something.

from sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.