gpt4 book ai didi

java - 使用 JSoup 和 appengine 1.7 时的 NPE

转载 作者:行者123 更新时间:2023-12-01 14:34:53 24 4
gpt4 key购买 nike

我尝试将 Jsoup (1.7.2) 与 appengine (1.7.7) 一起使用,但在尝试连接时遇到错误:

try {
doc = Jsoup.connect("http://www.google.com").get();
} catch (Exception e) {
e.printStackTrace();
}

我得到以下堆栈跟踪:

java.lang.NullPointerException
at java.util.Collections.addAll(Collections.java:3836)
at sun.security.ssl.AbstractTrustManagerWrapper.<init>(SSLContextImpl.java:778)
at sun.security.ssl.SSLContextImpl.chooseTrustManager(SSLContextImpl.java:133)
at sun.security.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:89)
at javax.net.ssl.SSLContext.init(SSLContext.java:283)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createNonvalidatingScheme(LocalURLFetchService.java:254)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createHttpClient(LocalURLFetchService.java:276)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.getNonValidatingClient(LocalURLFetchService.java:528)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.access$100(LocalURLFetchService.java:83)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$8.run(LocalURLFetchService.java:439)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService$8.run(LocalURLFetchService.java:424)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.doPrivilegedExecute(LocalURLFetchService.java:424)
at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.fetch(LocalURLFetchService.java:392)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:521)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:475)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:452)
at java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:493)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:490)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

最佳答案

好吧,问题是 JDK 7:

java version "1.7.0_04-ea"
Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b13)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b16, mixed mode)

切换回 java 6,效果很好

关于java - 使用 JSoup 和 appengine 1.7 时的 NPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16577072/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com