[google-appengine] Fetch URL problem
Hi, I've a problem with fetch URL using appengine.. this is my code: try { URL url = new URL("http://www.example.com/atom.xml";); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { // ... } reader.close(); } catch (MalformedURLException e) { // ... } catch (Exception e) { // ... } the error is: java.lang.NullPointerException at java.util.Collections.addAll(Unknown Source) at sun.security.ssl.AbstractTrustManagerWrapper.(Unknown Source) at sun.security.ssl.SSLContextImpl.chooseTrustManager(Unknown Source) at sun.security.ssl.SSLContextImpl.engineInit(Unknown Source) at javax.net.ssl.SSLContext.init(Unknown Source) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createNonvalidatingScheme(LocalURLFetchService.java:241) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createHttpClient(LocalURLFetchService.java:263) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.getNonValidatingClient(LocalURLFetchService.java:508) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.access$100(LocalURLFetchService.java:82) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:422) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:409) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.doPrivilegedExecute(LocalURLFetchService.java:409) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:377) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:527) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:481) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:458) at java.util.concurrent.Executors$PrivilegedCallable$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.util.concurrent.Executors$PrivilegedCallable.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) the same in a simple java app work fine.. I had test in local can you help me? -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/ZzVJrZyzRj0J. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Fetch URL problem nullpointerexception
Hi, I've a problem with fetch URL using appengine.. the problem is on url.openStream() (nullpointerexception) but url is not null this is my code: try { URL url = new URL(site); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { } reader.close(); } catch (MalformedURLException e) { } catch (Exception e) { } the error is: java.lang.NullPointerException at java.util.Collections.addAll(Unknown Source) at sun.security.ssl.AbstractTrustManagerWrapper.(Unknown Source) at sun.security.ssl.SSLContextImpl.chooseTrustManager(Unknown Source) at sun.security.ssl.SSLContextImpl.engineInit(Unknown Source) at javax.net.ssl.SSLContext.init(Unknown Source) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createNonvalidatingScheme(LocalURLFetchService.java:241) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createHttpClient(LocalURLFetchService.java:263) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.getNonValidatingClient(LocalURLFetchService.java:508) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.access$100(LocalURLFetchService.java:82) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:422) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:409) at java.security.AccessController.doPrivileged(Native Method) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.doPrivilegedExecute(LocalURLFetchService.java:409) at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:377) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:527) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:481) at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:458) at java.util.concurrent.Executors$PrivilegedCallable$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.util.concurrent.Executors$PrivilegedCallable.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) the same in a simple java app work fine.. I had test in local can you help me? -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/Zxe8m_zBy0wJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Fetch URL problem nullpointerexception
WOW thank you very much ;) It's work, this is a very strange bug.. Mario Il giorno venerdì 12 ottobre 2012 18:29:01 UTC+2, Vinny P ha scritto: > > Are you using Java 7? If so, you need to downgrade to Java 6. This is a > known bug (you can see a similar stacktrace from Oracle: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7145592 the only > workaround listed is to use Java 6). > > If I recall correctly, App Engine only supports Java 5 & 6, not 7. > > If you're not using Java 7, you'll have to post more of your code. Or > deploy your app to App Engine production and see if the problem fixes > itself; you may have an issue with your local dev environment. > > -Vinny P > > On Friday, October 12, 2012 10:37:10 AM UTC-5, Mario Buonomo wrote: >> >> Hi, I've a problem with fetch URL using appengine.. >> >> the problem is on url.openStream() (nullpointerexception) but url is not >> null >> >> this is my code: >> >> try { >> URL url = new URL(site); >> BufferedReader reader = new BufferedReader(new >> InputStreamReader(url.openStream())); >> String line; >> while ((line = reader.readLine()) != null) { >> } >> reader.close(); >> } catch (MalformedURLException e) { >> } catch (Exception e) { >> } >> >> the error is: >> java.lang.NullPointerException >> at java.util.Collections.addAll(Unknown Source) >> at sun.security.ssl.AbstractTrustManagerWrapper.(Unknown Source) >> at sun.security.ssl.SSLContextImpl.chooseTrustManager(Unknown Source) >> at sun.security.ssl.SSLContextImpl.engineInit(Unknown Source) >> at javax.net.ssl.SSLContext.init(Unknown Source) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createNonvalidatingScheme(LocalURLFetchService.java:241) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createHttpClient(LocalURLFetchService.java:263) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.getNonValidatingClient(LocalURLFetchService.java:508) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.access$100(LocalURLFetchService.java:82) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:422) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService$7.run(LocalURLFetchService.java:409) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.doPrivilegedExecute(LocalURLFetchService.java:409) >> at >> com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:377) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) >> at java.lang.reflect.Method.invoke(Unknown Source) >> at >> com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:527) >> at >> com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:481) >> at >> com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:458) >> at java.util.concurrent.Executors$PrivilegedCallable$1.run(Unknown Source) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.util.concurrent.Executors$PrivilegedCallable.call(Unknown Source) >> at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) >> at java.util.concurrent.FutureTask.run(Unknown Source) >> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) >> at java.lang.Thread.run(Unknown Source) >> >> the same in a simple java app work fine.. >> >> I had test in local >> can you help me? >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/OHdPNmb11BIJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.