这应该怎么解决

来源:5-2 实现24小时天气预报查询功能

九年义务小白

2023-06-10 21:16

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:22)

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


写回答 关注

2回答

  • 慕姐8309597
    2024-11-07 14:01:06

    在云市场那边有多个易源天气预报的接口,找到URL跟老师一样的那个”https://saweather.market.alicloudapi.com“,重新购买就可以了

  • 慕运维2152352
    2023-08-02 11:04:56

    你的调试地址输入错误了,新建路径下的url

    .url("https://weather01.market.alicloudapi.com/hour24?area=" + area)

    记得地址填写在?area=的前面,还有从网页直接复制过来的地址要去掉http(s)中的小括号,不然就是非法参数输入。

    weixin...

    改成新的地址了依旧报错

    2023-09-17 20:04:17

    共 1 条回复 >

Java入门第二季 升级版

课程升级!以终为始告别枯燥,在开发和重构中体会Java面向对象编程的奥妙

530715 学习 · 6091 问题

查看课程

相似问题