首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >com.omdbapi.OmdbConnectionErrorException错误

com.omdbapi.OmdbConnectionErrorException错误
EN

Stack Overflow用户
提问于 2017-03-13 19:46:13
回答 1查看 148关注 0票数 0

我用java写了一个代码,我用它来访问IMDB网站上的电影细节。为此,我在java中使用OMDB API,但我收到连接错误,为什么我不理解,因为在输出的信息中,它显示了有关电影的详细信息。

代码:

代码语言:javascript
复制
Omdb o = new Omdb();
    Movie movie= o.searchOneMovie("star wars");
    System.out.print(movie);

错误:

代码语言:javascript
复制
INFO: executing GET http://www.omdbapi.com/?t=star+wars HTTP/1.1
Mar 13, 2017 5:09:18 PM com.omdbapi.Omdb resultToJson
INFO: received {"Title":"Star Wars: Episode IV - A New   Hope","Year":"1977","Rated":"PG","Released":"25 May 1977","Runtime":"121 min","Genre":"Action, Adventure, Fantasy","Director":"George Lucas","Writer":"George Lucas","Actors":"Mark Hamill, Harrison Ford, Carrie Fisher, Peter Cushing","Plot":"Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a wookiee and two droids to save the galaxy from the Empire's world-destroying battle-station, while also attempting to rescue Princess Leia from the evil Darth Vader.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 50 wins & 28 nominations.","Poster":"https://images-na.ssl- images-amazon.com/images/M/MV5BYzQ2OTk4N2QtOGQwNy00MmI3LWEwNmEtOTk0OTY3NDk2MGJkL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyNjc1NTYyMjg@._V1_SX300.jpg","Metascore":"92","imdbRating":"8.7","imdbVotes":"963,318","imdbID":"tt0076759","Type":"movie","Response":"True"}
 Exception in thread "main" com.omdbapi.OmdbConnectionErrorException:        Unrecognized field "Metascore" (class com.omdbapi.Movie), not marked as ignorable (15 known properties: , "Plot", "Response", "Genre", "Rated",  "imdbVotes", "Director", "Poster", "Writer", "Title", "Runtime", "Year", "imdbID", "Released", "Actors", "imdbRating"])
at [Source: java.io.StringReader@dd3b207; line: 1, column: 40] (through  reference chain: com.omdbapi.Movie["Metascore"])
at com.omdbapi.Omdb.getOneMovie(Omdb.java:65)
at com.omdbapi.Omdb.searchOneMovie(Omdb.java:54)
at test.searchMovie.main(searchMovie.java:15)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-13 19:54:04

您期望的是Metascore字段,但它不在那里-要么将其删除,要么将其标记为ingorable。来自IMDB的响应很好-没有错误,错误在您的代码中

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42762863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档