skip to Main Content

I’ve been stuck on this problem for quite some time now, any help would be gladly appreciated.

So I have a docker compose containing Elastic Stack services, plus a Cassandra database.

I am trying to index data from the Cassandra database to ElasticSearch via Logstash, using a CassandraJDBC42.jar driver, which I am mounting via a docker volume.

Whenever I run the services docker compose up (Version-2 Docker Compose), everything runs smoothly except the Logstash service, it does not go up – and this is the error in the logs.

Using bundled JDK: /usr/share/logstash/jdk
Error: Could not find or load main class org.logstash.launchers.JvmOptionsParser 
Caused by: java.lang.ClassNotFoundException: org.logstash.launchers.JvmOptionsParser

And this is the Docker Compose Logstash service.

 logstash:
    image: logstash:7.17.18
    container_name: logstash
    # restart: always
    volumes:
      - logstash_data:/usr/share/logstash/data
      - ./cassandra-driver/:/usr/share/logstash/logstash-core/lib/jars # MOUNTING OF THE DRIVER
      - ./logstash/logstash.conf:/logstash_dir/logstash.conf
    command: logstash -f /logstash_dir/logstash.conf
    depends_on:
      - elasticsearch
    ports:
      - "9600:9600"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elastic

If I remove the mounting of the driver, everything runs smoothly.

Tried different versions of the images, the problem persists.

Tried a different driver, the same.

Tried running the container without the driver, getting inside, installing openjdk-11, mounting the driver again, still the same.

2

Answers


  1. Chosen as BEST ANSWER

    Fixed, the problem was the mapping of the volumes, it requires the exact path and the file included on the both the host and the container.

    Due to that it could not see the driver therefore not reading the Java.

    #OLD ./cassandra-driver/:/usr/share/logstash/logstash-core/lib/jars
    
    #FIX ./cassandra-driver/CassandraJDBC42.jar:/usr/share/logstash/logstash-core/lib/jars/CassandraJDBC42.jar
    

    The same goes with the logstash.conf file.


  2. I think you should try docker version 24.y.z.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search