Artifactory environment variables on CentOS - java

I'm going mad.
/usr/lib/jvm/
has
java-1.7.0-openjdk-1.7.0.65.x86_64
java-1.7.0-openjdk-1.7.0.79.x86_64
Last night at the most unfortunate possible time, the contents of #65, which artifactory was apparently using, disappeared. Java disappeared. Maybe it was already gone, but the new Linux guys were 'upgrading' the machine, so it's suspicious.
Now, the issue is that artifactory cannot forget about version 65.
If I type in env or set, we're golden. No mention of v65. But artifactory lives in its own world.
[root#me]# service artifactory check
Checking arguments to Artifactory:
ARTIFACTORY_HOME = /var/opt/jfrog/artifactory
ARTIFACTORY_USER = artifactory
TOMCAT_HOME = /opt/jfrog/artifactory/tomcat
ARTIFACTORY_PID = /var/opt/jfrog/run/artifactory.pid
JAVA_HOME =
JAVA_OPTIONS = -server -Xms512m -Xmx2g -Xss256k -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+UseG1GC
[root#me]# service artifactory start
Starting Artifactory tomcat as user artifactory...
Max number of open files: 32000
Using ARTIFACTORY_HOME: /var/opt/jfrog/artifactory
Using ARTIFACTORY_PID: /var/opt/jfrog/run/artifactory.pid
Using CATALINA_BASE: /opt/jfrog/artifactory/tomcat
Using CATALINA_HOME: /opt/jfrog/artifactory/tomcat
Using CATALINA_TMPDIR: /opt/jfrog/artifactory/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre
Using CLASSPATH: /opt/jfrog/artifactory/tomcat/bin/bootstrap.jar:/opt/jfrog/artifactory/tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /var/opt/jfrog/run/artifactory.pid
env and set shows
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64
JRE_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64/jre
PATH is correct too.
ls -l shows
lrwxrwxrwx 1 root root 34 Jun 24 22:38 java-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.79.x86_64
So it's pointing to the right place. Where in the hell is the artifactory user getting 65 from? If I try su artifactory, i go to bash-4.1$ indicating that artifactory isn't a user in the traditional sense, but even so, env and set are correct.
I finally managed to get it working by compromising.
/opt/jfrog/artifactory/bin
I edited artifactory.default and put my export JAVA_HOME in there, and started artifactory from that folder, instead of as a service. This will do until the next time the Linux team mess up my server.
But anyone know how I can get it running as a service?

Take a look in /etc/init.d/artifactory, which is the script that runs when you call "service artifactory ..." - it looks like something in there (possibly another script that is sourced in) is setting JRE_HOME to the old version.
You could also try
sudo su - artifactory; env | grep JRE
to make sure that the artifactory user's environment doesn't set JRE_HOME to the old version.

I had a similar issue after. Installed Artifactory 5.3.2 and months later ran a yum update on my Linux server. I saw the msg: "error artifactory tomcat server did not start in 60 seconds" The issue started after a I ran a yum update. The update impacted my version of java as noted below.
Verify Error Log
vi /var/opt/jfrog/artifactory/logs/catalina.out
--> /opt/jfrog/artifactory/tomcat/bin/catalina.sh: line 433: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/bin/java: No such file or directory
vi /opt/jfrog/artifactory/tomcat/bin/catalina.sh
export JRE_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
cd /opt/jfrog/artifactory/tomcat/bin/
restart catalina
./catalina.sh
artifactory will restart and should show updated JRE_HOME

Related

hadoop cannot start start-dfs.sh

I'm trying to install Hadoop and run it.
And I'm sure I've installed Hadoop and formatted namenode successfully.
However, when I tried to run start-dfs.sh, I got the error below:
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-wenruo-namenode-linux.out
localhost: /usr/local/hadoop/bin/hdfs: line 304: /usr/local/hadoop/usr/lib/jvm/java-8-oracle/bin/java: No such file or directory
My JAVA_HOME is below:
echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-amd64
My hadoop-env.sh file:
export JAVA_HOME=${JAVA_HOME}
How could Hadoop is still looking for JDK8 as I already set JAVA_HOME to JDK7?
Thank you very much.
In general each Hadoop distribution/version should have a few basic script files that set this JAVA_HOME environment variablesuch as yarn-env.sh file if you have yarn.
Also depending on your hadoop version you might also have the path in your *-site.xml files such as hdfs-site.xml, core-site.xml, yarn-site.xml, mapred-site.xml, and a few others depending on what services you have. It is likely your update to hadoop-env.sh did not regenerate the client configuration files unless you did it through a cluster manager application then redeployed client configuration files.
Sometimes these also I find get to set use the systems bin/java executable. You can use the following command to find out what java your OS has in your bin/ path.
readlink -f /usr/bin/java
/usr/bin/java -version
Did you also update hadoop-env.sh on each node then restart all services to make sure it is picked up again?
Leave it. The problem is resolved.
In hadoop-env.sh, I changed export JAVA_HOME=${JAVA_HOME} to echo $JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64.
It looks like ${JAVA_HOME} doesn't work.

tomcat8 & eclipse mars nightmare

I've tried many different approach for installing a Tomcat server over a Debian jessie distro, for using it as server for an ecplise mars IDE.
The only approach thats works for my debian is to install Tomacat straight from they repo.
And after some little tuning its seems that on localhost:8080 there is what I need (the page that says that tomcat works!).
After that I try to add it on Eclipse with the traditional steps suggested by many tutorial:
-adding xml and web tools support via INSTALL NEW SOFT
-adding the installing path folder to the server etc
Then when I start a new project and i try to add a server trough the "Servers" tab, the wizzard let me to choose the right server/adptor, but then there is some problem.
Instead of this:
I got this:
Where I cant edit the server's name and there a lack of a field, and no hope to hit finish or next. How can I spot where my problem is?
cheers
Don't try to use your installed copy of Tomcat. As has been mentioned in the comments, your normal user lacks ownership of its installed location, and the layout may have been changed by the Debian packaging in ways Eclipse can't predict. Download a tarball from Apache, unpack it, and use that--remember, this is for developing your app, and you should never do that in your production server installation.
You should also check the WTP Tomcat FAQ for other questions you might have.
I found this on ubuntu's forum and with some edit about the version (mine is tomcat 8) works!!!!
Thanks to all that point me in right direction
Here's the way I did it, it keeps the system tomcat and your own
personal tomcat instance separate.
Install tomcat as per normal: sudo apt-get install tomcat7
Install private instance support: sudo apt-get install tomcat7-user
Create local instance in your home folder:
tomcat7-instance-create -p 10080 -c 10005 mytomcat
Note: -p sets the port number (default is 8080) and -c is the control
port (default 8005), we set these so we don't compete with the main
installation of tomcat running as a service. "mytomcat" can be
anything you like, but it will create a directory by this name in your
home.
Now use the following to make Eclipse happy:
cd mytomcat
ln -s /usr/share/tomcat7/lib
ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
ln -s /usr/share/tomcat7/bin/bootstrap.jar bin/bootstrap.jar
ln -s /usr/share/tomcat7/bin/tomcat-juli.jar bin/tomcat-juli.jar
mkdir -p common/classes;
mkdir -p server/classes;
mkdir -p shared/classes;
Now within Eclipse you can create a Tomcat v7.0 server and set the
installation directory as ~/mytomcat.
Note: common, server and shared classes could be links too, but I
wanted to keep the two separate.

Why JAVA_HOME not recognized by tomcat7 in Ubuntu?

I have installed tomcat7 on my Ubuntu machine. When I try to restart the server I get message to set JAVA_HOME but it is set in .bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export CATALINA_HOME=/usr/share/tomcat7
Error:
omkars#<ubuntu_14.04>:~$ sudo service tomcat7 restart
[sudo] password for omkars:
* no JDK or JRE found - please set JAVA_HOME
omkars#<ubuntu_14.04>:~$ echo $JAVA_HOME
/usr/lib/jvm/java-8-oracle
What could be missing ?
Thanks.
Now, its working!
Changes I have done are:
changed .bashrc as explained in the question.
changed /etc/init.d/tomcat7 to point to oracle Java8 which is missing here!
JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-7-oracle **/usr/lib/jvm/java-8-oracle**"
Then,
root#omkars-Dell-System-Inspiron-N4110:~# sudo service tomcat7 restart
* Starting Tomcat servlet engine tomcat7 [ OK ]
Got a hint from this page:
https://mifosforge.jira.com/wiki/display/MIFOSX/Install+Tomcat+7+on+Ubuntu+11.10+for+Mifos+X
Thanks
It seems like the preferred way of handling this is to uncomment the JAVA_HOME entry in /etc/default/tomcat7 and adjust the path accordingly. If you're using the webupd8 repository with the oracle-java8-installer, it's JAVA_HOME=/usr/lib/jvm/java-8-oracle.
It'll need to be set for the user that runs the tomcat service, rather than for your user.
Set it in the system wide profile, somewhere in /etc/profile or /etc/profile.d/, depending on how your machine is configured.
The startup script at /etc/init.d/tomcat7 sources the file /etc/default/rcS before searching for some well-known install locations.
Adding the line JAVA_HOME=/usr/lib/jvm/java-8-oracle to /etc/default/rcS corrects the no JDK or JRE found startup problem without directly modifying the /etc/init.d/tomcat7 script.
You can set an environmental variable in the setenv.sh script. According to the Running The Apache Tomcat 7.0 document:
Apart from CATALINA_HOME and CATALINA_BASE, all environment variables can
be specified in the "setenv" script. The script is placed either into
CATALINA_BASE/bin or into CATALINA_HOME/bin directory and is named
setenv.bat (on Windows) or setenv.sh (on *nix).
So just add the following line to setenv.sh:
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
This way you are setting the variable locally.
I have that same problem but I solve it by changing
JDK_DIR variable in /etc/init.d/tomcat as follow :
JDK_DIRS="/usr/lib/jvm/default-java ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-8-oracle"
Try install Java using the repository of http://www.webupd8.org .
This is for Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

Unable to install new relic on linux using tomcat server

I have created account on new relic and downloaded zip for new relic agent and uploaded to /etc directory in my linux machine(tomcat server).
As per documentations, I follow the following code
cd /etc/newrelic
java -jar newrelic.jar install
But I am getting following error:
Dec 31, 2013 06:14:04 +0000 NewRelic 1 INFO: Agent is using Logback
***** ( ( o)) New Relic Java Agent Installer
***** Installing version 3.2.3 ...
Could not edit start script because:
.:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /etc
Try re-running the install command with the -s <AppServerRootDirectory> option or from <AppServerRootDirectory>/newrelic.
If that doesn't work, locate and edit the start script manually.
No need to create New Relic configuration file because:
.:. A config file already exists: /etc/newrelic/newrelic.yml
***** Install incomplete
***** Next steps:
For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java
Can anyone give me solution for this?
As the log information provide that it Could not locate a Tomcat, you need to provide env var like TOMCAT_HOME and so on.
In linux, even if you have installed some software, it can not be conveniently used without adding into PATH or some other env var.
In your situation, seems you need to add TOMCAT_HOME and export it.
Make sure the tomcat is correctly installed!
I was dealing with the same error, you only need to copy the new-relic.jar file inside the root of your tomcat server and then type:
java -jar new-relic.jar install
And that's it, it worked for me. Hope it helps
I work in support at New Relic, specializing in the Java agent.
Since Tomcat installations vary between Linux environments, your best bet is to follow the manual installation instructions:
https://docs.newrelic.com/docs/java/java-agent-manual-installation
Scroll down to the Tomcat instructions, which advise you to add the -javaagent flag to your Tomcat startup script. Once you've made that change and started your Tomcat instance, you can verify that the newrelic.jar is included in the startup arguments by issuing a ps -ef | grep java command.
If you need further help, please open a support ticket at support.newrelic.com and we'll be glad to assist.
Before installing the New Relic the code will fetch the requisite environment parameters like JAVA_HOME, TOMCAT_HOME, etc ( depends on your configuration) and then install the agent on your server. Make sure all the required env variables are defined.
After you have done the above, also check the following:
a) The New Relic should be extraced/installed in your home directory ( in my case /APP)
cd /APP
Unzip newrelic-java-3.26.1.zip –d /APP
b) The Java agent should be defined in the local properties file ( I have configured it for Hybris server in Dev environment)
vim /APP/hybris/config/local.properties
Add : -javaagent:/APP/newrelic/newrelic.jar –D newrelic.environment=Development
c) In some cases, it requirs the application specific yml file along with the newrelic.yml file ( in my case hybris.yml)
Cd /APP/newrelic
mkdir extensions
chmod 755 extensions
cd /APP/newrelic/extensions
vim hybris.yml
Hybris specific configuration for the hybris.yml file ( use jmx.yml)
Add the jmx.yml data in the hybris.yml after creating the file.
d) Restart your application:
I did it using the following commands:
cd /APP/hybris/bin/platform
ant clean all
e) You should see the data in sometime. Keep monitoring the new relic logs in:
tail -f /APP/newrelic/logs/newrelic_agent.log
Before you do any of these steps, make sure that your new relic folder is in inside the folder of your server. That immediately fixed my problem.
The folder newrelic belongs to /usr/share/tomcat/. At least on Ubuntu 16.04 with Tomcat 7. Then also the install command works. Please do not forget to read and adapt the whole newrelic.yml file.

