本文介绍了Rjms& ActiveMQ:初始化记录器时发生异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了RRjms软件包,因为我想将消息发送到已经为我设置的ActiveMQ消息队列(称为test).由于Rjms不在CRAN上,因此我使用 R的ActiveMQ软件包中的说明从github安装了它.

I installed R's Rjms package as I want to send messages to an ActiveMQ message queue already set up (called test) for me. As Rjms is not on CRAN, I installed it from github using the directions in ActiveMQ package for R.

但是,我注意到了两件事.安装Rjmsjars时,我收到一条警告,提示No man pages found in package ‘Rjmsjars’.我认为这可能无关紧要,但我想以防万一.

However, I noted two things. When installing Rjmsjars, I received a warning saying No man pages found in package ‘Rjmsjars’. I think this is likely unrelated, but I wanted to include this just in case.

library(devtools)
install_github("cran/Rjmsjars")
install_github("smschauhan/Rjms/src/main/resources/Rjms")    

加载Rjms后,我尝试使用以下代码初始化记录器:

After I load Rjms, I tried to initialize a logger with the following code:

library(Rjmsjars)
library(Rjms)
logger <- initialize.logger('tcp://app1.xxx.xxxxx.net:61616','Q','test')

但是,当我尝试执行此操作时,出现以下错误:

However, when I try to do this, I get the following error:

Error in .jnew("org/math/r/activemq/logger/Producer", url, type, name) : 
      java.lang.ClassNotFoundException

由于错误消息不是很清楚,所以我不确定如何解决.有什么想法吗?

Since the error message isn't very clear, I'm not sure how to fix. Any thoughts on what's going on?

推荐答案

我最终通过wget tarball(而不是通过github)安装软件包,但没有遇到相同的错误.

I ended up installing the packages via wget tarballs rather than via github, and did not encounter the same error.

从命令行:

wget http://cran.r-project.org/src/contrib/Archive/Rjmsjars/Rjmsjars_0.0.1.tar.gz
wget http://cran.r-project.org/src/contrib/Archive/Rjms/Rjms_0.0.5.tar.gz

然后在R交互式终端中:

then within the R interactive terminal:

install.packages('~/Rjmsjars_0.0.1.tar.gz', repos = NULL, type ="source")
install.packages('~/Rjms_0.0.5.tar.gz', repos = NULL, type ="source")

在加载程序包时,我可以初始化记录器并发送消息而没有Java异常:

When loading the package, I am able to initialize a logger and send a message without a Java exception:

library(Rjms)
logger <- initialize.logger('tcp://xxx.xx:61616', 'Q', "test")
send.status<-to.logger(logger, "{xxx: xxx, xxx: .xx}")
send.status
[1] TRUE

这篇关于Rjms&amp; ActiveMQ:初始化记录器时发生异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!