how to resolve NoSuchMethodError on typesafe config?

后端 未结 2 1538
天涯浪人
天涯浪人 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.

提交回复
热议问题