简体   繁体   English

带有Tomcat 8和JDK 8的Openshift DIY类型。JAVAHOME订阅

[英]Openshift DIY cartridige with Tomcat 8 and JDK 8. JAVAHOME subscribe

It is the first time I use OpenShift and am creating an application DIY cartridge with Tomcat Java 8 and 8. 这是我第一次使用OpenShift并使用Tomcat Java 8和8创建应用程序DIY盒式磁带。

I am using 我在用

export JAVA_HOME="${OPENSHIFT_DATA_DIR}jdk1.8.0_51"
export PATH=$JAVA_HOME/bin:$PATH

cd $OPENSHIFT_DATA_DIR/apache-tomcat-8.0.32/bin
./startup.sh

command on my hook action_hook/start to start Tomcat 8 automatically and change the variable JAVA_HOME my application to run the java 8. The command to run the tomcat 8 is working perfectly, but to change the JAVA_HOME variable seems is not working. 我的钩子上的命令action_hook / start自动启动Tomcat 8并更改变量JAVA_HOME我的应用程序运行Java8 。运行tomcat 8的命令运行正常,但是更改JAVA_HOME变量似乎不起作用。

But if I run the command to change the JAVA_HOME variable in my ssh console (Putty) and soon after give the java -version command, it shows that the version is 1.8.x But when I close my shh console, open again and I run the java -version command, it returns the version 1.7.x. 但是,如果我运行命令在ssh控制台(Putty)中更改JAVA_HOME变量,并在发出java -version命令后不久,则表明版本为1.8.x。但是当我关闭shh控制台时,再次打开并运行java -version命令,它将返回版本1.7.x。 Does anyone have any idea what might be happening? 有谁知道会发生什么?

Since the environment variable JAVA_HOME is not set by default when using the DIY cartridge, you should try setting it using the rhc env set ( https://developers.openshift.com/en/managing-environment-variables.html#custom-variables ) command instead of using a script in your action_hooks directory. 由于使用DIY墨盒时默认未设置环境变量JAVA_HOME ,因此您应尝试使用rhc env sethttps://developers.openshift.com/en/managing-environment-variables.html#custom-variables )命令,而不是在action_hooks目录中使用脚本。

Something like: 就像是:

rhc env set JAVA_HOME=/var/lib/openshift/<app-id>/app-root/data/jdk1.8.0_51 -a <appname>

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

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