elasticsearch-jdbc icon indicating copy to clipboard operation
elasticsearch-jdbc copied to clipboard

Could not find or load main class org.xbib.tools.Runner

Open vtaneeru opened this issue 9 years ago • 23 comments

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.

vtaneeru avatar Oct 28 '15 21:10 vtaneeru

Can you list the content of the lib folder and show the script how you run the importer?

jprante avatar Oct 28 '15 21:10 jprante

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 avatar Oct 29 '15 07:10 Mice73

@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.

jprante avatar Oct 29 '15 08:10 jprante

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?

Mice73 avatar Oct 29 '15 08:10 Mice73

"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 avatar Oct 29 '15 08:10 Mice73

@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.

jprante avatar Oct 29 '15 08:10 jprante

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.

Mice73 avatar Oct 29 '15 08:10 Mice73

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?

jprante avatar Oct 29 '15 08:10 jprante

Ah, it's the source code.

jprante avatar Oct 29 '15 08:10 jprante

@Mice73 you can not run JDBC importer by downloading the source code, sorry

jprante avatar Oct 29 '15 08:10 jprante

Ok ok .... I've seen the link, sorry I searched from release..... :)

Mice73 avatar Oct 29 '15 08:10 Mice73

@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"

vtaneeru avatar Oct 29 '15 14:10 vtaneeru

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.

jprante avatar Oct 29 '15 14:10 jprante

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"

vtaneeru avatar Oct 29 '15 14:10 vtaneeru

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

jprante avatar Oct 29 '15 14:10 jprante

Tried with "%LIB%/*". No luck.

vtaneeru avatar Oct 29 '15 14:10 vtaneeru

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:@//:1521/<SID>",^ "connection_properties" : {^ "oracle.jdbc.TcpNoDelay" : false,^ "useFetchSizeWithLongColumn" : false,^ "oracle.net.CONNECT_TIMEOUT" : 10000,^ "oracle.jdbc.ReadTimeout" : 50000^ },^ "user" : "apps",^ "password" : "apps",^ "sql" : "select * from okl_endeca_contracts_v",^ "index" : "myoracle",^ "type" : "myoracle",^ "elasticsearch" : {^ "cluster" : "elasticsearch",^ "host" : "localhost",^ "port" : 9300^ },^ "max_bulk_actions" : 20000,^ "max_concurrent_bulk_requests" : 10,^ "index_settings" : {^ "index" : {^ "number_of_shards" : 1,^ "number_of_replica" : 0^ }^ }^ }^ }

"%JAVA_HOME%\bin\java" -cp "%LIB%" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"

pause

RodBruno avatar Jan 08 '16 18:01 RodBruno

@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

23233 avatar Jul 07 '16 00:07 23233

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 avatar Aug 02 '16 17:08 jezgomez

@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 avatar Aug 02 '16 20:08 jprante

@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.

jezgomez avatar Aug 02 '16 21:08 jezgomez

谢谢 @jprante

wellzhen avatar Sep 12 '16 16:09 wellzhen

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!

maxclac avatar Sep 19 '17 14:09 maxclac