When attempting to start Elasticsearch 5.1.1 via
$ elasticsearch
I get the output:
Error: Could not find or load main class -Xms2g
I've looked into:
I read it may be an error in how a class is called? But I'm not exposed to doing that. This thread doesn't help and isn't really my problem as I'm not installing a plugin.
I installed via Homebrew. Here is some output from that:
$ brew info elasticsearch
elasticsearch: stable 5.1.1, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
Conflicts with: elasticsearch#1.7, elasticsearch#2.4
/usr/local/Cellar/elasticsearch/5.1.1 (98 files, 35.2M) *
Built from source on 2016-12-14 at 09:23:56
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
==> Requirements
Required: java >= 1.8 ✔
==> Caveats
Data: /usr/local/var/elasticsearch/elasticsearch_GabbAHH/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_GabbAHH.log
Plugins: /usr/local/Cellar/elasticsearch/5.1.1/libexec/plugins/
Config: /usr/local/etc/elasticsearch/
plugin script: /usr/local/Cellar/elasticsearch/5.1.1/libexec/bin/plugin
To have launchd start elasticsearch now and restart at login:
brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
elasticsearch
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
mongodb
ruby
I also tried originally installing via manually extracting the .tar.gz package. I at first got some Java permission denied errors, but after running a chown to admin for myself I also got this same Error: Could not find or load main class type error.
I just updated my Java JDK to the latest: 1.8.0_112 and set my JAVA_HOME variable to that directory accordingly.
The most recent version of Elasticsearch 2 (2.4.3) works. Meanwhile, Elasticsearch v5.0.2 fails.
What can I do to have Elasticsearch properly installed on my Mac?
Watch out with this line in your .bashrc or similar:
export GREP_OPTIONS='--color=always'
That will break many shell's pipes, so many runners will fail without giving you any clue.
Distros as Ubuntu usually have this enabled by default for system users. Be careful and check that shell environment variable.
This problem was solved on my servers by just unsetting this variable.
You most likely have a problem in your .bash_profile. Usually elastic starts out of the box on a mac.
What I usually do to make upgrading and using multiple projects on my machine is using the following script:
#!/bin/bash
CURRENT_PROJECT=$(pwd)
CONFIG=$CURRENT_PROJECT/config
DATA=$CURRENT_PROJECT/data
LOGS=$CURRENT_PROJECT/logs
BASH_ES_OPTS="-Epath.conf=$CONFIG -Epath.data=$DATA -Epath.logs=$LOGS"
ELASTICSEARCH=$HOME/Development/elastic/elasticsearch/elasticsearch-5.1.1
$ELASTICSEARCH/bin/elasticsearch $BASH_ES_OPTS
Notice the options in BASH_ES_OPTS, these are the ones that changes a lot in version 5. My structure is a folder per project with this script and a few folders: config, data and logs. The config folder contains the files from the elastic distribution: elasticsearch.yml, jvm.properties and log4j2.properties.
Related
I'm struggling with the deployment of a spring app that needs to compile java code during runtime. My app calls the javac command when a user submits a solution to a problem, so it can later run java
I'm deploying to cloud foundry and using the java-buildpack, but unfortunately, it doesn't come with JDK, only JRE is available and that thing has no javac or java commands available.
Do you guys know a way on how to add JDK to cloud foundry, without having to write my own custom buildpack.
Thanks
I would suggest you use multi-buildpack support and use the apt-buildpack to install a JDK. It should work fine alongside the JBP. It just needs to be first in the list.
https://github.com/cloudfoundry/apt-buildpack
Example:
Create an apt.yml.
---
packages:
- openjdk-11-jdk-headless
Bundle that into your JAR, jar uf path/to/your/file.jar apt.yml. It should be added to the root of the JAR, so if you jar tf path/to/your/file.jar you should see just apt.yml and nothing prefixed to it.
Update your manifest.yml. Add the apt-buildpack first in the list.
---
applications:
- name: spring-music
memory: 1G
path: build/libs/spring-music-1.0.jar
buildpacks:
- https://github.com/cloudfoundry/apt-buildpack#v0.2.2
- java_buildpack
Then cf push. You should see the apt-buildpack run and install the JDK. It'll then be installed under ~/deps/0/lib/jvm/java-11-openjdk-amd64. It does not appear to end up on the PATH either, so use a full path to javac or update the path.
I have tried loading the latest versions of GraalVm from the site onto OS/X from : graalvm-ce-java11-darwin-amd64-20.2.0.tar.gz
I tar this bundle, following the instructions and sudo mv the directory to /Libaray/Java/JavaVirtualMachines and setup the .bash_profile per the instructions. If I run the java_home -V command I see the VM there.
When I try to execute any of the command line utilizes from the VM (java, javac, jar, etc.) I get a fault by OS/X saying the application is from an untrusted developer. I then I have to to control panel/security and settings/general and manually select each an every binary and each and every native library one at a time and tell OS/X to add them as an exception to allow them to be run.
Am I missing something or is this expected behavior? Is there a better way to install the graalVM on OS/X?
This is an old issue but maybe it helps:
https://github.com/oracle/graal/issues/1724
I wonder why this has not been fixed yet.
How to solve "Assistive Technology not found" error in Google App Engine openJdk?
I am developing one web app that uses Apache Batik, it works fine in local with jetty and oracle jdk, but when I deploy it to Google-App-Engine and I call my API I get below error.
Caused by: java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at org.apache.batik.bridge.CursorManager.<clinit>(CursorManager.java:102)
at org.apache.batik.bridge.BridgeContext.<init>(BridgeContext.java:1162)
at org.apache.batik.bridge.BridgeContext.<init>(BridgeContext.java:292)
at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:336)
at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:312)
I searched in google people are saying "This can be done by editing the accessibility.properties file for OpenJDK 8"
Comment out the following line:
#assistive_technologies=org.GNOME.Accessibility.AtkWrapper
But I am using google app engine and not sure How can I do that?
Any help will be appreciated.
I solved this by setting System property dynamically.
Properties props = System.getProperties();
props.setProperty("javax.accessibility.assistive_technologies", "");
JDK 9 through JDK 13 suffer from JDK-8216008 -Djavax.accessibility.assistive_technologies empty list leads to exception. Due to legacy behavior, any valid class name that is visible to the system class loader can be used instead of empty string.
Therefore, one way to disable the assistive technologies on all JDK versions is to specify class that does nothing during construction:
-Djavax.accessibility.assistive_technologies=java.lang.Object
On JDK9 and later the Toolkit respects the headless property but this doesn't work on JDK8.
-Djava.awt.headless=true
I was facing the same issue.
My Solution:
Use custom docker image.
Use runtime custom in app.yaml
runtime: custom
Add new file 'Dockerfile' at src/main/docker/Dockerfile
FROM gcr.io/google-appengine/jetty
ADD you_war_fle_name_inside_target_dir $JETTY_BASE/webapps/root.war
WORKDIR $JETTY_BASE
RUN sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties
RUN java -jar $JETTY_HOME/start.jar --approve-all-licenses --create-startd --add-to-start=jmx,stats,hawtio && chown -R jetty:jetty $JETTY_BASE
And then run following command from cloud console.
mvn package -DskipTests appengine:deploy
I noticed that in the targeted SELinux policy for CentOS 7, there is no java.pp file in the
/etc/selinux/targeted/modules/active/modules
directory. Interestingly enough, in the source rpm selinux-policy-3.12.1-153.el7.src.rpm
from http://vault.centos.org, there are java.te, java.if, and java.fc, files, so I tried to get a java.pp by copying them in a seperate folder and running:
make NAME=targeted -f /usr/share/selinux/devel/Makefile
but I get an error 74:ERROR 'unknown type java_domain'and no java.pp file.
Does anyone the state of Java ans SELinux for CentOS 7. I noticed that my CentOS 6.5 servers have a java.pp module available.
Thanks,
greenaj
I just started looking at this myself and found:
https://github.com/TresysTechnology/refpolicy-contrib
Git clone the above and notice java.te, java.if, and java.fc
Try:
make -f /usr/share/selinux/devel/Makefile java.pp
If the make succeeds, load the new module via:
semodule -i java.pp
I actually get a /usr/bin/checkmodule syntax error on java.te,
but I'm trying this on RHEL 6.7 ...
May need to checkout a specific branch for one's OS-release.
Good luck.
I started to use puppet recently, and i'm trying to deploy a web server using gce_compute and apache-tomcat. To deploy the web server i install the modules puppetlabs-java and puppetlabs-tomcat, and to create an instance of apache-tomcat i'm using the code provided by puppet :
class { 'java': }
class { 'tomcat': }
class { 'epel': }->
tomcat::instance { 'default':
install_from_source => false,
package_name => 'tomcat',
}->
tomcat::service { 'default':
use_jsvc => false,
use_init => true,
service_name => 'tomcat',
}
But when my agent pulls the manifest i'm getting this error:
Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install tomcat' returned 100: Reading package lists...
puppet-agent[3302]: Building dependency tree...
puppet-agent[3302]: Reading state information...
puppet-agent[3302]: E: Unable to locate package tomcat
Can you help me to figure out why this happens and how i fix this error. Thanks in advance.
That error comes from apt-get. Puppet uses a package manager available on the system it is running on. In the case of Debian, it uses apt.
If you ran apt-get install tomcat you would get the same error, because there is no package named simply tomcat. Perhaps you mean tomcat6 or tomcat7?
Puppet uses the autoloader (https://docs.puppetlabs.com/puppet/latest/reference/lang_namespaces.html) to find that class, which it is doing correctly since it's running apt to download the package.
The best way to troubleshoot this is to run apt-get install on the version of tomcat you want. You might find you get the same output as you saw from stdout in the puppet output from your agent run. If that's the case, make sure you can reach your apt repos and you have the correct configuration in /etc/apt *.d directories.
check out this https://itsfoss.com/unable-to-locate-package-error-ubuntu/
-> my ubuntu version was 22.04,
to check your ubuntu version: lsb_release -a
tomcat8 was not getting installed so I changed version to tomcat9
and problem got resolved.