Sitelet https://github.com/googleapis/google-cloud-java/issues/1857
Skip to content

Problem with google-cloud-logging. NoSuchMethodError #1857

Description

@joelostlund

Hello,

I have the following issue with google-cloud-logging:

I am trying to run the following code-snippet:

package com.spotify.katamari

import java.util.Collections

import com.google.cloud.MonitoredResource
import com.google.cloud.logging.Payload.StringPayload
import com.google.cloud.logging.{LogEntry, LoggingOptions}

object Logging {
  def sendValueToStackdriver(userCount: Long, date: String, pipelineId: String): Unit = {
    val logging = LoggingOptions.newBuilder().setProjectId("entity-infrastructure").build().getService
    val firstEntry: LogEntry = LogEntry.newBuilder(StringPayload.of(s"UserCounter from $pipelineId"))
      .setLogName(s"UserCounter")
      .setResource(MonitoredResource.newBuilder("global")
        .addLabel("value", userCount.toString)
        .addLabel("date", date)
        .addLabel("pipeline-id", pipelineId)
        .build())
      .build()
    logging.write(Collections.singleton(firstEntry))
  }
}

After running I get the following stacktrace:

[error] Exception in thread "main" java.lang.NoSuchMethodError: io.grpc.protobuf.ProtoUtils.marshaller(Lcom/google/protobuf/Message;)Lio/grpc/MethodDescriptor$Marshaller;
[error] 	at com.google.logging.v2.ConfigServiceV2Grpc.<clinit>(ConfigServiceV2Grpc.java:41)
[error] 	at com.google.cloud.logging.spi.v2.ConfigSettings$Builder.<init>(ConfigSettings.java:306)
[error] 	at com.google.cloud.logging.spi.v2.ConfigSettings$Builder.createDefault(ConfigSettings.java:328)
[error] 	at com.google.cloud.logging.spi.v2.ConfigSettings$Builder.access$000(ConfigSettings.java:259)
[error] 	at com.google.cloud.logging.spi.v2.ConfigSettings.defaultBuilder(ConfigSettings.java:186)
[error] 	at com.google.cloud.logging.spi.v2.GrpcLoggingRpc.<init>(GrpcLoggingRpc.java:102)
[error] 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:64)
[error] 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingRpcFactory.create(LoggingOptions.java:58)
[error] 	at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:460)
[error] 	at com.google.cloud.logging.LoggingOptions.getLoggingRpcV2(LoggingOptions.java:133)
[error] 	at com.google.cloud.logging.LoggingImpl.<init>(LoggingImpl.java:96)
[error] 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:46)
[error] 	at com.google.cloud.logging.LoggingOptions$DefaultLoggingFactory.create(LoggingOptions.java:41)
[error] 	at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:451)
[error] 	at com.spotify.katamari.Logging$.sendValueToStackdriver(Logging.scala:11)
[error] 	at com.spotify.katamari.entity.EntityAPI$.write(EntityAPI.scala:72)
[error] 	at ExampleProducer$.main(ExampleProducer.scala:19)
[error] 	at ExampleProducer.main(ExampleProducer.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
	at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last e2e/compile:runMain for the full output.
[error] (e2e/compile:runMain) Nonzero exit code returned from runner: 1
[error] Total time: 314 s, completed Apr 4, 2017 4:17:40 PM

I have made sure to isolate all the dependencies for this logger by putting the snippet code into a separate repository, it still doesn't work. Seems to be some dependency issues with the code. I am using the following library:

"com.google.cloud" % "google-cloud-logging" % "0.11.0-beta" and have also tried to downgrade it, still facing the same issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: loggingIssues related to the Cloud Logging API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions