作者may031556 (小龍蝦)
看板R_Language
標題[問題] shiny server連線postgre資料庫出現錯誤
時間Wed May 15 21:24:11 2019
[問題類型]:
經驗諮詢(我想在shiny server 連 postgre資料庫)
[軟體熟悉度]:
使用者(使用R三年)
[問題敘述]:
在R server的shinyapp能以RJDBC連線postgre資料庫
但shiny server使用相同shinyapp卻無法載入頁面
並在左下角出現disconnected from the server的提示框
執行錯誤訊息:
Warning: Error in .jfindClass: java.lang.ClassNotFoundException 54: nonymousErro
Java.lang.ClassNotFoundExceptionshiny-server-client.min.js:1 The application une
Diagnostic information has been dumped to the JavaScript error console.
懷疑過沒有java環境變數沒有設定好、shiny沒有指定到正確java版本、jar版本問題
依下文的環境敘述來看
jar版本跟java版本的路徑看起來沒問題
有試過不同版本的.jar檔
postgresql-42.2.5.jar
postgresql-42.2.5.jre6.jar
postgresql-42.2.5.jre7.jar
但仍無法正確執行 故排除jar版本問題
請問各位
如何能在shinyServer成功執行這app呢?
謝謝
[程式範例]:
#以下截取server.R出現錯誤的程式碼
library(shiny)
library(RJDBC)
#跑這一行會出現錯誤
drv=RJDBC("org.postgresql.Driver","/home/myhome/postgresql-42.2.5.jar")
shinyServer(
…省略…
)
[環境敘述]:
centos7
x64
#使用java -version 查java版本
openjdk version "1.8.0_212"
openJDK Runtime Environment (build 1.8.0_212-b4)
openJDK 64-bit Server VM (build 25.212.-b04, mixed mode)
#以Sys.getenv("LD_LIBRARY_PATH")查詢shiny server的環境變數
輸出結果:
/user/lib64/R/lib:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.e17_6.x86_64/jre/lib/amd64/server
[關鍵字]:
shiny server, RJDBC
-----
Sent from JPTT on my HTC_U-3u.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.166.122.106
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1557926653.A.015.html
※ 編輯: may031556 (218.166.122.106), 05/15/2019 21:25:14
→ obarisk: RPostgres, RPostgreSQL不好嗎 05/15 23:44
因為常連線的資料庫不只postgre(greenplum)
還有Oracle
而RJDBC兩者都可以連
所以沒有用這兩種套件
另外 會懷疑跟java有關的原因是
只用rJava的函數 也會出現同樣的錯誤
→ obarisk: 你把shiny server的debug打開 05/15 23:48
→ obarisk: 我覺得是權限問題 05/15 23:48
請問怎麼開shiny server 的debug?有網頁可以參考嗎?
※ 編輯: may031556 (218.166.122.106), 05/15/2019 23:50:11
※ 編輯: may031556 (218.166.122.106), 05/15/2019 23:54:43
→ asdfrtg: shiny後端有個log 05/16 07:14