Startup failure - elasticsearch "Error: Could not find or load main class -XX:+UseConcMarkSweepGC"

  • version sonarqube 6.7.5
  • OSx Mojave 10.14.6
    cd to $sonarqube_home
    ./bin/macosx-universal-64/sonar.sh console
2018.08.13 10:46:45 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2018.08.13 10:46:45 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/Users/.../Documents/dev/apps/sonarqube-6.7.4/elasticsearch]: /Users/.../Documents/dev/apps/sonarqube-6.7.4/elasticsearch/bin/elasticsearch -Epath.conf=/Users/.../Documents/dev/apps/sonarqube-6.7.4/temp/conf/es
2018.08.13 10:46:45 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.08.13 10:46:45 INFO  app[][o.e.p.PluginsService] no modules loaded
2018.08.13 10:46:45 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
Error: Could not find or load main class -XX:+UseConcMarkSweepGC
2018.08.13 10:46:46 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
  • This seems to be related to elasticsearch and modified elasticsearch/bin/elasticsearch to remove double quote around each variable. Line 190 now looks like:
exec "$JAVA $ES_JAVA_OPTS -Des.path.home=$ES_HOME -cp \"$ES_CLASSPATH\" \
          org.elasticsearch.bootstrap.Elasticsearch $@" 

however now I get the error:

Line 190: ...: File name too long

I realize this is an older version and the 8.1 elasticsearch script seems to have changed quite a bit, but what gives? I seem to remember changing the script in 4.x versions as well but my hacks aren’t working this time.

Hi,

Welcome to the community!

The last time we saw this it was a corrupt download bundle. Could you re-download and try again?

 
Ann

Thanks so much for welcoming me to the community!

I did redownload and the byte size is exactly the same as the file I had from 2018, 159614083. After unzipping the elasticsearch script also looks the same. Hmm, I also downloaded the latest 6.7.7 and see no difference there either. Hmmm.

Okay, I guess the log snippet you provided initially was from sonar.log? What errors do you see in the other logs? Also, it would be helpful to have full stacktraces rather than just the initial ERROR lines.

 
:slight_smile:
Ann

sonar.txt (5.2 KB)

nothing interesting here, this is after the modification I made and even moved the directory to /opt/s to try and get rid of the File name too long error. No es.log as it doesn’t startup. If I run the complete java command elasticsearch starts properly so it seems related to the script itself. My bash skills aren’t great so that’s why I am posting. Thanks for any guidance you can provide!

Hi,

Once you start making that kind of modification, all bets are off. Can you restore the original state and see what’s in the logs?

 
Ann

restoring the original state leads us back to the original message “Could not find or load main class -XX:+UseConcMarkSweepGC” at the top of the topic. Attaching the entire log if you find something interesting.sonar.orig.txt (3.1 KB)

Hi,

Thanks for the original log. What version of Java are you using?

 
Ann

java version “1.8.0_201”

Java™ SE Runtime Environment (build 1.8.0_201-b09)

Java HotSpot™ 64-Bit Server VM (build 25.201-b09, mixed mode)

Hi,

I’m really not sure what to tell you. Since 6.7.* is past EOL, could you try again with the current LTS, 7.9.2?

 
Ann

I quickly downloaded 7.9.2 tried to start using jdk1.8 (not supported) I didn’t have jdk11 installed. I tried using openjdk13 and ran into this:

Based on responses in the thread I am going to assume if I installed jdk11 sonarqube would start. Thanks for all the responses, I’ll recommend my team upgrade to the latest LTS.
Chris