java 調用IPFS出現405

問題描述

代碼

public static void main(String[] args) throws IOException {

        IPFS ipfs = new IPFS("/ip4/127.0.0.1/tcp/5001");
//        NamedStreamable.FileWrapper savefile = new NamedStreamable.FileWrapper(new File("D:/test.jpg"));
//        MerkleNode result = ipfs.add(savefile).get(0);

    }
Exception in thread "main" java.lang.RuntimeException: IOException contacting IPFS daemon.
Trailer: null 405 - Method Not Allowed

	at io.ipfs.api.IPFS.get(IPFS.java:683)
	at io.ipfs.api.IPFS.retrieve(IPFS.java:662)
	at io.ipfs.api.IPFS.retrieveAndParse(IPFS.java:624)
	at io.ipfs.api.IPFS.version(IPFS.java:572)
	at io.ipfs.api.IPFS.<init>(IPFS.java:69)
	at io.ipfs.api.IPFS.<init>(IPFS.java:53)
	at io.ipfs.api.IPFS.<init>(IPFS.java:49)
	at IPFStest.main(IPFStest.java:17)
Caused by: java.io.IOException: Server returned HTTP response code: 405 for URL: http://127.0.0.1:5001/api/v0/version
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at io.ipfs.api.IPFS.get(IPFS.java:671)
	... 7 more

 

今天查閱官方文檔時發現,5版本以後均不支持。如下是官方的解釋

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章