问题
Does anyone know how I can configure a MongoDB datasource in JBoss AS 7?
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?
回答1:
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.
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.
来源:https://stackoverflow.com/questions/30535259/configuring-mongodb-datasource-in-jboss-7