简体   繁体   English

CentOS上的人工环境变量

[英]Artifactory environment variables on CentOS

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. 昨晚在最不幸的时间,显然使用了伪像的#65内容消失了。 Java disappeared. Java消失了。 Maybe it was already gone, but the new Linux guys were 'upgrading' the machine, so it's suspicious. 也许它已经不复存在了,但是新的Linux家伙正在“升级”这台机器,因此令人怀疑。

Now, the issue is that artifactory cannot forget about version 65. 现在,问题是工件无法忘记版本65。

If I type in env or set , we're golden. 如果我输入envset ,那么我们很成功。 No mention of v65. 没有提到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 envset节目

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. PATH也是正确的。 ls -l shows ls -l显示

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? 人工用户到底从哪里得到65? 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. 如果我尝试su artifactory ,我将转到bash-4.1$表示传统意义上的人为不是用户,但即使如此,env和set也是正确的。

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. 我编辑了artifactory.default,并将导出的JAVA_HOME放在其中,然后从该文件夹而不是作为服务启动了artifactory。 This will do until the next time the Linux team mess up my server. 这将一直持续到Linux团队下次将我的服务器弄乱为止。

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. 看一下/etc/init.d/artifactory,它是当您调用“服务工件...”时运行的脚本-好像其中的某个东西(可能是源于另一个脚本)正在将JRE_HOME设置为旧版本。

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. 以确保工件用户的环境未将JRE_HOME设置为旧版本。

I had a similar issue after. 我也有类似的问题。 Installed Artifactory 5.3.2 and months later ran a yum update on my Linux server. 已安装Artifactory 5.3.2,几个月后,我的Linux服务器上运行了yum更新。 I saw the msg: "error artifactory tomcat server did not start in 60 seconds" The issue started after a I ran a yum update. 我看到了消息:“错误的tomcat服务器在60秒内未启动”我运行了yum更新后,问题开始了。 The update impacted my version of java as noted below. 如下所述,更新影响了我的Java版本。

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 -> /opt/jfrog/artifactory/tomcat/bin/catalina.sh:第433行:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/bin/ java:没有这样的文件或目录

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

./catalina.sh

artifactory will restart and should show updated JRE_HOME 工件将重新启动,并应显示更新的JRE_HOME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM