how to resolve NoSuchMethodError on typesafe config?

后端 未结 2 1539
天涯浪人
天涯浪人 2021-01-27 17:52

I\'m getting this error when trying to run my project.

Exception in thread \"main\" java.lang.NoSuchMethodError: com.typesafe.config.Config.getDuration

相关标签:
2条回答
  • 2021-01-27 18:19

    It sounds like a classpath problem. You may be using a library that calls (uses) Typesafe Config, but the version of Typesafe Config in your path is less than 1.3.0. The method that is not found was introduced in Typesafe Config 1.3.0. To see your runtime classpath, make sure these statements are the first ones that are executed (i.e. before your app crashes):

    val cp = System.getProperty("java.class.path")
    val sep = System.getProperty("path.separator")
    cp.split(sep).foreach(println)
    

    Once you see that you do not have Typesafe Config 1.3.0, add it as an explicit dependency.

    0 讨论(0)
  • 2021-01-27 18:38

    Adding TypeSafe 1.3.1 as dependency might help, add it as part of your Seq() of dependencies:

    "com.typesafe" % "config" % "1.3.1"
    
    0 讨论(0)
提交回复
热议问题