简体   繁体   中英

RSS Feed Parser in Google App Engine

I am trying to include rss feed parsing in my app engine application, but I have run into a roadblock. I understand that not all API's are supported on appengine:

Exception in thread "Thread-4" com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found.
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:113)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:38)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296)
at java.net.URL.openStream(URL.java:1037)
at com.aggieupdates.bo.RSSFeedParser.read(RSSFeedParser.java:197)

Line 197 is:

return url.openStream();

url is in java.net.URL package

Is there an easy fix for this issue?

Your sample code look like you rung this code in Java Main class , not in Appengine servlet enviroment . You need too run with in Appengine enviroment

Apparently, I needed to use the ThreadFactory that is a part of the appengine API when creating threads. Instead of creating a Thread manually, I used the factory, and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM