I am trying to get the linked example code to work, but am experiencing a SocketException (below). I am using java 7.
https://github.com/smartystreets/LiveAddressSamples/blob/master/java/LiveAddressExample.java
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)
I think this is due to this line:
DataOutputStream outgoing = new DataOutputStream(urlConn.getOutputStream());
I tried adjusting the firewall as suggested here, but it did not work: http://www.javaprogrammingforums.com/java-networking/17319-java-net-socketexception-connection-reset.html
How do I dig deeper to determine the problem, or what do you think could be wrong?
I just tried a fresh attempt, copying straight from the github example and inserting my auth-id
and auth-token
. Here's what my terminal session looked like:
$ 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
So at this point I'm having trouble replicating the error. A coworker of mine tried the same thing with java 1.6 and that also worked. Are there any other details you can provide about your environment or any details related to edits you've done to the code?