![]() Version: 9.4.4.v20170414 |
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
When using the Jetty distribution, you will first need to enable the session-store-mongo
module for your Jetty base using the --add-to-start
argument on the command line.
$ java -jar ../start.jar --create-startd INFO : Base directory was modified $ java -jar ../start.jar --add-to-start=session-store-mongo ALERT: There are enabled module(s) with licenses. The following 1 module(s): + contains software not provided by the Eclipse Foundation! + contains software not covered by the Eclipse Public License! + has not been audited for compliance with its license Module: session-store-mongo + The java driver for the MongoDB document-based database system is hosted on GitHub and released under the Apache 2.0 license. + http://www.mongodb.org/ + http://www.apache.org/licenses/LICENSE-2.0.html Proceed (y/N)? y INFO : server transitively enabled, ini template available with --add-to-start=server INFO : sessions transitively enabled, ini template available with --add-to-start=sessions INFO : session-store-mongo initialized in ${jetty.base}/start.d/session-store-mongo.ini INFO : sessions/mongo/address dynamic dependency of session-store-mongo MKDIR : ${jetty.base}/lib/nosql DOWNLD: http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.13.2/mongo-java-driver-2.13.2.jar to ${jetty.base}/lib/nosql/mongo-java-driver-2.13.2.jar INFO : Base directory was modified
Doing this enables the MongoDB Session module and any dependent modules or files needed for it to run on the server.
The example above is running an fresh ${jetty.base}
with nothing enabled.
Because MongoDB is not a technology provided by the Eclipse Foundation, users are prompted to assent to the licenses of the external vendor (Apache in this case).
When the --add-to-start
argument was added to the command line, it enabled the the session-store-mongo
module as well as the sessions
and server
modules, which are required for MongoDB session management to operate..
It also downloaded the needed Mongo-specific jar file and created a directory named ${jetty.base}/lib/nosql/
to house it.
In addition to adding these modules to the classpath of the server it also added several ini configuration files to the start.d
directory of the ${jetty.base}
.
Note
If you have updated versions of the jar files automatically downloaded by Jetty, you can place them in the associated
${jetty.base}/lib/
directory and use the--skip-file-validation=<module name>
command line option to prevent errors when starting your server.
Opening the start.d/session-store-mongo.ini
will show a list of all the configurable options for the MongoDB module:
# --------------------------------------- # Module: session-store-mongo # Enables NoSql session management with a MongoDB driver. # --------------------------------------- --module=session-store-mongo #jetty.session.mongo.dbName=HttpSessions #jetty.session.mongo.collectionName=jettySessions #jetty.session.gracePeriod.seconds=3600 connection-type=address #jetty.session.mongo.host=localhost #jetty.session.mongo.port=27017 #connection-type=uri #jetty.session.mongo.connectionString=mongodb://localhost
Used when utilizing a direct connection to the Mongo server.
Used when utilizing MongoURI for secured connections.
The string defining the MongoURI value, such as mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
.
More information on how to format the MongoURI string can be found in the official documentation for mongo.
Note
You will only use one
connection-type
at a time,address
oruri
. If both are utilized in yoursession-store-mongo.ini
, only the lastconnection-type
configured in the file will be used. By default, theconnection-type
ofaddress
is used.