Could not find or load main class "-

''' can anybody help me, cause I'm trying to start elasticsearch bu it did't work

Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

auliakn@elk:/$ sudo journalctl -xe
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Main p
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: Failed to start Elasticsearch
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- Unit elasticsearch.service has failed.

-- The result is failed.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Unit e
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Failed
Aug 03 08:24:32 elk.kifarunix-demo.com polkitd(authority=local)[1071]: Unregiste
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: auliakn : TTY=pts/0 ; PWD=/
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: pam_unix(sudo:session): sessi
lines 2049-2071/2071 (END)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.createProcess(ServerProcess.java:211)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:106)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:89)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerCli.startServer(ServerCli.java:213)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:90)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.cli.Command.main(Command.java:50)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- Unit elasticsearch.service has failed.

-- The result is failed.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Unit entered failed state.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Aug 03 08:24:32 elk.kifarunix-demo.com polkitd(authority=local)[1071]: Unregistered Authentication Agent for unix-process:2210:375203 (system bus name :1.10, object pat
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: auliakn : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: pam_unix(sudo:session): session opened for user root by auliakn(uid=0)'''

Welcome to our community! :smiley:

Please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

auliakn@elk:/$ sudo journalctl -xe
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Main p
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: Failed to start Elasticsearch
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit elasticsearch.service has failed.
-- The result is failed.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Unit e
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Failed
Aug 03 08:24:32 elk.kifarunix-demo.com polkitd(authority=local)[1071]: Unregiste
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: auliakn : TTY=pts/0 ; PWD=/
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: pam_unix(sudo:session): sessi
lines 2049-2071/2071 (END)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.createProcess(ServerProcess.java:211)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:106)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:89)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerCli.startServer(ServerCli.java:213)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:90)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.cli.Command.main(Command.java:50)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd-entrypoint[2219]: at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit elasticsearch.service has failed.
-- The result is failed.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Unit entered failed state.
Aug 03 08:24:32 elk.kifarunix-demo.com systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Aug 03 08:24:32 elk.kifarunix-demo.com polkitd(authority=local)[1071]: Unregistered Authentication Agent for unix-process:2210:375203 (system bus name :1.10, object pat
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: auliakn : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 03 08:25:51 elk.kifarunix-demo.com sudo[2277]: pam_unix(sudo:session): session opened for user root by auliakn(uid=0)'''

Please show the Elasticsearch logs. The location will depend on how you installed Elasticsearch.

root@elk:/var/log/elasticsearch# nano elasticsearch.log
  GNU nano 2.5.3                                         File: elasticsearch.log

[2022-07-28T02:38:15,411][WARN ][stderr                   ] [10ubuntu] Jul 28, 2022 2:38:15 AM com.sun.jna.Native loadNativeDispatchLibrary
[2022-07-28T02:38:15,439][WARN ][stderr                   ] [10ubuntu] WARNING: JNA Warning: IOException removing temporary files
[2022-07-28T02:38:15,440][WARN ][stderr                   ] [10ubuntu] java.io.IOException: JNA temporary directory '/var/lib/elasticsearch/tmp' is not writable
[2022-07-28T02:38:15,444][WARN ][stderr                   ] [10ubuntu]  at com.sun.jna.Native.getTempDir(Native.java:1360)
[2022-07-28T02:38:15,446][WARN ][stderr                   ] [10ubuntu]  at com.sun.jna.Native.removeTemporaryFiles(Native.java:1367)
[2022-07-28T02:38:15,450][WARN ][stderr                   ] [10ubuntu]  at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:946)
[2022-07-28T02:38:15,452][WARN ][stderr                   ] [10ubuntu]  at com.sun.jna.Native.<clinit>(Native.java:221)
[2022-07-28T02:38:15,455][WARN ][stderr                   ] [10ubuntu]  at java.base/java.lang.Class.forName0(Native Method)
[2022-07-28T02:38:15,462][WARN ][stderr                   ] [10ubuntu]  at java.base/java.lang.Class.forName(Class.java:383)
[2022-07-28T02:38:15,463][WARN ][stderr                   ] [10ubuntu]  at java.base/java.lang.Class.forName(Class.java:376)
[2022-07-28T02:38:15,463][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:34)
[2022-07-28T02:38:15,464][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106)
[2022-07-28T02:38:15,465][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)
[2022-07-28T02:38:15,465][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434)
[2022-07-28T02:38:15,466][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169)
[2022-07-28T02:38:15,467][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160)
[2022-07-28T02:38:15,468][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
[2022-07-28T02:38:15,469][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
[2022-07-28T02:38:15,474][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.cli.Command.main(Command.java:77)
[2022-07-28T02:38:15,475][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
[2022-07-28T02:38:15,476][WARN ][stderr                   ] [10ubuntu]  at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
[2022-07-28T02:38:15,485][WARN ][o.e.b.Natives            ] [10ubuntu] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library: JNA temporary directory '/var/lib/elasticsearc$
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1059) ~[jna-5.10.0.jar:5.10.0 (b0)]
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) ~[jna-5.10.0.jar:5.10.0 (b0)]
        at com.sun.jna.Native.<clinit>(Native.java:221) ~[jna-5.10.0.jar:5.10.0 (b0)]
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:383) ~[?:?]
        at java.lang.Class.forName(Class.java:376) ~[?:?]
        at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:34) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.5.jar:7.17.5]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.5.jar:7.17.5]
        at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.5.jar:7.17.5]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) [elasticsearch-7.17.5.jar:7.17.5]

This seems to be the issue.

sorry, since I'm new to using elasticsearch, can you tell me what to do?

Make that directory writable by the elasticsearch user. That is more of a sysadm issue that an Elasticsearch issue though so may depend on operating system used and where you have deployed it.

can you tell me how, because i have tried but still fail. the error is still the same

It is not an Elasticsearch issue but rather related to system administration. As I said earlier it will depend on your environment so I would recommend you google it.

ok thanks for answering and helping me :slightly_smiling_face:, at least i know where i went wrong

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