Greetings @All, I’m trying to setup my development environment and following the below steps from moqui.org > Documentation; the environment starts up, but Elastic Search is not coming up, Any pointers are appreciated, my understanding based on documentation is that moqui startup will start Elastic Search as well.
Note: I do understand, Elastic Search can be installed and configured externally, but for local development environment, would like to use the inline Elastic Search
I see the below Starting ElasticSearch message in the log
Starting ElasticSearch install found in runtime/elasticsearch, pid file not found (/usr/lib/jvm/java-11-openjdk-amd64)
However it appears, the ElasticSearch is not starting up clean, as i see below errors from Elastic Facade
Error connecting to ElasticSearch cluster default at http://127.0.0.1:9200, try 1 of 20: org.moqui.BaseException: Error calling HTTP request to http://127.0.0.1:9200/
Environement Details ::
OS : Ubuntu 18.04
Java : java-11-openjdk-amd64
Steps::
From Source Quick Start with ElasticSearch
Use the following steps to do a local install from source and run with the default embedded database (H2) and ElasticSearch installed in the runtime/elasticsearch directory.
- Clone the moqui-framework repository
- $ git clone GitHub - moqui/moqui-framework: Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration. moqui
- $ cd moqui
- Get desired components, for example PopCommerce and/or HiveMind
- $ ./gradlew getComponent -Pcomponent=PopCommerce
- $ ./gradlew getComponent -Pcomponent=HiveMind
- Alternatively just get the default runtime directory (if you don’t want any components)
* $ ./gradlew getRuntime
- Download ElasticSearch (Linux/Mac/Windows, OSS no-JDK version)
- $ ./gradlew downloadElasticSearch
- Build then load seed and demo data (the load task depends on the build task)
- Start Moqui with run ElasticSearch (add ‘no-run-es’ to not run ElasticSearch)
- In your browser go to http://localhost:8080
1 Like
Yeah running elastic search externally for local / temporary environments is kind of a pain and not really worth it.
Production is a different story though.
I noticed you’re using Java 11 on Ubuntu. What happens if you run the startElasticSearch task directly (ie: ./gradlew startElasticSearch
)?
One thing I noticed with Java 11 on macOS (the Azul distro for ARM to run on M1) is that the startElasticSearch task in the master branch which uses ProcessBuilder does nothing (no errors, just does nothing) while the type:Exec variation on it works fine. In the java11 branch this has been changed to use the type:Exec version instead of the ProcessBuilder version. I don’t know why it’s doing this yet in my setup, and I don’t know if it is happening with any other Java 11 JDK distros, so I’m curious if this might be what you’re running into.
Thanks @michael and @jonesde for sharing insights
using openjdk 11.0.14.1 on Ubuntu 20.04 as below
openjdk version “11.0.14.1” 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
I downloaded the java11 version from git, however when i try to download elasticsearch using ./gradlew downloadElasticSearch i encounter the below error
svellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ ./gradlew downloadElasticSearch
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
-
Where:
Build file ‘/home/svellingiri/Downloads/moqui/soruce/moqui-framework-java11/runtime/base-component/webroot/build.gradle’ line: 33
-
What went wrong:
An exception occurred applying plugin request [id: ‘com.eriwen.gradle.js’, version: ‘2.14.1’]
Failed to apply plugin ‘com.eriwen.gradle.js’.
Could not create an instance of type com.eriwen.gradle.js.JavaScriptExtension.
Could not create an instance of type com.eriwen.gradle.js.source.internal.DefaultJavaScriptSourceSetContainer.
‘void org.gradle.api.internal.AbstractNamedDomainObjectContainer.(java.lang.Class, org.gradle.internal.reflect.Instantiator)’
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
BUILD FAILED in 5s
This is working in the master branch, appreciate any pointers
1 Like
Make sure you’re using gradle 7.4.1.
Try ./gradlew --version
Make sure your runtime is on the java11 branch that’s what got me.
After that I tried to load, and an error because I was using java 8, but once I switched to java 11 it worked just fine.
Thanks @michael all of the above seems to tick fine, not sure if anything else i could be missing
vellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ ./gradlew --version
Gradle 7.4.1
Build time: 2022-03-09 15:04:47 UTC
Revision: 36dc52588e09b4b72f2010bc07599e0ee0434e2e
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant™ version 1.10.11 compiled on July 10 2021
JVM: 11.0.14.1 (Ubuntu 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OS: Linux 5.13.0-39-generic amd64
svellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ java -version
openjdk version “11.0.14.1” 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
svellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ ls
addons.xml AUTHORS build.gradle build.xml docker framework gradle gradle.properties gradlew gradlew.bat LICENSE.md MoquiInit.properties moqui-util Procfile README.md ReleaseNotes.md runtime SECURITY.md settings.gradle
From what you wrote it may be that the moqui-runtime repository under the runtime directory is still using the master branch and not the java11 branch.
To make this easier and make sure you have the java11 branches for all repos that have one you can run something like:
$ gradle gitPullAll
$ gradle gitCheckoutAll -Pbranch=java11
Note that the com.eriwen.gradle.js plugin was used in the moqui-runtime repository (updated along with other changes in the java11 branch), and the PopRestStore repository (updated in the master branch because it didn’t need any other changes).
Thanks @jonesde, certainly doing something wrong here, below are the steps i’m following
git clone GitHub - moqui/moqui-framework: Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration. moqui-framework-java11 [currently obtained master branch]
./gradlew gitCheckoutAll -Pbranch=java11 [checking out from java11 branch]
./gradlew gitPullAll [Points to javall branch as below, which is good]
Pulling /home/svellingiri/Downloads/moqui/soruce/moqui-framework-java11 (branch:java11, tracking:origin/java11)
Already up-to-date.
./gradlew getRuntime [perhaps this is pulling from master branch, how do i force this to pull from java11, i even tried as below, but with no joy
./gradlew getRuntime -Pbranch=java11
./gradlew downloadElasticSearch -Pbranch=java11 [not sure if -Pbranch is required or applicable here, but this gives the below error ]
- Where:
Build file ‘/home/svellingiri/Downloads/moqui/soruce/moqui-framework-java11/runtime/base-component/webroot/build.gradle’ line: 33
- What went wrong:
An exception occurred applying plugin request [id: ‘com.eriwen.gradle.js’, version: ‘2.14.1’]
Failed to apply plugin ‘com.eriwen.gradle.js’.
Could not create an instance of type com.eriwen.gradle.js.JavaScriptExtension.
Could not create an instance of type com.eriwen.gradle.js.source.internal.DefaultJavaScriptSourceSetContainer.
org.gradle.api.internal.AbstractNamedDomainObjectContainer.(Ljava/lang/Class;Lorg/gradle/internal/reflect/Instantiator;)V
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Thanks @jonesde @michael for the pointers, i was able to download moqui-framework & moqui/moqui-runtime individually, checked out java11 branch on the above projects individually, and was able to get java 11 branch to work.
However i still run into the elastic search not starting issue, below is my env configuration
vellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ java -version
openjdk version “11.0.14.1” 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
Below is the error i’m encountering,
18:09:03.216 WARN main o.moqui.i.c.ElasticFacadeImpl Error connecting to ElasticSearch cluster default at http://127.0.0.1:9200, try 1 of 20: org.moqui.BaseException: Error calling HTTP request to http://127.0.0.1:9200/
When i ran ./gradlew startElasticSearch, i get the below, i.e. it is trying to search the jdk under runtime/elasticsearch, Am i missing a path entry for the jdk, just for elasticsearch??
svellingiri@svellingiri-clintu1:~/Downloads/moqui/soruce/moqui-framework-java11$ ./gradlew startElasticSearch
Task :startElasticSearch
Starting ElasticSearch installed in runtime/elasticsearch
could not find java in bundled jdk at /home/svellingiri/Downloads/moqui/soruce/moqui-framework-java11/runtime/elasticsearch/jdk/bin/java
What happens if you go into the runtime/elasticsearch directory and start ES manually, ie with something like “./bin/elasticsearch”?
Another possible issue is you don’t have JAVA_HOME set so ES is looking for an embedded JDK, some ES distros have that so the script looks for it and that would be my guess about where that “could not find” message came from.
1 Like
Thanks @jonesde it was exactly that, after setting JAVA_HOME, elastic search starts fine in master and java11 branch
20:26:29.817 INFO main o.moqui.i.c.ElasticFacadeImpl Connected to ElasticSearch cluster default at http://127.0.0.1:9200 version 7.4.2 earlier than 7.0 false
Also i went back and checked the documentation and this is already captured in the below section and i had overlooked earlier
### ElasticSearch Installed in Runtime
ElasticSearch may be installed in the runtime/elasticsearch directory and run by Moqui when it starts (through MoquiStart only) as well as started, stopped, and data cleaned through various Gradle tasks. In local development environments it is more common to run a local instance of ElasticSearch and clear the data in it along with the H2 database data. This can also be used for production environments where you do not need or want a separate ElasticSearch cluster.
Note that the current support for ElasticSearch installed in runtime/elasticsearch in MoquiStart and Gradle tasks is limited to Unix variants only (ie Linux, MacOS) and uses the OSS no-JDK build for Linux (with no JDK it also works on MacOS). This will not currently work on Windows machines, so if you're doing development on Windows you get to install and manage ElasticSearch separately, just make sure it's available at http://localhost:9200 (or configure elasticsearch_url to point elsewhere).
Make sure that the JAVA_HOME environment variable is set so ElasticSearch knows where to find the Java JDK.