Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playframework Failed to start with weird kanela.agent.libs.com.typesafe.config.ConfigException #155

Open
zhongdj opened this issue Dec 8, 2023 · 0 comments

Comments

@zhongdj
Copy link

zhongdj commented Dec 8, 2023

It was very weird that the class kanela loader can load application.conf under target folder, but cannot load file under target's child folder, as is shown in the screenshot: target/application.conf loaded fine, but target/local/application-local.conf did not.

OS: windows11
plugins.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.18")
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.13.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
// For Play Framework 2.8.8
addSbtPlugin("io.kamon" % "sbt-kanela-runner-play-2.8" % "2.0.12")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.14"

build.sbt

scalaVersion := "2.13.10"

libraryDependencies ++= Seq(
  // other libs
  "co.elastic.apm" % "apm-opentracing" % "1.45.0",
  "io.opentracing" % "opentracing-api" % "0.33.0",
  "io.kamon" %% "kamon-bundle" % "2.7.0",
  "io.kamon" %% "kamon-akka" % "2.7.0",
  "io.kamon" %% "kamon-play" % "2.7.0",
  "io.kamon" %% "kamon-apm-reporter" % "2.7.0",
  // other libs

exceptions:

2023-12-08 18:03:20 [Attach Listener] kanela.agent.util.log.Logger.error()
ERROR: It has not been found any configuration for Kanela Agent.: kanela.agent.libs.com.typesafe.config.ConfigException$IO: ./local/application-local.conf: java.io.IOException: resource not found on classpath: ./local/application-local.conf
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parseValue(Parseable.java:190)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parse(Parseable.java:301)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1007)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:935)
        at kanela.agent.libs.com.typesafe.config.DefaultConfigLoadingStrategy.parseApplicationConfig(DefaultConfigLoadingStrategy.java:49)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:478)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.load(ConfigFactory.java:308)
        at kanela.agent.util.conf.KanelaConfiguration.loadDefaultConfig(KanelaConfiguration.java:305)
        at kanela.agent.util.conf.KanelaConfiguration.lambda$loadConfig$84c4dc62$1(KanelaConfiguration.java:262)
        at kanela.agent.libs.io.vavr.control.Try.of(Try.java:75)
        at kanela.agent.util.conf.KanelaConfiguration.loadConfig(KanelaConfiguration.java:262)
        at kanela.agent.util.conf.KanelaConfiguration.instance(KanelaConfiguration.java:67)
        at kanela.agent.util.log.Logger.<clinit>(Logger.java:39)
        at kanela.agent.util.conf.KanelaConfiguration.lambda$loadConfig$7(KanelaConfiguration.java:263)
        at kanela.agent.libs.io.vavr.control.Try.onFailure(Try.java:659)
        at kanela.agent.util.conf.KanelaConfiguration.loadConfig(KanelaConfiguration.java:263)
        at kanela.agent.util.conf.KanelaConfiguration.from(KanelaConfiguration.java:57)
        at kanela.agent.Kanela.lambda$null$0(Kanela.java:73)
        at kanela.agent.util.classloader.InstrumentationClassPath.use(InstrumentationClassPath.java:84)
        at kanela.agent.Kanela.lambda$start$1(Kanela.java:68)
        at kanela.agent.util.Execution.timed(Execution.java:32)
        at kanela.agent.util.Execution.runWithTimeSpent(Execution.java:41)
        at kanela.agent.Kanela.start(Kanela.java:67)
        at kanela.agent.Kanela.agentmain(Kanela.java:54)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:535)
Caused by: java.io.IOException: resource not found on classpath: ./local/application-local.conf
        at kanela.agent.libs.com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:726)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:701)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at kanela.agent.libs.com.typesafe.config.impl.Parseable.parse(Parseable.java:301)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1007)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:935)
        at kanela.agent.libs.com.typesafe.config.DefaultConfigLoadingStrategy.parseApplicationConfig(DefaultConfigLoadingStrategy.java:49)
        at kanela.agent.libs.com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:478)
        ...
Exception in thread "Attach Listener" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:535)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class kanela.agent.util.log.Logger
        at kanela.agent.util.Execution.runWithTimeSpent(Execution.java:43)
        at kanela.agent.Kanela.start(Kanela.java:67)
        at kanela.agent.Kanela.agentmain(Kanela.java:54)
        ... 6 more
Agent failed to start!
联想截图_20231208175107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant