在JBoss 7中配置MongoDB数据源 [英] Configuring MongoDB datasource in JBoss 7
问题描述
有人知道我如何在JBoss AS 7中配置MongoDB数据源吗?
Does anyone know how I can configure a MongoDB datasource in JBoss AS 7?
我想我可以像以前使用MySQL驱动程序一样,将Mongo驱动程序设置为JBoss中的模块,然后在EAR清单中对此添加依赖项.这是正确的方法吗?
I'm guessing I can set up the Mongo driver as a module in JBoss in the same way as I have done previously with a MySQL driver, then add a dependency to this in the manifest of my EAR. Is this the correct approach?
推荐答案
我找不到关于此的任何文档,但事实证明这很简单.只需下载驱动程序并将其设置为JBoss中的模块,例如此 .
I couldn't find any documentation on this but it turns out to be pretty simple. Just download the driver and set it up as a module in JBoss like this.
然后将一个依赖项添加到您的EAR的META-INF/MANFEST.MF文件中.如果您使用的是Maven,则可以在pom.xml的EAR插件的配置部分中添加类似的内容.
Then add a dependency to the META-INF/MANFEST.MF file of your EAR. If you're using Maven you can add something like this to the configuration section of the EAR plugin in your pom.xml.
<archive>
<manifestEntries>
<Dependencies>com.mongodb</Dependencies>
</manifestEntries>
</archive>
似乎没有必要将其配置为数据源.这就是我已经完成的全部工作,并且可以在日志中看到数据库正在接受连接.
There doesn't seem to be any need to configure it as a data source. This is all I've done and I can see in the logs that the database is accepting connections.
这篇关于在JBoss 7中配置MongoDB数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!