Hi,
I've got a Grails project successfully writing to and reading a MongoDB locally, but when I deploy it to CloudFoundry I get authentication issues, specifically:
It's a Grails project, with the mongodb 1.0M5 plugin installed. I'm using the low-level API since I don't need ORM (at present).Code:com.mongodb.MongoException: unauthorized db:getyouthere lock type:-1 client:172.30.50.16
Locally, everything is fine. I can write and read documents to MongoDB, with the following code (stripped down):
Code A - Write
Code B - ReadCode:def mongo def getDocs() { def col = mongo.getDB("dbname")["colname"] def q = [sid: s.id.toInteger()] def o = [ sid: 1, name: 'Hello world' ] col.update(q, o, true, false) }
I have no changes to any config files.Code:def mongo def getDocs() { def col = mongo.getDB("dbname")["colname"] return col.findOne() }
However, when I deploy this to CloudFoundry, I appear to be able to run Code A successfully, but not Code B. At least I get the above exception when I run code B, but not code A. Code A runs without exceptions, although I can't check that anything was actually written since I can run code B.
I've tried installing the CloudFoundry plugin and seeing if the <cloud:mongo/> tag would work, but to be honest I got more errors that way and the app would start at all. I've also tried manually authenticating with the database using the environment variables, but that didn't change anything. I've also tried using the GORM features of the plugin but got errors that way too. I feel like Tantalus always nearly reaching my goal but never quite getting there
It's a little frustrating because, owing to Grails's wonderfulness, I wrote my app in about 4 hours and have spent 4 days trying to deploy it to CLoudFoundry. I appreciate CF is still in early stages, but I get the feeling other people are having more luck than me.
Anyone have any ideas? I can supply more info if it helps.
Many thanks
Digby



Reply With Quote