【问题标题】:Anyone got MongoDB java driver working with Xpages?有人有使用 Xpages 的 MongoDB java 驱动程序吗?
【发布时间】:2014-06-30 18:41:19
【问题描述】:

Aynone 让 MongoDB 驱动程序与 Xpages 一起工作?当 MongoDB 客户端尝试连接到其服务器时,我在服务器控制台上收到以下错误。

30.06.2014 20:32:55   HTTP JVM: java.lang.IllegalStateException: NotesContext not initialized for the thread. For more detailed information, please consult
C:/domino/data/domino/workspace/logs
30.06.2014 20:32:55   HTTP JVM: java.lang.IllegalStateException: NotesContext not initialized for the thread. For more detailed information, please consult
C:/domino/data/domino/workspace/logs
30.06.2014 20:32:55   HTTP JVM: Exception in thread "cluster-1-localhost:27017"
30.06.2014 20:32:55   HTTP JVM: java.lang.IllegalStateException: NotesContext not initialized for the thread
30.06.2014 20:32:55   HTTP JVM:        at com.ibm.domino.xsp.module.nsf.NotesContext.getCurrent(NotesContext.java:123)
30.06.2014 20:32:55   HTTP JVM:        at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:383)
30.06.2014 20:32:55   HTTP JVM:        at java.lang.ClassLoader.loadClass(ClassLoader.java:638)
30.06.2014 20:32:55   HTTP JVM:        at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForSignalOrTimeout(ServerMonitor.java:162)
30.06.2014 20:32:55   HTTP JVM:        at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForNext(ServerMonitor.java:143)
30.06.2014 20:32:55   HTTP JVM:        at com.mongodb.ServerMonitor$ServerMonitorRunnable.run(ServerMonitor.java:120)
[12C8:00DF-590C] 30.06.2014 20:32:55   HTTP JVM:        at java.lang.Thread.run(Thread.java:738)

+++ 更新 #1

a) 我将所需的库放入数据库 web-inf\libs 并将它们放在路径上

b) 只有这一行会导致上面的堆栈跟踪

MongoClient client = new MongoClient("localhost",27017);

【问题讨论】:

  • 你把你的代码放在哪里了。你用了什么代码?代码规则
  • 更新了之前的帖子...
  • 你的问题让我试一试并将所有需要的 jar 复制到 'jvm\lib\ext' 文件夹中,它现在可以工作了。有没有办法将 jars 保留为 NSF 的一部分并避免将它们安装在我们通常无法在远程服务器上使用的文件系统上?
  • 创建插件项目并在GitHub上分享

标签: xpages


【解决方案1】:

您的问题似乎与访问权限有关。如果您想将 JAR 作为插件添加而不是将它们放在 jvm/lib/ext 目录中(这很快就会变得一团糟),那么您可以将它们包装在 OSGi 插件中并将其部署到您的服务器/Domino Designer。

6 个月前我遇到了同样的挑战 - 当我想通后,我写了一篇关于如何做到这一点的博客文章(实际上是两个 - 以及如何部署)。您可以在这里查看详细信息:http://www.dalsgaard-data.eu/blog/wrap-an-existing-jar-file-into-a-plug-in/

jar 不是数据库的一部分 - 但您将为数据库启用它们(或为您需要它的每个数据库启用它们 - 因为它们可供所有人使用)。

HTH ;-)

/约翰

【讨论】:

  • 难以置信,但也帮助了我! )
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-03-13
  • 2017-03-10
  • 2016-02-11
  • 2021-04-23
  • 2016-12-07
  • 1970-01-01
  • 2016-07-11
相关资源
最近更新 更多