I have json publishing to one of my kafka topic:
{
"hash": "ABC",
"height": 107900,
"time": 1297626305,
"txs": [
{
"hash": "XYZ1",
"index": 0,
"version": 1,
"inputs": [
{
"prevout": {
"hash": "IN1",
"index": 4294967295
},
"script": "045285021b0173",
"address": null
}
],
"outputs": [
{
"value": 5001000000,
"address": "OUT1"
}
],
"locktime": 0
},
{
"hash": "XYZ2",
"index": 1,
"version": 1,
"inputs": [
{
"prevout": {
"hash": "IN12",
"index": 1
},
"coin": {
"version": 1,
"height": 107899,
"value": 34645000000,
"address": "IN2",
"coinbase": false
}
}
],
"outputs": [
{
"value": 6000000,
"address": "OUT2"
},
{
"value": 70000000,
"address": "OUT4"
}
],
"locktime": 0
}
]
}
I want to get result like :
{
address: IN2
result : {
output : OUT2,
value: 6000000
},
result : {
output : OUT4,
value: 70000000
},
I am trying to use the same approach given in post Parsing JSON data using Apache Kafka Streaming but getting the below error :
I am trying with creating different POJOs and trying with the solution provided in the abover referenced answer. but getting error :
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/kafka/common/serialization/Deserializer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException:
org.apache.kafka.common.serialization.Deserializer
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
I tried with adding this class to classpath while running the java -cp But, as soon as I add for this jar error appears for some other jar. And this goes on.. :( Please give solutions if any.
Thanks in advance.