TAP protocol - retrieve all keys from the bucket
Hello,
I'm using Membase and I need to retrieve all keys from the bucket (using TAP protocol).
I've downloaded jtap and I've compiled this example to retrieve all keys:
--- TapRunner.java ---
import com.membase.jtap.*;
import com.membase.jtap.exporter.*;
import com.membase.jtap.ops.*;
public class TapRunner
{
public static void main(String args[])
{
TapStreamClient client = new TapStreamClient("localhost", 11210, "default", null);
Exporter exporter = new FileExporter("results.txt");
CustomStream tapListener = new CustomStream(exporter, "node1");
tapListener.keysOnly();
tapListener.doDump();
client.start(tapListener);
}
}
--- TapRunner.java ---
I can compile it with no errors with
# javac -cp .:jtap.jar TapRunner.java
But when I run it I receive these errors:
# java -cp .:jtap.jar TapRunner
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.membase.jtap.TapStreamClient.(Unknown Source)
at TapRunner.main(TapRunner.java:11)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
... 2 more
Where is the problem?
Is this the only way to retrieve all keys with TAP protocol, in a txt file?
Can't I iterate all the keys in other ways?
Thanks.
That error indicates that you need the slf4j library.
The jtap library isn't updated anymore since the TAP functionality has been added to the java client.
http://www.couchbase.com/develop/java/current
However, I've been running into issues of my own trying to pull keys where the client just disconnects before it's finished.