简体   繁体   English

在 Ubuntu 18.04 VM (VirtualBox) 上运行的 Shiny Server 应用程序存在 OpenStreetMaps 问题(Java 错误)

[英]Shiny Server app Running on Ubuntu 18.04 VM (VirtualBox) having issues with OpenStreetMaps (Java error)

I am new to Shiny Server and not well versed in Linux so bear with me.我是 Shiny Server 的新手,不精通 Linux,所以请耐心等待。

I'm running Shiny Server on Ubuntu 18.04, which is a virtual machine (VirtualBox).我在 Ubuntu 18.04 上运行 Shiny Server,这是一个虚拟机 (VirtualBox)。 I am employing the OpenStreetMaps package in my app, which uses the rJava package.我在我的应用程序中使用 OpenStreetMaps 包,它使用 rJava 包。 I had some trouble getting the rJava and OpenStreetMaps packages installed but finally managed after manually installing Java Runtime Environment and Java Development Kit with the terminal commands below:我在安装 rJava 和 OpenStreetMaps 包时遇到了一些麻烦,但最终在使用以下终端命令手动安装 Java 运行时环境和 Java 开发工具包后进行了管理:

* sudo apt update
* sudo apt install default-jre
* sudo apt install default-jdk
* sudo R CMD javareconf
* sudo su - -c "R -e \"install.packages('rJava', repos='https://cran.rstudio.com/')\""
* sudo su - -c "R -e \"install.packages('OpenStreetMap', repos='https://cran.rstudio.com/')\""

All packages are in a global library /usr/local/lib/R/site-library.所有包都在一个全局库 /usr/local/lib/R/site-library 中。

When running the app through Shiny Server the error I get is:通过 Shiny Server 运行应用程序时,我得到的错误是:

ERROR: An error has occurred.错误:发生错误。 Check your logs or contact the app author for clarification.检查您的日志或联系应用程序作者进行澄清。

When running the app through RStudio server I get the following error:通过 RStudio 服务器运行应用程序时,出现以下错误:

Error in .jcall("java/lang/Class", "Ljava/lang/Class;", "forName", cl, : RcallMethod: cannot determine object class .jcall("java/lang/Class", "Ljava/lang/Class;", "forName", cl, 中的错误:RcallMethod: 无法确定对象类

Error in .jfindClass(as.character(class)) : Java Exception .jfindClass(as.character(class))new("jobjRef", jobj = , jclass = "java/lang/Throwable") .jfindClass(as.character(class)) 中的错误:Java Exception .jfindClass(as.character(class))new("jobjRef", jobj = , jclass = "java/lang/Throwable")

Warning: Error in .tryJava: Java classes could not be loaded.警告:.tryJava 中的错误:无法加载 Java 类。 Most likely because Java is not set up with your R installation.很可能是因为您的 R 安装未设置 Java。

Here are some trouble shooting tips:以下是一些故障排除技巧:

  1. Install Java (for mac consider installing java 1.6 from https://support.apple.com/kb/DL1572?locale=en_US )安装 Java(对于 mac 考虑从https://support.apple.com/kb/DL1572?locale=en_US安装 java 1.6)

  2. Run R CMD javareconf in the terminal.在终端中运行 R CMD javareconf。 If you are using Mac OS X >= 10.7 you may want to try R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers instead.如果您使用的是 Mac OS X >= 10.7,您可能想要尝试 R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers。

    188: stop 188:停止

    187: .tryJava 187:.tryJava

    186: openmap 186:开放地图

    185: [/home/amsp/Documents/MobileLab/app.R#326] 185:[/home/amsp/Documents/MobileLab/app.R#326]

    183: .func 183:.func

    180: contextFunc 180:上下文函数

    179: env$runWith 179:环境$runWith

    172: ctx$run 172:ctx$运行

    171: self$.updateValue 171: self$.updateValue

    169: map.latlon 169:地图.latlon

    167: renderPlot [/home/amsp/Documents/MobileLab/app.R#347] 167:renderPlot [/home/amsp/Documents/MobileLab/app.R#347]

    165: func 165:功能

    125: drawPlot 125:绘图

    111: reactive:plotObj 111:反应:plotObj

    95: drawReactive 95:drawReactive

    82: origRenderFunc 82:origRenderFunc

    81: output$plot_map1 81:输出$plot_map1

    1: runApp 1:运行应用

I've tried to run Run R CMD javareconf and it doesn't solve this issue.我试过运行 Run R CMD javareconf 并没有解决这个问题。

Checking Java yields:检查 Java 产量:

java -version版本

openjdk version "11.0.6" 2020-01-14 openjdk 版本“11.0.6” 2020-01-14

OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1) OpenJDK 运行时环境(构建 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)

OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing) OpenJDK 64-Bit Server VM(build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1,混合模式,共享)

javac -version javac -version

javac 11.0.6 javac 11.0.6

I'm wondering if maybe it is a permissions problem?我想知道这是否是权限问题? Any help would be greatly appreciated!任何帮助将不胜感激! Thank you!谢谢!

Turns out the whole thing seems like a versioning issue.事实证明,整个事情似乎是一个版本问题。 OpenStreetMap doesn't seem to like Java 11, but most things are generally compatible with 8. OpenStreetMap 似乎不喜欢 Java 11,但大多数东西通常与 8 兼容。

Reboot the VM to get a clean start and don't try to access either shiny or Rstudio before executing.重新启动 VM 以获得干净的启动,并且在执行之前不要尝试访问 Shiny 或 Rstudio。 Remove Java 11 and install java 8删除 Java 11 并安装 Java 8

sudo apt-get remove openjdk-11*

sudo apt-get install openjdk-8*

sudo R CMD javareconf

sudo service rstudio-server restart

sudo service shiny-server restart

Then accessed Shiny and it worked.然后访问 Shiny 并且它起作用了。

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

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