首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SocketException on getOutputStream()

SocketException on getOutputStream()
EN

Stack Overflow用户
提问于 2014-08-19 17:28:22
回答 1查看 579关注 0票数 0

我正在尝试使链接的示例代码正常工作,但我正在体验一个SocketException (如下所示)。我正在使用java 7。

https://github.com/smartystreets/LiveAddressSamples/blob/master/java/LiveAddressExample.java

代码语言:javascript
复制
IO Exception Error: java.net.SocketException: Connection reset
Exception in thread "main" java.lang.NullPointerException
    at com.icat.coastal.processor.SmartyStreetAddress.main(SmartyStreetAddress.java:71)

我想这是因为这句话:

代码语言:javascript
复制
DataOutputStream outgoing = new DataOutputStream(urlConn.getOutputStream());

我尝试按照这里的建议调整防火墙,但是它没有工作:http://www.javaprogrammingforums.com/java-networking/17319-java-net-socketexception-connection-reset.html

我如何更深入地研究以确定问题,或者你认为什么可能是错误的?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-09 18:58:39

我刚刚尝试了一次新的尝试,直接从github示例复制并插入我的auth-idauth-token。下面是我的终端会话的样子:

代码语言:javascript
复制
$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

$ ll
drwxr-xr-x   6 mike  staff   204B Feb  9 11:49 ./
drwxr-xr-x  18 mike  staff   612B Dec 22 23:01 ../
-rw-r--r--   1 mike  staff   3.2K Feb  9 11:49 LiveAddressExample.java
-rw-r--r--   1 mike  staff   349B Dec 22 23:01 README.md
-rw-r-----@  1 mike  staff    23K Feb  9 11:45 json-simple-1.1.1.jar

$ javac -cp json-simple-1.1.1.jar LiveAddressExample.java 
Note: LiveAddressExample.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: LiveAddressExample.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

$ java -cp .:json-simple-1.1.1.jar LiveAddressExample
3785 Las Vegas Blvd S
Las Vegas NV 89109-4333

1600 Amphitheatre Pkwy
Mountain View CA 94043-1351

因此,在这一点上,我在复制错误时遇到了困难。我的一位同事在java1.6中尝试了同样的方法,这也起了作用。您是否可以提供关于您的环境的其他详细信息,或者与您对代码所做的编辑有关的任何细节?

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

https://stackoverflow.com/questions/25389474

复制
相关文章

相似问题

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