All Apps and Add-ons

Hunk App for MongoDB: Why can't I connect to MongoDB and get NoClassDefFoundError?

infraview
Engager

Hi,

I've installed the Hunk MongoDB App to connect to my local mongoDB (v. 3.0.6), created a provider for it and a virtual index for one of my collections. If I try to search for the index I get the following error message: [local-mongodb] Error while running external process, return_code=1.
So I've checked the search.log and found a NoClassDefFound Error:

10-06-2015 13:55:33.855 ERROR ERP.local-mongodb - Error: A JNI error has occurred, please check your installation and try again
10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - Exception in thread "main" java.lang.NoClassDefFoundError: com/splunk> > >/util/WildcardList
>10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - at java.lang.Class.getDeclaredMethods0(Native Method)
>10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
>10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - at java.lang.Class.getMethod0(Class.java:3018)
>10-06-2015 13:55:33.856 ERROR ERP.local-mongodb - at java.lang.Class.getMethod(Class.java:1784)
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - at >sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - Caused by: java.lang.ClassNotFoundException: com.splunk.util.WildcardList
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>10-06-2015 13:55:33.857 ERROR ERP.local-mongodb - at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>10-06-2015 13:55:33.858 ERROR ERP.local-mongodb - at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>10-06-2015 13:55:33.858 ERROR ERP.local-mongodb - ... 7 more

My config looks like this:
[Provider]
Name: local-mongodb
Additional Settings:
vix.commmand /usr/java/latest/bin/java
vix.command.arg.1 -Xmx512m
vix.command.arg.2 -classpath
vix.command.arg.4 com.splunk.erp.mongodb.MongoDBERP
vix.mode stream
vix.mongodb.host localhost:27017

[Virtual index]
Name: status_threatstatus
Provider: local-mongodb
Path to data in HDFS*: (why should I put something here?)

Settings:
vix.mongodb.collection threatStatus
vix.mongodb.db status
vix.mongodb.field.time _id
vix.mongodb.field.time.format ObjectId

I have no authentication and other clients have no problem to connect to the mongo. What can I do to solve this issue?

Greets Tobias

Tags (1)
1 Solution

rdagan_splunk
Splunk Employee
Splunk Employee

If you are using Hunk 6.3 try this:
go to /opt/splunk/etc/apps/MongoDB/default -> indexes.conf

Modify this line:
Old
vix.command.arg.3 = $SPLUNK_HOME/bin/jars/SplunkMR-s6.0-h1.0.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/hunk_mongodb_app.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/lib/*
vix.command.arg.4 = com.splunk.erp.mongodb.MongoDBERP

New
vix.command.arg.3 = $SPLUNK_HOME/bin/jars/SplunkMR-h1.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/hunk_mongodb_app.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/lib/*
vix.command.arg.4 = com.splunk.erp.mongodb.MongoDBERP

View solution in original post

rdagan_splunk
Splunk Employee
Splunk Employee

If you are using Hunk 6.3 try this:
go to /opt/splunk/etc/apps/MongoDB/default -> indexes.conf

Modify this line:
Old
vix.command.arg.3 = $SPLUNK_HOME/bin/jars/SplunkMR-s6.0-h1.0.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/hunk_mongodb_app.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/lib/*
vix.command.arg.4 = com.splunk.erp.mongodb.MongoDBERP

New
vix.command.arg.3 = $SPLUNK_HOME/bin/jars/SplunkMR-h1.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/hunk_mongodb_app.jar:$SPLUNK_HOME/etc/apps/MongoDBApp/bin/lib/*
vix.command.arg.4 = com.splunk.erp.mongodb.MongoDBERP

naisanza
Path Finder

YES. This was it.

0 Karma

hgehrts_splunk
Splunk Employee
Splunk Employee

yep, helped me as well. With no restart.

0 Karma

RyanR100
Engager

Thanks this helped me too. Note - I did not edit the indexes.conf directly, but updated the the provider settings by going to Settings - > Virtual Indexes -> "local-mongodb". I added the vix.command.arg.3 setting through the GUI and was able to connect to MongoDB.

0 Karma

infraview
Engager

Thank you, that worked 🙂

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...