Glassfish server open source addition failed to install

i got the following error when i tried to install GlassFish Server glassfish-3.1.2.2-windows().exe
Executing command :C:\glassfish3\glassfish\bin\asadmin.bat --user admin --passwordfile - create-domain --savelogin --checkports=false --adminport 4646 --instanceport 7070 --domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920 domain1
C:\glassfish3\glassfish\bin\asadmin.bat --user admin --passwordfile - create-domain --savelogin --checkports=false --adminport 4646 --instanceport 7070 --domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920 do main1 The system cannot find the path specified.
print screen of error is following
I just ran into this same problem and it appears to be created by the batch files asadmin.bat and asenv.bat. The batch files read as follows (I've removed the REM statements and lines that didn't pertain to the problem:
asadmin.bat in c:\glassfish3\glassfish\bin
REM Always use JDK 1.6 or higher
REM Depends on Java from ..\config\asenv.bat
call "%~dp0..\config\asenv.bat"
if "%AS_JAVA%x" == "x" goto UsePath
set JAVA="%AS_JAVA%\bin\java"
goto run
:UsePath
set JAVA=java
:run
%JAVA% -jar "%~dp0..\modules\admin-cli.jar" %*
asenv.bat in c:\glassfish3\glassfish\conf
set AS_JAVA=C:\Program Files (x86)\Java
I could not figure out how to get Glassfish to just use the environment variable during install. I attempted to use the -j "(javapath)" argument, but this didn't solve the problem for me.
What worked, and I'm not proud of this solution, is to give Glassfish what it's looking for. If you put together the path its constructing above, you get C:\Program Files (x86)\Java\bin\java.exe. Since Java installs to C:\Program Files (x86)\Java\jre7\bin\java.exe, I simply copied the contents of C:\Program Files (x86)\Java\jre7\ to C:\Program Files (x86)\Java\ and Glassfish installed correctly.
If someone else has a better solution to this problem, PLEASE post it!
Full Disclosure:
Installing Glassfish 3.1.2.2 on Windows Server 2008, running on a VM.
Update: A co-worker of mine came up with a different solution that doesn't involve copying the contents of C:\Program Files(x86)\java\jre7.
During the Glassfish install, at the point where it's requesting a password for the admin account, edit the asenv.bat file and add the "jre7\" to the line I quoted above. This forces Glassfish to look in the proper folder.

Categories