Rjms & ActiveMQ: exception when initializing logger

让人想犯罪 __ 提交于 2019-12-13 01:06:40

问题


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.

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")    

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?


回答1:


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

from the command line:

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

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")

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


来源:https://stackoverflow.com/questions/27296088/rjms-activemq-exception-when-initializing-logger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!