elasticsearch-jdbc
elasticsearch-jdbc copied to clipboard
Could not find or load main class org.xbib.tools.Runner
With latest 2.0 importer and SQL Server JDBC connector we are getting this "Could not find or load main class org.xbib.tools.Runner" issue. lib folder is added to PATH variable.
Can you list the content of the lib folder and show the script how you run the importer?
I jprante, I've the same problem. Here lib folder:
h2-1.4.181.jar derby-10.11.1.1.jar mysql-connector-java-5.1.33.jar postgresql-9.3-1102-jdbc41.jar jdbc-driver-csv-1.0.0.jar elasticsearch-jdbc-1.7.0.0-uberjar.jar hsqldb-2.3.2.jar
@Mice73 this is JDBC importer 1.7.0.0 and not JDBC importer 2.0.0.0
@vtaneeru where did you get the info that folder must be added to PATH? This does not harm but it does nothing useful.
It should work with the correct script that adds all lib folder jars to the java class path. Class org.xbib.tools.Runner
must be in the uberjar.
Hi @jprante I've downloaded the package 2.0.0 and I've copied lib from old directory lib from jdbc 1.7.
Sorry, my mistake, but how can get lib directory contents?
"if you do not find the JDBC driver jar in the lib directory, download it from your vendor's site and put the driver jar into the lib folder"
...ok
@Mice73 you can not continue to use JDBC importer 1.7.x.y with Elasticsearch 2.0.0
Please download new JDBC importer 2.0.0.0 zip, unpack it, and do not forget to decommission older JDBC importer installations.
I've downloaded your https://github.com/jprante/elasticsearch-jdbc/archive/2.0.0.0.zip
but lib directory is not inside. So I've copied form the old version, this is my mistake.
So how can upgrade lib with jar corrected? Thanks a lot.
I'd added a quick link, it's
http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.0.0.0/elasticsearch-jdbc-2.0.0.0-dist.zip
@Mice73 where go you get this link from?
Ah, it's the source code.
@Mice73 you can not run JDBC importer by downloading the source code, sorry
Ok ok .... I've seen the link, sorry I searched from release..... :)
@jprante "run script with a command that starts org.xbib.tools.JDBCImporter with the lib directory on the classpath". This is mentioned in installation steps.
I downloaded SQL Server JDBC driver from vendor(Microsoft) site.
Here are my lib folder contents: h2-1.4.181.jar derby-10.11.1.1.jar mysql-connector-java-5.1.33.jar postgresql-9.3-1102-jdbc41.jar jdbc-driver-csv-1.0.0.jar elasticsearch-jdbc-2.7.0.0-uberjar.jar hsqldb-2.3.2.jar sqljdbc.jar sqljdbc4.jar sqljdbc41.jar sqljdbc42.jar
Script: set DIR=%~dp0 set LIB=%DIR%..\lib set BIN=%DIR%
"%JAVA_HOME%\bin\java" -cp "%LIB%*" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
Not sure if I understand windows, but you need to add a star to the path in the LIB variable, so the result command line would be something like
java -cp ${LIB}/* -Dlog4j.configurationFile=... org.xbib.tools.Runner org.xbib.tools.JDBCImporter
The *
pulls in all jars from the folder.
I recommend to clean up sqljdbc.jar, sqljdbc4.jar, sqljdbc41.jar, sqljdbc42.jar. Just choose one of it, or the program will run flaky or even break without reason. This is a jar hell.
I'm already adding "*" in java command. Also, I tried with one sqljdbc jar file.
"%JAVA_HOME%\bin\java" -cp "%LIB%*" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
Well, it's "%LIB%/*" also on Windows due to Java documentation.
http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html --> Understanding class path wildcards
Tried with "%LIB%/*". No luck.
here is my script(.bat) working on windows(run directly from cmd), it connects to oracle and I'm using the latest jdbc and elastic versions.
@echo off
set DIR=%~dp0 set LIB="D:\Software\elasticsearch-jdbc-2.1.1.2\lib*" set BIN="D:\Software\elasticsearch-jdbc-2.1.1.2\bin"
echo LIB echo BIN echo DIR
REM ???
echo {^
"type" : "jdbc",^
"jdbc" : {^
"url" : "jdbc:oracle:thin:@//
"%JAVA_HOME%\bin\java" -cp "%LIB%" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
pause
@RodBruno hey guys, i need you help,I want to confirm one thing to you,
** the lib folder don't on the github releases.zip but you lib How obtained ??**
sorry i'm English is every bad,Forgive me
I'm having the same issue with elasticsearch-jdbc-2.3.3.1
. I can run ./gradlew clean install
succesfully but the lib
directory is missing. The README says to download the JDBC driver jar "from your vendor's site", but can you provide an example of exactly what is meant as it's not entirely clear what to look for. Thanks in advance.
@jezgomez do you want to build JDBC importer from source or do you want to use the program?
./gradlew clean install
builds the distribution zip and the lib directory is packaged into it.
You can download the distribution from http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.3.1/elasticsearch-jdbc-2.3.3.1-dist.zip and as described in the README, after unpacking the zip, there is the lib
directory.
Don't you have a JDBC driver jar for your database? If not, you can not use JDBC importer. What is your database vendor?
@jprante thanks for your amazingly fast response on Twitter . It's hugely appreciated.
The link you supplied (http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.4.0/elasticsearch-jdbc-2.3.4.0-dist.zip) had the missing lib
directory I needed.
./gradlew clean install
worked successfully.
Thanks again for helping.
谢谢 @jprante
Hello everyone! I have the same problem and I don't understand how to fix that. Here is the content of my lib directory:
commons-cli-1.3.1.jar
compress-lzf-1.0.2.jar
derby-10.12.1.1.jar
elasticsearch-2.3.4.jar
elasticsearch-helper-2.3.4.0.jar
elasticsearch-jdbc-2.3.4.0.jar
guava-18.0.jar
h2-1.4.191.jar
HdrHistogram-2.1.6.jar
hppc-0.7.1.jar
hsqldb-2.3.3.jar
jackson-core-2.6.6.jar
jackson-dataformat-cbor-2.6.6.jar
jackson-dataformat-smile-2.6.6.jar
jackson-dataformat-yaml-2.6.6.jar
jdbc-driver-csv-1.0.0.jar
joda-convert-1.2.jar
joda-time-2.9.4.jar
jsr166e-1.1.0.jar
jts-1.13.jar
log4j-api-2.5.jar
log4j-core-2.5.jar
log4j-slf4j-impl-2.5.jar
lucene-analyzers-common-5.5.0.jar
lucene-backward-codecs-5.5.0.jar
lucene-core-5.5.0.jar
lucene-grouping-5.5.0.jar
lucene-highlighter-5.5.0.jar
lucene-join-5.5.0.jar
lucene-memory-5.5.0.jar
lucene-misc-5.5.0.jar
lucene-queries-5.5.0.jar
lucene-queryparser-5.5.0.jar
lucene-sandbox-5.5.0.jar
lucene-spatial3d-5.5.0.jar
lucene-spatial-5.5.0.jar
lucene-suggest-5.5.0.jar
mysql-connector-java-5.1.38.jar
netty-3.10.5.Final.jar
postgresql-9.4.1208.jre7.jar
securesm-1.0.jar
slf4j-api-1.7.12.jar
snakeyaml-1.15.jar
spatial4j-0.5.jar
t-digest-3.0.jar
Thanks!