This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
jsipfs daemon does not work properly with java ipfs wrapper #1362
Closed
Description
- Version:
js-ipfs version: 0.28.2-
Repo version: 6
System version: x64/darwin
Node.js version: v7.2.1
- Platform:
Darwin Luiss-MacBook-Pro.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
- Subsystem: Unknown
Type: Bug
Severity: Low
Description: The jsipfs daemon does not work properly if you use java ipfs api wrapper. The Java IPFS Wrapper works with ipfs daemon from ipfs.io binaries.
The main problem is related with API. Get like that " http://127.0.0.1:5001/api/v0/get/QmdWFrmDRZmAG8kMX5UG2RmEWpNbUkppeuiLcvNTBnU8df" is not available in jsipfs daemon.
Instead, it accepts a POST with: http://127.0.0.1:5001/api/v0/get?arg=...&stream-channel=true
If you want to better debugging use wireshark.
For use different languages with the jsipfs daemon, it should be nice if this API will also be supported.
Steps to reproduce the error:
-
Run jsipfs daemon
$ jsipfs init
$ jsipfs daemon -
Run the following Java code:
IPFS ipfs = new IPFS("/ip4/127.0.0.1/tcp/5001");
NamedStreamable.ByteArrayWrapper file = new NamedStreamable.ByteArrayWrapper("hello.txt", "G'day world! IPFS rocks!".getBytes());
MerkleNode addResult = ipfs.add(file).get(0);
Multihash filePointer = Multihash filePointer = Multihash.fromBase58(addResult.hash.toBase58());
byte[] fileContents = ipfs.cat(filePointer);
It will retrieve
java.lang.RuntimeException: IOException contacting IPFS daemon.
Trailer: null {"Message":"Sorry, something went wrong, please retrace your steps.","Code":1}
at io.ipfs.api.IPFS.get(IPFS.java:592)
at io.ipfs.api.IPFS.retrieve(IPFS.java:571)
at io.ipfs.api.IPFS.get(IPFS.java:105)
at com.bmdsoftware.pacs.dicoogle.ipfs.TestIPFS.ipfs(TestIPFS.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.io.FileNotFoundException: http://127.0.0.1:5001/api/v0/get/QmdWFrmDRZmAG8kMX5UG2RmEWpNbUkppeuiLcvNTBnU8df
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at io.ipfs.api.IPFS.get(IPFS.java:580)
... 24 more
Metadata
Metadata
Assignees
Labels
No labels