Hi Jean, the BeanManager is a part of CDI which is by default part of glassfish application server. Jetty does not have CDI, so you either have the option of adding CDI / WELD onto your jetty (probably not what you want or you would not have chosen jetty in the first place) or do things without BeanManager: Instead of the code snippet that contains references to BeanManager all you need to do is retrieve your MongoClient connection as a singleton - this is the only reason why I use BeanManager: to retrieve my MongoDB database connection (class 'MongoProvider') as a singleton. Why as a singleton? Because MongoDB java driver does connection pooling on its own by default (default: 100 connections). Your code will work if you do not implement your database connection as a singleton but every instance of your realm will then open its own connection pool thereby depleting your available ports rapidly.
But for testing, you can just hardcode your MongoClient connection into the realm and it will work. Just remember to apply the singleton pattern to your MongoClient before your application goes live. Hope this helps. If not, please feel free to ask. -- View this message in context: http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-tp7579029p7579395.html Sent from the Shiro User mailing list archive at Nabble.com.
