Could not find or load main class


(Ayoub Benzouine) #1

I am trying to install Elasticsearch 2.2.0 and I am getting this errors:
./elasticsearch: line 75: dirname: command not found
./elasticsearch: line 98: dirname: command not found
./elasticsearch: line 125: uname: command not found
./elasticsearch: line 134: hostname: command not found
./elasticsearch: line 134: cut: command not found
./elasticsearch: line 138: egrep: command not found
Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch

I found that there was a similar topic and the problem was in the Java version. I have jdk1.8.0_60.jdk, jdk1.8.0_131.jdk and jdk1.6.0.jdk, so I checked my Java path in case it might be pointing on the 1.6 version but actually it is not:

macs-MacBook-Pro-2:bin mac$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

I even removed the 1.6 version but I'm still getting the same error.

Thank you in advance for your help.


(David Pilato) #2

What did you download exactly?

Sounds like you are running on a Mac, right?

Should be pretty much straightforward:

  • Download the tar.gz
  • tar xzf thefile
  • cd thedir
  • bin/elasticsearch

Are you doing any other step you did not mention yet?


(Ayoub Benzouine) #3

I am still getting errors:

   Last login: Thu May 11 18:28:39 on console
  -bash: touch: command not found
   controller:~ mac$ cd /Users/mac/Documents 
   controller:Documents mac$ tar xzf elasticsearch-5.4.0
  -bash: tar: command not found
  controller:Documents mac$ cd /Users/mac/Documents/elasticsearch-5.4.0/bin  
  controller:bin mac$ elasticsearch
  -bash: elasticsearch: command not found
  controller:bin mac$ ./elasticsearch
  ./elasticsearch: line 48: grep: command not found
  ./elasticsearch: line 108: dirname: command not found
  ./elasticsearch: line 142: dirname: command not found
  Error: Could not find or load main class org.elasticsearch.tools.JavaVersionChecker
  Elasticsearch requires at least Java 8 but your Java version from /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java does not meet this requirement
 controller:bin mac$ 

I downloaded it from https://www.elastic.co/downloads/elasticsearch

Even the "tar" command didn't work so I had to open the file using Archive Utility.

I am thinking maybe there is something wrong in the ".bash_profile" file. Can you please show me an example of how it looks like by default?


(David Pilato) #4

Probably you screwed up your path if you modified it.


(Ayoub Benzouine) #5

I was pointing in my ES_HOME path on another version of Elasticsearch that I don't have anymore. I have just modified the path. But still getting errors:

Last login: Fri May 12 09:33:34 on ttys000
-bash: touch: command not found
controller:~ mac$ cd /Users/mac/Documents/elasticsearch-5.4.0/bin 
controller:bin mac$ ./elasticsearch
./elasticsearch: line 48: grep: command not found
./elasticsearch: line 108: dirname: command not found
./elasticsearch: line 142: dirname: command not found
./elasticsearch: line 184: hostname: command not found
./elasticsearch: line 184: cut: command not found
./elasticsearch: line 188: egrep: command not found
2017-05-12 09:59:49,100 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:585)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanTrustPermission(DefaultMBeanServerInterceptor.java:1848)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:322)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.logging.log4j.core.jmx.Server.register(Server.java:389)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:167)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:556)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:206)
at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:221)
at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:197)
at org.elasticsearch.common.logging.LogConfigurator.configureStatusLogger(LogConfigurator.java:126)
at org.elasticsearch.common.logging.LogConfigurator.configureWithoutConfig(LogConfigurator.java:68)
at org.elasticsearch.cli.Command.main(Command.java:85)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)

Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.NoSuchFileException: /config
Likely root cause: java.nio.file.NoSuchFileException: /config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
at java.nio.file.Files.walkFileTree(Files.java:2662)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:101)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:84)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114)
at     org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
at org.elasticsearch.cli.Command.main(Command.java:88)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
Refer to the log for complete error details.

controller:bin mac$

(Ayoub Benzouine) #6

It is working now. I reset my ".bash_profile" file. As I was thinking it was because of it.

