【问题标题】:Cygnus JAVA_HOME is not setCygnus JAVA_HOME 未设置
【发布时间】:2015-04-22 20:39:16
【问题描述】:

我安装了 cygnus,当我点击 sudo service cygnus start 时,我得到状态 OK running。

但是日志文件说:

Warning: JAVA_HOME is not set!
+ exec /usr/bin/java -Xmx20m -Dflume.log.file=cygnus.log -cp '/usr/cygnus/conf:/usr/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/libext/*' -Djava.library.path= es.tid.fiware.fiwareconnectors.cygnus.nodes.CygnusApplication -p 8081 -f /usr/cygnus/conf/agent_1.conf -n cygnusagent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/cygnus/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/cygnus/plugins.d/cygnus/lib/cygnus-0.7.1-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

我检查了echo $JAVA_HOME 并得到:

/usr/lib/jvm/java-1.6.0-openjdk.x86_64

我还检查了java -version 并得到:

java version "1.6.0_35"
OpenJDK Runtime Environment (IcedTea6 1.13.7) (rhel-1.13.7.1.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

那么我在这里错过了什么?

我在这里完成了所有这些步骤:

安装 Cygnus

打开一个终端并简单地配置 FIWARE 存储库(如果还没有) 配置并使用您的应用程序管理器来安装 最新版本的 Cy gnus(CentOS/RedHat 示例):

$ sudo cat > /etc/yum.repos.d/fiware.repo

重要提示:

Cygnus 基于 Apache Flume,需要安装 Java SDK。 如果尚未安装,请立即安装:

$ sudo yum install java-1.6.0-openjdk-devel

记得导出 JAVA_HOME 环境变量。如果你 如上所示,现在已经安装了 Java SDK,这将是:

$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64

要永久执行此操作,请编辑 /root/.bash_profile(root 用户)或 /etc/profile(其他用户)。

【问题讨论】:

  • 您在导出 JAVA_HOME 后是否重新启动...?启动 cygnus 后是否执行 echo JAVA_HOME?
  • 是的,我已经重启了,我在 cygnus 启动之前和之后都回显了 JAVA_HOME
  • 你是在同一个终端窗口中执行导出JAVA_HOME和cygnus吗?
  • 我不再执行它,因为我像这样编辑了 /root/.bash_profile:# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64 export PATH=$JAVA_HOME/bin:$PATH "~/.bash_profile" 14L, 254C

标签: fiware fiware-cygnus


【解决方案1】:

尽管有这样的警告消息,但如果未设置 JAVA_HOME,Cygus 将运行,因为 flume-ng(以及派生的 cygnus-flume-ng)脚本会查找 Java:

# find java
if [ -z "${JAVA_HOME}" ] ; then
  warn "JAVA_HOME is not set!"
  # Try to use Bigtop to autodetect JAVA_HOME if it's available
  if [ -e /usr/libexec/bigtop-detect-javahome ] ; then
    . /usr/libexec/bigtop-detect-javahome
  elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ] ; then
    . /usr/lib/bigtop-utils/bigtop-detect-javahome
  fi

  # Using java from path if bigtop is not installed or couldn't find it
  if [ -z "${JAVA_HOME}" ] ; then
    JAVA_DEFAULT=$(type -p java)
    [ -n "$JAVA_DEFAULT" ] || error "Unable to find java executable. Is it in your PATH?" 1
    JAVA_HOME=$(cd $(dirname $JAVA_DEFAULT)/..; pwd)
  fi
fi

【讨论】:

  • 那么 Cygnus 不工作,我应该在某个文件中编辑此代码吗?
  • 我的错,我想说“Cygnus 会运行” :) 另一件事是它为什么不工作(顺便说一句,你找到 stackoverflow.com/questions/29776890/… 中讨论的 Cygnus 日志了吗)
  • 是的,我打开日志以为是这个问题,所以才发这个问题
  • 你能打印那个日志吗?只是为了确认 Cygnus 是否在运行,如果它在运行,试图找出它为什么不工作。谢谢!
  • 我做了,它在页面顶部,它是来自/var/log/cygnus 的 cygnus.log 输出的唯一内容。还是我给你看错了日志?我发送 curl SubscribeContext 时没有打印任何其他内容
猜你喜欢
  • 1970-01-01
  • 2017-02-11
  • 1970-01-01
  • 1970-01-01
  • 2020-08-01
  • 1970-01-01
  • 2020-12-21
  • 2012-02-08
相关资源
最近更新 更多