So I have a multichain instance running on a centos docker image. My main machine is Windows 10 and I can connect to my multichain node and run commands using the multichain-cli application.
Now I am writing a Java application that uses the MultiChainJavaAPI and I am getting an exception thrown when I try to connect and run any commands. The exception I get is;
MultichainException [
object=code :401,
reason=message : Authorization Required,
message=null,
cause=null
]
I was originally working on an Ubuntu VM, and did not have a problem, but I wasn't running the multichain server on Docker. Now I am running it on windows I am facing this issue.
Here is CLI output from my terminals to show all is working.
Docker Image
[root@e91ecb9e1ebf recordz_chain]# multichaind recordz_chain -daemon
MultiChain 1.0.4 Daemon (latest protocol 10010)
Starting up node...
Other nodes can connect to this node using:
multichaind recordz_chain@172.17.0.3:6471
Listening for API requests on port 6470 (local only - see rpcallowip setting)
Node ready.
Windows Machine
PS C:\Software\multichain-windows-1.0.4> .\multichaind.exe recordz_chain -daemon
MultiChain 1.0.4 Daemon (latest protocol 10010)
Other nodes can connect to this node using:
multichaind recordz_chain@192.168.99.1:6471
This host has multiple IP addresses, so from some networks:
multichaind recordz_chain@192.168.56.1:6471
multichaind recordz_chain@192.168.0.10:6471
Listening for API requests on port 6470 (local only - see rpcallowip setting)
Node ready.
Command From Windows Terminal
PS C:\Software\multichain-windows-1.0.4> .\multichain-cli.exe recordz_chain getinfo
{"method":"getinfo","params":[],"id":1,"chain_name":"recordz_chain"}
{
"version" : "1.0.4",
"nodeversion" : 10004901,
"protocolversion" : 10010,
"chainname" : "recordz_chain",
"description" : "MultiChain recordz_chain",
"protocol" : "multichain",
"port" : 6471,
"setupblocks" : 60,
"nodeaddress" : "recordz_chain@192.168.99.1:6471",
"burnaddress" : "1XXXXXXXLnXXXXXXiTXXXXXXTFXXXXXXWF5mxB",
"incomingpaused" : false,
"miningpaused" : false,
"walletversion" : 60000,
"balance" : 0.00000000,
"walletdbversion" : 2,
"reindex" : false,
"blocks" : 59,
"timeoffset" : 0,
"connections" : 2,
"proxy" : "",
"difficulty" : 0.00000006,
"testnet" : false,
"keypoololdest" : 1526140326,
"keypoolsize" : 2,
"paytxfee" : 0.00000000,
"relayfee" : 0.00000000,
"errors" : ""
}
I have the correct permissions setup and can communicate from my windows machine to my docker image, but when I am trying to run the application I get that error. I would have thought it was an issue with the API I am using, but I had this working before while on my Ubuntu VM, so I know its not the API.
I did find this answer - https://www.multichain.com/qa/2444/running-multichain-docker-unable-connect-external-service
I applied the solution of changing the defaulted password to a shorter one, just 'password' and restarted the multichain server and my windows connection to it. I also updated the password in my java application but still getting the same result.
I'm out of ideas now. Any help would be much appreciated