IntelliJ IDEA 运行时报错,求大神指教

Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: ognl.OgnlException: source is null for getProperty(null, "showapi_res_body")
    at com.imooc.weather.impl.WeatherUtilsImpl.w24h(WeatherUtilsImpl.java:82)
    at com.imooc.weather.Application.main(Application.java:23)
Caused by: java.lang.RuntimeException: ognl.OgnlException: source is null for getProperty(null, "showapi_res_body")
    at com.imooc.weather.impl.WeatherUtilsImpl.getValue(WeatherUtilsImpl.java:34)
    at com.imooc.weather.impl.WeatherUtilsImpl.w24h(WeatherUtilsImpl.java:63)
    ... 1 more
Caused by: ognl.OgnlException: source is null for getProperty(null, "showapi_res_body")
    at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2410)
    at ognl.ASTProperty.getValueBody(ASTProperty.java:114)
    at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
    at ognl.SimpleNode.getValue(SimpleNode.java:258)
    at ognl.ASTChain.getValueBody(ASTChain.java:141)
    at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
    at ognl.SimpleNode.getValue(SimpleNode.java:258)
    at ognl.Ognl.getValue(Ognl.java:467)
    at ognl.Ognl.getValue(Ognl.java:569)
    at ognl.Ognl.getValue(Ognl.java:539)
    at com.imooc.weather.impl.WeatherUtilsImpl.getValue(WeatherUtilsImpl.java:31)
    ... 2 more

Process finished with exit code 1

检查一下showapi_res_body对象有没有值。

请问运行的是哪段代码?

weatherUtils.w24h("a4f8a137892794f488d6c95009aaba350", city)

应该是这段报错了

w24h这个方法的两个参数是什么意思?

是不是这两个参数输入错误。

 

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!

速戳参与调研>>>https://t.csdnimg.cn/Kf0y