Last login: Fri May 12 09:59:19 on ttys000
controller:~ mac$ cd documents
controller:documents mac$ cd elas*
controller:elasticsearch-5.4.0 mac$ ls
LICENSE.txt	README.textile	config		modules
NOTICE.txt	bin		lib		plugins
controller:elasticsearch-5.4.0 mac$ cd bin
controller:bin mac$ ls
elasticsearch			elasticsearch-service.bat
elasticsearch-keystore		elasticsearch-systemd-pre-exec
elasticsearch-keystore.bat	elasticsearch-translog
elasticsearch-plugin		elasticsearch-translog.bat
elasticsearch-plugin.bat	elasticsearch.bat
elasticsearch-service-mgr.exe	elasticsearch.in.bat
elasticsearch-service-x64.exe	elasticsearch.in.sh
elasticsearch-service-x86.exe
controller:bin mac$ ./elasticsearch
[2017-05-12T10:11:04,197][INFO ][o.e.n.Node               ] [] initializing ...
[2017-05-12T10:11:04,315][INFO ][o.e.e.NodeEnvironment    ] [Is99LZf] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [6.1gb], net total_space [111.8gb], spins? [unknown], types [hfs]
[2017-05-12T10:11:04,316][INFO ][o.e.e.NodeEnvironment    ] [Is99LZf] heap size [1.9gb], compressed ordinary object pointers [true]
[2017-05-12T10:11:04,317][INFO ][o.e.n.Node               ] node name [Is99LZf] derived from node ID [Is99LZfXQrSPgJ5Tiyzv3Q]; set [node.name] to override
[2017-05-12T10:11:04,318][INFO ][o.e.n.Node               ] version[5.4.0], pid[98636], build[780f8c4/2017-04-28T17:43:27.229Z], OS[Mac OS X/10.11.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11]
[2017-05-12T10:11:05,553][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [aggs-matrix-stats]
[2017-05-12T10:11:05,553][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [ingest-common]
[2017-05-12T10:11:05,554][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [lang-expression]
[2017-05-12T10:11:05,554][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [lang-groovy]
[2017-05-12T10:11:05,554][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [lang-mustache]
[2017-05-12T10:11:05,554][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [lang-painless]
[2017-05-12T10:11:05,554][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [percolator]
[2017-05-12T10:11:05,555][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [reindex]
[2017-05-12T10:11:05,555][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [transport-netty3]
[2017-05-12T10:11:05,555][INFO ][o.e.p.PluginsService     ] [Is99LZf] loaded module [transport-netty4]
[2017-05-12T10:11:05,556][INFO ][o.e.p.PluginsService     ] [Is99LZf] no plugins loaded
[2017-05-12T10:11:08,039][INFO ][o.e.d.DiscoveryModule    ] [Is99LZf] using discovery type [zen]
[2017-05-12T10:11:09,007][INFO ][o.e.n.Node               ] initialized
[2017-05-12T10:11:09,007][INFO ][o.e.n.Node               ] [Is99LZf] starting ...
[2017-05-12T10:11:09,327][INFO ][o.e.t.TransportService   ] [Is99LZf] publish_address {127.0.0.1:9300}, bound_addresses {[fe80::1]:9300}, {[::1]:9300}, {127.0.0.1:9300}
[2017-05-12T10:11:12,415][INFO ][o.e.c.s.ClusterService   ] [Is99LZf] new_master {Is99LZf}{Is99LZfXQrSPgJ5Tiyzv3Q}{t4iooNZCRBWh2HJl3xiP7Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-05-12T10:11:12,439][INFO ][o.e.h.n.Netty4HttpServerTransport] [Is99LZf] publish_address {127.0.0.1:9200}, bound_addresses {[fe80::1]:9200}, {[::1]:9200}, {127.0.0.1:9200}
[2017-05-12T10:11:12,444][INFO ][o.e.n.Node               ] [Is99LZf] started
[2017-05-12T10:11:12,449][INFO ][o.e.g.GatewayService     ] [Is99LZf] recovered [0] indices into cluster_state
[2017-05-12T10:11:42,433][WARN ][o.e.c.r.a.DiskThresholdMonitor] [Is99LZf] high disk watermark [90%] exceeded on [Is99LZfXQrSPgJ5Tiyzv3Q][Is99LZf [/Users/mac/documents/elasticsearch-5.4.0/data/nodes/0] free: 6.1gb[5.4%], shards will be relocated away from this node
[2017-05-12T10:11:42,433][INFO ][o.e.c.r.a.DiskThresholdMonitor] [Is99LZf] rerouting shards: [high disk watermark exceeded on one or more nodes]

Thank you for your help. :slight_smile:


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.