Openshift DIY java

时间:2017-01-05 15:37:52

标签: java openshift

在我的DIY Java中,我在action_hooks start shell中有这个

cd $OPENSHIFT_DATA_DIR

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH

libs="libs"

export LIB=$OPENSHIFT_REPO_DIR$libs

src="src"

export JAVA_FILES=$OPENSHIFT_REPO_DIR$src

export MATCHFACES=$OPENSHIFT_REPO_DIR$src/matchfaces


cd $OPENSHIFT_REPO_DIR

if [[ -z "$OPENSHIFT_INTERNAL_IP" ]]; then export     OPENSHIFT_INTERNAL_IP="$OPENSHIFT_DIY_IP"; fi
if [[ -z "$OPENSHIFT_INTERNAL_PORT" ]]; then export OPENSHIFT_INTERNAL_PORT="$OPENSHIFT_DIY_PORT"; fi

nohup dir $LIB > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 &

nohup javac -classpath .;$LIB/JavaBridge.jar;$LIB/FaceSDK.jar;$LIB/jna.jar $MATCHFACES/*.java > ${OPENSHIFT_DIY_LOG_DIR}/compile.log 2>&1 &

nohup java -classpath  .;$LIB/JavaBridge.jar;$LIB/FaceSDK.jar;$LIB/jna.jar $MATCHFACES/Listener > ${OPENSHIFT_DIY_LOG_DIR}/Listener.log 2>&1 &

但是上面的代码给了我漏掉的拒绝错误。从上面的shell,我试图访问我上传到我的存储库的libs文件夹,该文件夹包含我的java应用程序所需的外部依赖项。任何人都可以解释为什么以及如何摆脱这个错误。

以下错误

  

remote:/var/lib/openshift/586b985a89f5cfe9fa0000bc/app-root/runtime/repo//.openshift/action_hooks/start:line 32:/ var / lib / openshift / 586b985a89f5cfe9fa0000bc / app-root / runtime / repo / libs / JavaBridge.jar:权限被拒绝   remote:/var/lib/openshift/586b985a89f5cfe9fa0000bc/app-root/runtime/repo//.openshift/action_hooks/start:line 32:/ var / lib / openshift / 586b985a89f5cfe9fa0000bc / app-root / runtime / repo / libs / FaceSDK .jar:权限被拒绝

1 个答案:

答案 0 :(得分:0)

自动执行期间,自定义文件夹中的自定义文件似乎未在运行时中获得执行权限。我通过跑步意识到这一点 y libs文件夹中的ls -l

所以我通过启动shell脚本添加此代码来修复此错误。

#!/bin/bash
# The logic to start up your application should be put in this
# script. The application will work only if it binds to
# $OPENSHIFT_DIY_IP:8080
# nohup $OPENSHIFT_REPO_DIR/diy/testrubyserver.rb $OPENSHIFT_DIY_IP $OPENSHIFT_REPO_DIR/diy |& /usr/bin/logshifter -tag diy &


 cd $OPENSHIFT_DATA_DIR

 export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
 export PATH=$JAVA_HOME/bin:$PATH

 libs="libs"

 export LIB=$OPENSHIFT_REPO_DIR$libs

 src="src"

 export JAVA_FILES=$OPENSHIFT_REPO_DIR$src

 export MATCHFACES=$OPENSHIFT_REPO_DIR$src/matchfaces
 # the below is not working
 # export CLASSPATH=$OPENSHIFT_REPO_DIR/bin:$OPENSHIFT_REPO_DIR/libs/FaceSDK.jar:$OPENSHIFT_REPO_DIR/libs/jna.jar:$OPENSHIFT_REPO_DIR/libs/JavaBridge.jar

 cd $LIB

 # Giving read write and execute permissions to JavaBridge.jar for user role
  chmod u+r JavaBridge.jar

 chmod u+w JavaBridge.jar

 chmod u+x JavaBridge.jar

 # Giving read write and execute permissions to JavaBridge.jar for groups role
 chmod g+r JavaBridge.jar

 chmod g+w JavaBridge.jar

 chmod g+x JavaBridge.jar

 # Giving read write and execute permissions to JavaBridge.jar for Others role
 chmod o+r JavaBridge.jar

 chmod o+w JavaBridge.jar

 chmod o+x JavaBridge.jar

# Giving read write and execute permissions to FaceSDK.jar for user role
chmod u+r FaceSDK.jar

chmod u+w FaceSDK.jar

chmod u+x FaceSDK.jar

# Giving read write and execute permissions to FaceSDK.jar for groups role
chmod g+r FaceSDK.jar

chmod g+w FaceSDK.jar

chmod g+x FaceSDK.jar

# Giving read write and execute permissions to FaceSDK.jar for Others role
 chmod o+r FaceSDK.jar

 chmod o+w FaceSDK.jar

 chmod o+x FaceSDK.jar

 # Giving read write and execute permissions to jna.jar for user role
 chmod u+r jna.jar

 chmod u+w jna.jar

 chmod u+x jna.jar

 # Giving read write and execute permissions to jna.jar for groups role
 chmod g+r jna.jar

 chmod g+w jna.jar

 chmod g+x jna.jar

 # Giving read write and execute permissions to FaceSDK.jar for Others role
 chmod o+r jna.jar

 chmod o+w jna.jar

 chmod o+x jna.jar

 nohup ls -l > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 &


 cd $OPENSHIFT_REPO_DIR

 if [[ -z "$OPENSHIFT_INTERNAL_IP" ]]; then export OPENSHIFT_INTERNAL_IP="$OPENSHIFT_DIY_IP"; fi
 if [[ -z "$OPENSHIFT_INTERNAL_PORT" ]]; then export OPENSHIFT_INTERNAL_PORT="$OPENSHIFT_DIY_PORT"; fi

 # nohup dir $LIB > ${OPENSHIFT_DIY_LOG_DIR}/output1.log 2>&1 &

 nohup javac -classpath .;$LIB"/JavaBridge.jar;"$LIB"/FaceSDK.jar;"$LIB"/jna.jar" $MATCHFACES/*.java > ${OPENSHIFT_DIY_LOG_DIR}/compile.log 2>&1 &

nohup java -classpath  .;$LIB"/JavaBridge.jar;"$LIB"/FaceSDK.jar;"$LIB"/jna.jar" $MATCHFACES/Listener > ${OPENSHIFT_DIY_LOG_DIR}/Listener.log 2>&1 &

# nohup java -cp bin test.MyHttpServer >    ${OPENSHIFT_DIY_LOG_DIR}/MyHttpServer.log 2>&1 &