設置,播放1.2.4嗎啡1.2.6a和MongoLab一個MongoDB的(不是通過附加)獲取無效蒙戈的ObjectId在Heroku上,但沒有在本地
UPDATE看爲說明問題的底部。
在Prod和我的本地盒子上運行並播放無誤的頁面。推到heroku和數據庫扔在下面。除了任何數據庫事務,播放工作正常。
2012-03-30T23:17:57+00:00 app[web.1]: Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:27)
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.readMappedField(Mapper.java:501)
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:484)
2012-03-30T23:17:57+00:00 app[web.1]: ... 18 more
2012-03-30T23:17:57+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-30T23:17:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:128)
2012-03-30T23:17:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:122)
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:25)
2012-03-30T23:17:57+00:00 app[web.1]: ... 20 more
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.converters.ObjectIdConverter.decode(ObjectIdConverter.java:28)
2012-03-30T23:17:57+00:00 app[web.1]: at com.google.code.morphia.converters.DefaultConverters.fromDBObject(DefaultConverters.java:129)
我使用長爲我的Id如果有什麼關係呢,玩配置morphia.id.type =長
在這一點上,我堅持。任何幫助,非常感謝。
Application.conf #configure database name。默認值:測試
%prod.morphia.db.name=asdf
%prod.morphia.db.seeds=ds032747.mongolab.com:32747
%[email protected]
%prod.morphia.db.password=bla
%prod.morphia.id.type=Long
這裏是Heroku的Web應用程序堆棧:
2012-03-31T13:14:57+00:00 app[web.1]: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:487)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDBObject(Mapper.java:267)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:66)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:53)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.next(MorphiaIterator.java:48)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.QueryImpl.get(QueryImpl.java:365)
2012-03-31T13:14:57+00:00 app[web.1]: at play.modules.morphia.Model$MorphiaQuery.get(Model.java:1302)
2012-03-31T13:14:57+00:00 app[web.1]: at play.modules.morphia.Model$MorphiaQuery.first(Model.java:1237)
2012-03-31T13:14:57+00:00 app[web.1]: at controllers.DataUserService.find(DataUserService.java:30)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.UserService.find(UserService.java:96)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.providers.UsernamePasswordProvider.doAuth(UsernamePasswordProvider.java:71)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.IdentityProvider.authenticate(IdentityProvider.java:67)
2012-03-31T13:14:57+00:00 app[web.1]: at controllers.securesocial.SecureSocial.authenticate(SecureSocial.java:198)
2012-03-31T13:14:57+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-03-31T13:14:57+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
2012-03-31T13:14:57+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
2012-03-31T13:14:57+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:616)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
2012-03-31T13:14:57+00:00 app[web.1]: at play.server.PlayHandler$NettyInvocation.execute(PlayHandler.java:257)
2012-03-31T13:14:57+00:00 app[web.1]: at play.Invoker$Invocation.run(Invoker.java:278)
2012-03-31T13:14:57+00:00 app[web.1]: at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:235)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:166)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
2012-03-31T13:14:57+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
2012-03-31T13:14:57+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:636)
2012-03-31T13:14:57+00:00 app[web.1]: Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:27)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.readMappedField(Mapper.java:501)
2012-03-31T13:14:57+00:00 app[web.1]: ... 32 more
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:484)
2012-03-31T13:14:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:128)
2012-03-31T13:14:57+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.converters.ObjectIdConverter.decode(ObjectIdConverter.java:28)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.converters.DefaultConverters.fromDBObject(DefaultConverters.java:129)
2012-03-31T13:14:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:122)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:25)
2012-03-31T13:14:57+00:00 app[web.1]: ... 34 more
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDBObject(Mapper.java:267)
2012-03-31T13:14:57+00:00 app[web.1]: 13:14:57,854 ERROR ~ Error authenticating user
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:66)
2012-03-31T13:14:57+00:00 app[web.1]: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:487)
2012-0
3-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.next(MorphiaIterator.java:48)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:53)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.query.QueryImpl.get(QueryImpl.java:365)
2012-03-31T13:14:57+00:00 app[web.1]: at play.modules.morphia.Model$MorphiaQuery.get(Model.java:1302)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.UserService.find(UserService.java:96)
2012-03-31T13:14:57+00:00 app[web.1]: at play.modules.morphia.Model$MorphiaQuery.first(Model.java:1237)
2012-03-31T13:14:57+00:00 app[web.1]: at controllers.DataUserService.find(DataUserService.java:30)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.providers.UsernamePasswordProvider.doAuth(UsernamePasswordProvider.java:71)
2012-03-31T13:14:57+00:00 app[web.1]: at securesocial.provider.IdentityProvider.authenticate(IdentityProvider.java:67)
2012-03-31T13:14:57+00:00 app[web.1]: at controllers.securesocial.SecureSocial.authenticate(SecureSocial.java:198)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
2012-03-31T13:14:57+00:00 app[web.1]: at Invocation.HTTP Request(Play!)
2012-03-31T13:14:57+00:00 app[web.1]: at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
2012-03-31T13:14:57+00:00 app[web.1]: Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:27)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.readMappedField(Mapper.java:501)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:484)
2012-03-31T13:14:57+00:00 app[web.1]: ... 18 more
2012-03-31T13:14:57+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: invalid ObjectId [4]
2012-03-31T13:14:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:128)
2012-03-31T13:14:57+00:00 app[web.1]: at org.bson.types.ObjectId.<init>(ObjectId.java:122)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.converters.ObjectIdConverter.decode(ObjectIdConverter.java:28)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.converters.DefaultConverters.fromDBObject(DefaultConverters.java:129)
2012-03-31T13:14:57+00:00 app[web.1]: at com.google.code.morphia.mapping.ValueMapper.fromDBObject(ValueMapper.java:25)
2012-03-31T13:14:57+00:00 app[web.1]: ... 20 more
奇怪的是,它運行(播放運行 - %PROD)使用相同的mongolab分貝我的盒子,但未能上Heroku的。 Heroku日誌被舍入到第二個 - 沒有太大的幫助。我不知道Heroku是否覆蓋了自定義驅動程序? Heroku有一個MongoLab的「附加」產品,我懷疑這跟它有關係,但那是黑暗中的刺。
我打算用Heroku mongolab附加組件測試一下,看看是否有效。這是一個痛苦,因爲我已經有一個分貝,但值得一試 - 我想。
從heroku上拉下一個克隆,運行play deps --sync,在本地運行沒有錯誤。
看起來像應用程序版本(節點上)this issue可疑。我希望這不是一場瘋狂的追逐。
固定。這筆交易。 Heroku不喜歡我爲至少三個獨立的框架ID設置了本地測試和兩個不同的數據庫提供者的框架ID。其中一個被設置爲我的產品(%prod。)。 Heroku不喜歡這些。消除配置中的所有前綴框架標識符(我必須註釋掉所有其他數據庫)和砰砰聲,就像一個魅力。我認爲heroku需要在他們的配置解析器上工作。
這是eclipse中的Framework ID設置。發現重建我的開發箱後,這個問題再次出現。我注意到,從包含框架參數的命令行運行播放沒有導致錯誤。做了更多的研究,發現Play eclipsify命令覆蓋了構建配置(我的IDE是eclipse)。新生成的配置「VM參數」不包含框架ID值「-Dplay.id =」(它是空白的)。我將此值更改爲「-Dplay.id = dev」,用於我的開發人員,並且Play會正確處理配置。 Heroku在PLAY_OPTS中默認傳遞框架id - %prod,所以現在兩個環境都按預期工作。
爲了其他可能有類似問題的人,我正在更新此問題。我也發現這個評論強化了這個https://stackoverflow.com/a/9211118/1193291
你可以發佈你的application.conf的相關部分嗎? – 2012-03-31 02:07:48
我剛剛更新了morphia conf部分。上面堆棧跟蹤中的「無效ObjectId [4]」是我之前記錄的長ID。任何想法,爲什麼heroku不一樣。我的本地在mongolab上打出完全相同的分貝,沒有錯誤。 – zenoexo 2012-03-31 02:38:25
看起來不錯。你有沒有注意到你的日誌文件中有其他不好的信號? – 2012-03-31 11:42:47