Bitcoin Forum
December 06, 2016, 04:09:35 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Server returned HTTP response code: 500 for URL: http://127.0.0.1:8332  (Read 2240 times)
elk-tamer
Jr. Member
*
Offline Offline

Activity: 56


View Profile
July 11, 2011, 03:17:34 AM
 #1

I'm trying to connect to bitcoind from java but I'm getting a 500 error, is there example code around for how to set it up?

I get a json error string when I connect from a browser, so it looks like bitcoind is running properly.
1481040575
Hero Member
*
Offline Offline

Posts: 1481040575

View Profile Personal Message (Offline)

Ignore
1481040575
Reply with quote  #2

1481040575
Report to moderator
1481040575
Hero Member
*
Offline Offline

Posts: 1481040575

View Profile Personal Message (Offline)

Ignore
1481040575
Reply with quote  #2

1481040575
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
fabianhjr
Sr. Member
****
Offline Offline

Activity: 322


Do The Evolution


View Profile
July 11, 2011, 03:22:10 AM
 #2

Did you set it up as a server?
(Under ~/.bitcoin NIX & AppData/bitcoin for Windows)

elk-tamer
Jr. Member
*
Offline Offline

Activity: 56


View Profile
July 11, 2011, 03:49:54 AM
 #3

Did you set it up as a server?
(Under ~/.bitcoin NIX & AppData/bitcoin for Windows)
Not properly. I set the name and password but missed the "server=1" flag, thanks.
elk-tamer
Jr. Member
*
Offline Offline

Activity: 56


View Profile
July 12, 2011, 12:55:30 AM
 #4

It's still not working. I'm pretty sure it's the json I'm sending, but looking at the examples for other languages isn't enough for me to go on.

Code:
              URL url = new URL(BITCOIN_DAEMON);
URLConnection conn = url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "text/plain");

OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
conn.getOutputStream());
JSONObject jsonObject = new JSONObject();
jsonObject.put("getinfo", "");
jsonObject.writeJSONString(outputStreamWriter);
outputStreamWriter.flush();
outputStreamWriter.close();

DataInputStream input = new DataInputStream(conn.getInputStream());
I get a 400 error on the last line. Does anyone know what I'm doing wrong?
Edit: The JSONObject was wrong, this one works:
Code:
JSONObject jsonObject = new JSONObject();

jsonObject.put("method", "getinfo");
jsonObject.put("params", null);
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!