0
$\begingroup$

I am trying to access a remote MongoDB database through Mathematica using JLink. The connection is fine, but my installation of Mathematica 10.0 seems to contain an SLF4J logger addon, which prints messages like this one:

06:33:36.274 [cluster-ClusterId{value='580de2cbdd207b8caf38bb00', description='null'}-###.###.###.###:#####] DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=STANDALONE, servers=[{address=###.###.###.###:#####, type=STANDALONE, roundTripTime=4.3 ms, state=CONNECTED}]

every few seconds. I would like to get rid of these logger messages by clearing the default ClassPath and only specifying the necessary .jar files.

I tried this using:

ReinstallJava[ClassPath -> "~/path_to_my_jar_files"];

But according to the output of JavaClassPath[], this seems to only append my path to the default ClassPath, which is

{/shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Java/WolframSSHKeyGen.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Java/WolframSSH.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/antlr.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/mexpr.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/PacletManager.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/WRIjdbm.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Autoload/PacletManager/Java/mexprparser.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-scratchpad-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/Exif.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/prefsAll.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/resourcesOptional.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/commons-lang-2.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/commons-httpclient-3.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/stax-api-1.0.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/jxl.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/jdbf.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/jackcess-1.1.18.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/zxing-client.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/core-3.0.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/xmlbeans-2.3.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/ldap.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/dom4j-1.6.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-ooxml-schemas-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/jmf.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/commons-codec-1.3.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-excelant-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/tar.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/tagsoup-1.0rc9.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/activation.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/mail.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/commons-logging-1.1.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-ooxml-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/customizer.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/jdom.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/Convert.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/javase-3.0.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/multiplayer.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/grib-8.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/JPEG2000b.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/bzip2.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/xercesImpl.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/externalservice.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/poi-examples-3.8-20120326.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/xml-apis.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/netcdf-4.2.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/mediaplayer.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/JSON.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/commons-collections-3.2.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Converters/Java/gnu-regexp-1.1.4.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/xmlParserAPIs.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/bsf.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/OculusLayout.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/concurrent.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/GUIKit.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/diva-canvas-core.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/bsf-Wolfram.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Packages/GUIKit/Java/xercesImpl.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/derbyclient.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/postgresql-9.3-1100.jdbc4.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/commons-dbcp-1.2.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/jtds-1.3.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/sqlite-jdbc-3.7.2.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/mysql-connector-java-5.1.27-bin.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/hsqldb.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/jaybird-full-2.2.3.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/commons-pool-1.2.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/derby.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/commons-collections-3.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/glazedlists.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/DatabaseLink/Java/h2-1.3.174.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/JRIEngine.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/JRI.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/RLink.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/jna.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/REngine.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/RLink/Java/log4j-1.2.16.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/WebServices/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/WebServices/Java/junit-3.8.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/WebServices/Java/commons-httpclient-3.0.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/WebServices/Java/commons-logging-1.0.4.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/XMLSchema/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Links/XMLSchema/Java/commons-codec-1.3.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Applications/ClusterIntegration/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Applications/ClusterIntegration/Java/Wolfram_SGE.jar, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Applications/DocumentationSearch/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Applications/LightweightGridClient/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/AddOns/Applications/LightweightGridClient/Java/wolfram-remote-services-client.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Components/Interpreter/Java/, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Components/Interpreter/Java/ParseTelephoneNumber.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Components/Interpreter/Java/libphonenumber-6.1.jar, /shared/apps/mathematica/mathematica_10/INSTALL/SystemFiles/Java/Linux-x86-64/lib/tools.jar}

I then tried:

ReinstallJava[ClassPath -> None];
AddToClassPath["~/path_to_my_jar_files"];

But again, according to the output of JavaClassPath[], this seems to only append my path to the default ClassPath.

Is there any way to completely clear the default JavaClassPath to get rid of this bothersome logger? Any help is greatly appreciated!

$\endgroup$
2
$\begingroup$

I use

ReinstallJava[CommandLine -> DIRJAVA, ClassPath -> DIRBOTA];

where DIRJAVA is the directory of a JRE I installed myself, and DIRBOTA is the directory of the Java .jar package I am using.

$\endgroup$
  • 1
    $\begingroup$ Thank you! I think this could work as well. $\endgroup$ – knowbodynos Nov 24 '17 at 21:58
0
$\begingroup$

Solved

It turns out that path_to_jar_files has to be prepended to the Java class path. I also had to set the maximum Java heap size to 32 Gb.

The solution looks like this:

MongoDBJarDirectory=DirectoryName["path_to_jar_files"]; SetOptions[ReinstallJava, JVMArguments->"-Xmx32g"]; ReinstallJava[]; AddToClassPath[MongoDBJarDirectory,"Prepend"->True];

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.