I am working with tomcat 7 on aws linux AMI. I have installed the tomcat 7 and its working fine. Now I need to deploy the eHour webapp in it. I have followed all the procedure given in this documentation.But when I run the ehour app it does not start and following error is thrown.
Caused by: java.io.FileNotFoundException: ${EHOUR_HOME}/conf/ehour.properties (No such file or directory)
also when I do printenv there is no EHOUR_HOME variable in the list.Below is my code for setenv.sh
# Load Tomcat Native Library
LD_LIBRARY_PATH=/opt/bitnami/common/lib:$LD_LIBRARY_PATH
EHOUR_HOME=/home/bitnami/ehour
JAVA_HOME=/opt/bitnami/java
JRE_HOME=$JAVA_HOME
JAVA_OPTS="-Djava.awt.headless=true -XX:+UseG1GC -Dfile.encoding=UTF-8 $JAVA_OPTS "
. "/opt/bitnami/java/bitnami/setenv.sh"
export JAVA_HOME
export JRE_HOME
export JAVA_OPTS
export LD_LIBRARY_PATH
export EHOUR_HOME
If you can please point out my mistake or some other way to declare EHOUR_HOME variable so that tomcat can pick it during its startup.
Thanks
Related
When I use Windows system to set the environment variable program can run normally, change to Linux test, appeared
2022-06-27 12:10:27,814 [pool-6-thread-1] ERROR InfiniteStreamRecognize -
java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:125)
at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:97)
at com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:70)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:168)
at com.google.cloud.speech.v1p1beta1.stub.GrpcSpeechStub.create(GrpcSpeechStub.java:95)
at com.google.cloud.speech.v1p1beta1.stub.SpeechStubSettings.createStub(SpeechStubSettings.java:133)
at com.google.cloud.speech.v1p1beta1.SpeechClient.(SpeechClient.java:134)
at com.google.cloud.speech.v1p1beta1.SpeechClient.create(SpeechClient.java:116)
at com.google.cloud.speech.v1p1beta1.SpeechClient.create(SpeechClient.java:108)
at com.duplicall.ibaeonline.EngineClients.google.InfiniteStreamRecognize.infiniteStreamingRecognize(InfiniteStreamRecognize.java:94)
at com.duplicall.ibaeonline.EngineClients.google.InfiniteStreamRecognize.lambda$StartTrans$0(InfiniteStreamRecognize.java:290)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
does Linux require additional Settings? how can i solved this prolem ?
This problem has been solved, the problem is not the environment variable, it is my program startup script. When I use java -jar to start the program, it works as well as WIN system
This environment:
I have set environment in system
echo $GOOGLE_APPLICATION_CREDENTIALS, Path information can be displayed
cat $GOOGLE_APPLICATION_CREDENTIALS, You can see the content information
I want to deploy my Node.js application in Pivotal Cloud Foundry using manifest.yml. I need to update the PATH variable of the container before the application starts, to include the path of a directory in my application's src directory. Can this be achieved?
manifest.yml:
---
applications:
- name: node-apollo-graphql-server
command: npm start
instances: 1
memory: 512M
buildpack: dicf_nodejs_buildpack_rc
stack: cflinuxfs3
You cannot do this by setting env variables with cf push -e or the env: block in manifest.yml. If you set path using one of these methods, you'll override path when what you likely want to do is append to it.
To append to $PATH, add a file .profile to the root of your project (directory from which you're running cf push). In that file, put one line export PATH=$PATH:<new loc> where <new loc> is the path you want to append to the $PATH env variable.
The .profile file is sourced before your application starts so you can use this to dynamically set environment variables or apply configuration before your application starts up.
The only caveat is that this happens before your application starts so it blocks the starting of your application. As such, you should avoid running expensive/time-consuming processes here. Otherwise, you will delay the start of your application, or possibly even cause app failures if you exceed the startup timeout (cf push -t).
I am implementing Azure Application Insights in Java application. Azure Docs
I have added below configure in standalone.conf JBOSS/WildFly configuration
However when I start the server I am getting below error
[root#server-1 bin]# ./standalone.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/wildfly
JAVA: /usr/lib/jvm/jdk1.8.0_261/bin/java
JAVA_OPTS: -server %JAVA_OPTS% -javaagent:/tmp/azurejar/applicationinsights-agent-2.6.1.jar
=========================================================================
Error: Could not find or load main class %JAVA_OPTS
Could you please help me to resolve this issue ? Any help is much appreciated.
That's Windows syntax. In a Unix-based environment like Linux you use the $ to access environment variables. Change the %JAVA_OPTS% part of the line to $JAVA_OPTS, i.e.:
JAVA_OPTS="$JAVA_OPTS -javaagent:/tmp/lib/applicationinsights-agent-2.6.1.jar"
I am trying to setup ELK stack for my Web Services Log Monitoring.
So I have setup all the parts for ELK Stack.
I am facing one issue in Log-stash. When I am running Log-stash, I am facing error, could not load Java binary
Although the simple fix it set the JAVA_HOME in environment variable.
But I don't want to set an environment variable, but what I want to set JAVA_HOME just for Log-stash. I have tried adding in startup.options, but to enable I must run system-install. When I am running system-install, I am facing the same error again.
I have added
export JAVA_HOME=/opt/jre8
then system-install file runs, but still on starting log-stash, I am getting the same error. What should I do to resolve this error?
You can config in startup.options (logstash5.4 version):
Ex:
JAVA_HOME=/.../jdk1.8.0_121
JAVACMD=/.../jdk1.8.0_121/bin/java
Then use root role to start: system-install.
(You can use update-java-alternatives --list to list installed java versions with paths)
You can add this configuration to the file- /etc/sysconfig/logstash, this file is read during startup by logstash.
This is what you should add:
export JAVA_HOME=/opt/jre8
While running my tomcat the following error is coming .
The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program
Dec 23, 2009 1:03:22 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=1/41 config=null
This is how I set my JAVA_PATH in my bashrc file
export JAVA6_HOME=/home/asharma/Softwares/jdk1.6.0_12
export JAVA_HOME=$JAVA6_HOME
export JPDA_TRANSPORT=dt_socket
export JPDA_ADDRESS=9000
export RESIN_HOME=/home/asharma/Softwares/resin
export PATH JAVA_HOME
export GDK_NATIVE_WINDOWS=1
export CATALINA_HOME=/home/asharma/Softwares/apache-tomcat-6.0.20
export CATALINA_OPTS="-Dcom.sun.management.jmxremote Dcom.sun.management.jmxremote.port=19000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
alias tstart="$CATALINA_HOME/bin/catalina.sh jpda start -Xmx2000m -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false ; tail -f $CATALINA_HOME/logs/catalina.out"
alias tstop="sh $CATALINA_HOME/bin/shutdown.sh"
alias minstall='mvn clean install -Dhttps.proxyHost=monitoring01.hyd.int.untd.com -Dhttps.proxyPort=3128'
alias resin='sh $RESIN_HOME/bin/httpd.sh -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=12345 -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -verbose -DVPS_HOME=/home/asharma/vps -Xms2000m -Xmx2000m'
I had the same problem and this worked for me.
Try this:
Go to the your path-to-tomcat/bin in the terminal
Then execute the command below:
chmod +x *.sh
Then run tomcat using ./startup.sh
For me the problem occurs because I have different versions of apache tomcat installed. In particular, you get this error if you are trying to invoke a newer version of the web-server, with the CATALINE_HOME pointed to an older version. A quick fix, which worked for me, is to set the CATALINA_HOME environment variable to the version you are trying to invoke.
I had this issue in windows 7 with a new installation of tomcat, after about 30 minutes of looking i wanted to see where the error was and opened up the classpath.bat file to see a variable named BASEDIR. I tried all the different things people suggested to no avail. The simple solution i found..
open startup.bat
add
set BASEDIR=d:\tomcat
or whatever your tomcat base folder is to the line right after #echo off (this is the first line in the file)
I solved it using sudo:
sudo ./startup.sh
I have same problem and have resolved it. There is another tomcat and have CATALINA_HOME setting in /etc/profile, when the new tomcat starts, the CATALINA_HOME redirect to old tomcat home, where the new tomcat starting user doesn't have permission to execute.
Just, add the setting "export CATALINA_HOME=" to the new tomcat home at the beginning of the startup.sh script.