Getting invalid Mongo ObjectId on heroku but not locally - mongodb

Setup, Play 1.2.4 with Morphia 1.2.6a and a MongoDB on MongoLab (not via add-on)
UPDATE Look to bottom of question for explanation.
Running on my local box in Prod and play serves pages with no errors. Pushed up to heroku and the database is throwing below. Other than any database transactions, play is working fine.
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)
I am using Long for my Id's if that has anything to do with it, play config morphia.id.type=Long
At this point, I'm stuck. Any help, greatly appreciated.
Application.conf
# configure database name. Default value: test
%prod.morphia.db.name=asdf
%prod.morphia.db.seeds=ds032747.mongolab.com:32747
%prod.morphia.db.username=admin#bla.com
%prod.morphia.db.password=bla
%prod.morphia.id.type=Long
Here is the web app stack from heroku:
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
Strange that it runs (play run --%prod) on my box using the same mongolab db but fails on Heroku. Heroku logs are rounded to the second - not much help. I wonder if Heroku is overriding with custom driver?? Heroku has an "add-on" offering of MongoLab and I suspect that has something to do with it, but that is a stab in the dark.
I'm going to try a test with Heroku mongolab add-on and see if that works. It's a pain since I already have a db, but worth a try - I think.
Pulled down a clone from heroku and ran play deps --sync, ran without errors locally.
Looks suspiciously like this issue with application versions (on node). I hope this is not a wild goose chase.
Fixed. Here's the deal. Heroku does not like framework IDs I have at minimum three separate framework ids set up for local testing and two different db providers. One of them was set to my prod (%prod.). Heroku does not like these. Eliminate all prefixed framework ids on config (I had to comment out all other db's) and bang, works like a charm. I think heroku needs to work on their config parser.
It's the Framework ID setting in eclipse. Found that after rebuilding my development box, that this problem resurfaced. I noticed that running play from the command line with the framework argument included resulted in no errors. Did a bit more research and found that the Play eclipsify command overwrites the build configurations (my IDE is eclipse). The newly generated configurations "VM arguments" do not include a framework id value "-Dplay.id=" (it's blank). I changed this value to "-Dplay.id=dev" for my dev launcher and Play processes the config correctly. Heroku passes the framework id --%prod by default in PLAY_OPTS so now both environments are working as expected.
I'm updating this question for the sake of others who may have a similar issue. I also found this comment that reinforces this https://stackoverflow.com/a/9211118/1193291

It's the Framework ID setting in eclipse.
Found that after rebuilding my development box, that this problem resurfaced. I noticed that running play from the command line with the framework argument included resulted in no errors. Did a bit more research and found that the Play eclipsify command overwrites the build configurations (my IDE is eclipse). The newly generated configurations "VM arguments" do not include a framework id value "-Dplay.id=" (it's blank). I changed this value to "-Dplay.id=dev" for my dev launcher and Play processes the config correctly. Heroku passes the framework id --%prod by default in PLAY_OPTS so now both environments are working as expected.
I'm updating this question for the sake of others who may have a similar issue. I also found this comment that reinforces this https://stackoverflow.com/a/9211118/1193291

I assume this is for Play version 1.
I was experiencing this locally. If anyone else gets this, this will fix it:
play clean
Then restart play.

Related

How to resolve UnsupportedClassVersionError in ktor-server on Heroku

I am new to ktor. I have built a restful API service with ktor and is working well when run locally but after deploying to Heroku, I get the error below and I am lost on how to resolve the issue.
Error: A JNI error has occurred, please check your installation and try again
2022-08-01T00:00:03.922254+00:00 app[web.1]: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/impact/ApplicationKt has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2022-08-01T00:00:03.922349+00:00 app[web.1]: at java.lang.ClassLoader.defineClass1(Native Method)
2022-08-01T00:00:03.922384+00:00 app[web.1]: at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2022-08-01T00:00:03.922539+00:00 app[web.1]: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2022-08-01T00:00:03.922575+00:00 app[web.1]: at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
2022-08-01T00:00:03.922623+00:00 app[web.1]: at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2022-08-01T00:00:03.922664+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2022-08-01T00:00:03.922700+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2022-08-01T00:00:03.922740+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2022-08-01T00:00:03.922774+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2022-08-01T00:00:03.922808+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2022-08-01T00:00:03.922842+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
2022-08-01T00:00:03.922883+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2022-08-01T00:00:03.922922+00:00 app[web.1]: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

Metabase on Heroku - Postgres need to add a role to run migrations

I’m upgrading to latest version with heroku deployed app using the binary from https://github.com/metabase/metabase-deploy per the instructions, but am receiving ERROR: permission denied for relation databasechangelog. Tailed logs are below
2018-04-13T19:34:59.959056+00:00 heroku[web.1]: Starting process with command `HEROKU=true ./bin/start`
2018-04-13T19:35:01.482994+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-04-13T19:35:01.486299+00:00 app[web.1]: Using these JAVA_OPTS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8 -Xmx248m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+IgnoreUnrecognizedVMOptions -Djava.awt.headless=true -Dfile.encoding=UTF-8 --add-opens=java.base/java.net=ALL-UNNAMED --add-modules=java.xml.bind
2018-04-13T19:35:01.539500+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -Dfile.encoding=UTF-8
2018-04-13T19:35:07.709376+00:00 app[web.1]: 04-13 19:35:07 INFO metabase.util :: Loading Metabase...
2018-04-13T19:35:15.571783+00:00 app[web.1]: 04-13 19:35:15 INFO util.encryption :: DB details encryption is DISABLED for this Metabase instance. 🔓
2018-04-13T19:35:15.571795+00:00 app[web.1]: See http://www.metabase.com/docs/latest/operations-guide/start.html#encrypting-your-database-connection-details-at-rest for more information.
2018-04-13T19:35:23.403505+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Starting Metabase in STANDALONE mode
2018-04-13T19:35:23.479490+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Launching Embedded Jetty Webserver with config:
2018-04-13T19:35:23.479494+00:00 app[web.1]: {:port 22224}
2018-04-13T19:35:23.479496+00:00 app[web.1]:
2018-04-13T19:35:23.547747+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: Starting Metabase version v0.28.6 (83e3c0d release-0.28.6) ...
2018-04-13T19:35:23.548089+00:00 app[web.1]: 04-13 19:35:23 INFO metabase.core :: System timezone is 'Etc/UTC' ...
2018-04-13T19:35:24.159004+00:00 heroku[web.1]: State changed from starting to up
2018-04-13T19:35:27.859258+00:00 app[web.1]: 04-13 19:35:27 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...
2018-04-13T19:35:27.861664+00:00 app[web.1]: 04-13 19:35:27 INFO metabase.db :: Verifying postgres Database Connection ...
2018-04-13T19:35:28.044132+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Verify Database Connection ... ✅
2018-04-13T19:35:28.044416+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Running Database Migrations...
2018-04-13T19:35:28.079543+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Setting up Liquibase...
2018-04-13T19:35:28.201705+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Liquibase is ready.
2018-04-13T19:35:28.201963+00:00 app[web.1]: 04-13 19:35:28 INFO metabase.db :: Checking if Database has unrun migrations...
2018-04-13T19:35:44.048862+00:00 app[web.1]: 04-13 19:35:44 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
2018-04-13T19:35:44.052917+00:00 app[web.1]: 04-13 19:35:44 INFO metabase.db :: Migration lock is cleared. Running migrations...
2018-04-13T19:35:57.677299+00:00 app[web.1]: org.postgresql.util.PSQLException: ERROR: permission denied for relation databasechangelog
2018-04-13T19:35:57.677543+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)
2018-04-13T19:35:57.677591+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)
2018-04-13T19:35:57.677695+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
2018-04-13T19:35:57.677725+00:00 app[web.1]: at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
2018-04-13T19:35:57.677754+00:00 app[web.1]: at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
2018-04-13T19:35:57.677790+00:00 app[web.1]: at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
2018-04-13T19:35:57.677822+00:00 app[web.1]: at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:136)
2018-04-13T19:35:57.677852+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement$fn__1839.invoke(jdbc.clj:952)
2018-04-13T19:35:57.677883+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:784)
2018-04-13T19:35:57.678002+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678030+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:724)
2018-04-13T19:35:57.678069+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678097+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement.invokeStatic(jdbc.clj:951)
2018-04-13T19:35:57.678134+00:00 app[web.1]: at clojure.java.jdbc$db_do_execute_prepared_statement.invoke(jdbc.clj:945)
2018-04-13T19:35:57.678163+00:00 app[web.1]: at clojure.java.jdbc$db_do_prepared.invokeStatic(jdbc.clj:983)
2018-04-13T19:35:57.678192+00:00 app[web.1]: at clojure.java.jdbc$db_do_prepared.invoke(jdbc.clj:963)
2018-04-13T19:35:57.678223+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_$execute_helper__1910.invoke(jdbc.clj:1364)
2018-04-13T19:35:57.678253+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1366)
2018-04-13T19:35:57.678331+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1337)
2018-04-13T19:35:57.678368+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invokeStatic(jdbc.clj:1356)
2018-04-13T19:35:57.678402+00:00 app[web.1]: at clojure.java.jdbc$execute_BANG_.invoke(jdbc.clj:1337)
2018-04-13T19:35:57.678443+00:00 app[web.1]: at metabase.db$migrate_up_if_needed_BANG_.invokeStatic(db.clj:169)
2018-04-13T19:35:57.678473+00:00 app[web.1]: at metabase.db$migrate_up_if_needed_BANG_.invoke(db.clj:155)
2018-04-13T19:35:57.678506+00:00 app[web.1]: at metabase.db$migrate_BANG_$fn__4414.invoke(db.clj:258)
2018-04-13T19:35:57.678537+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:741)
2018-04-13T19:35:57.678576+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678604+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:776)
2018-04-13T19:35:57.678628+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678662+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invokeStatic(jdbc.clj:724)
2018-04-13T19:35:57.678692+00:00 app[web.1]: at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:711)
2018-04-13T19:35:57.678734+00:00 app[web.1]: at metabase.db$migrate_BANG_.invokeStatic(db.clj:246)
2018-04-13T19:35:57.678763+00:00 app[web.1]: at metabase.db$migrate_BANG_.invoke(db.clj:227)
2018-04-13T19:35:57.678794+00:00 app[web.1]: at metabase.db$run_schema_migrations_BANG_.invokeStatic(db.clj:381)
2018-04-13T19:35:57.678826+00:00 app[web.1]: at metabase.db$run_schema_migrations_BANG_.invoke(db.clj:376)
2018-04-13T19:35:57.678859+00:00 app[web.1]: at metabase.db$setup_db_BANG_.invokeStatic(db.clj:399)
2018-04-13T19:35:57.678889+00:00 app[web.1]: at metabase.db$setup_db_BANG_.doInvoke(db.clj:392)
2018-04-13T19:35:57.678924+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:421)
2018-04-13T19:35:57.679001+00:00 app[web.1]: at metabase.core$init_BANG_.invokeStatic(core.clj:154)
2018-04-13T19:35:57.679031+00:00 app[web.1]: at metabase.core$init_BANG_.invoke(core.clj:133)
2018-04-13T19:35:57.679059+00:00 app[web.1]: at metabase.core$start_normally.invokeStatic(core.clj:258)
2018-04-13T19:35:57.679088+00:00 app[web.1]: at metabase.core$start_normally.invoke(core.clj:251)
2018-04-13T19:35:57.679118+00:00 app[web.1]: at metabase.core$_main.invokeStatic(core.clj:279)
2018-04-13T19:35:57.679293+00:00 app[web.1]: at metabase.core$_main.doInvoke(core.clj:274)
2018-04-13T19:35:57.679314+00:00 app[web.1]: at clojure.lang.RestFn.invoke(RestFn.java:397)
2018-04-13T19:35:57.679349+00:00 app[web.1]: at clojure.lang.AFn.applyToHelper(AFn.java:152)
2018-04-13T19:35:57.679378+00:00 app[web.1]: at clojure.lang.RestFn.applyTo(RestFn.java:132)
2018-04-13T19:35:57.679413+00:00 app[web.1]: at metabase.core.main(Unknown Source)
2018-04-13T19:35:57.679817+00:00 app[web.1]: 04-13 19:35:57 ERROR metabase.core :: Metabase Initialization FAILED: ERROR: permission denied for relation databasechangelog
2018-04-13T19:35:57.683116+00:00 app[web.1]: 04-13 19:35:57 INFO metabase.core :: Metabase Shutting Down ...
2018-04-13T19:35:57.683752+00:00 app[web.1]: 04-13 19:35:57 INFO metabase.core :: Metabase Shutdown COMPLETE
2018-04-13T19:35:58.184227+00:00 heroku[web.1]: State changed from up to crashed
2018-04-13T19:35:58.075189+00:00 heroku[web.1]: Process exited with status 1
It’s the same issue as http://discourse.metabase.com/t/migration-to-new-server-and-docker-instance/3139 but it’s deployed using Heroku, so I can’t add databasechangelog as a role. Migrating questions and dashboards manually isn’t really an option. Thoughts?
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO databasechangelog;
> ERROR: role "databasechangelog" does not exist.
CREATE ROLE databasechangelog;
> ERROR: permission denied to create role
The error is
ERROR: permission denied for relation databasechangelog
So I think you want to do:
grant all privileges on databasechangelog to <username-metabase-is-using-to-connect>

Play Framework PostgreSQL db.default.username defaulting to linux username

I keep getting errors like this...
app[web.1]: Configuration error: Configuration error[Cannot connect to database [default]]
app[web.1]: at scala.collection.immutable.List.foreach(List.scala:381)
app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "lcnjgrwbmbffwv"
app[web.1]: at play.core.StaticApplication.<init>(ApplicationProvider.scala:55)
app[web.1]: at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:408)
app[web.1]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
app[web.1]: at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
app[web.1]: at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
app[web.1]: at org.postgresql.Driver.makeConnection(Driver.java:410)
app[web.1]: at java.sql.DriverManager.getConnection(DriverManager.java:664)
app[web.1]: at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:363)
app[web.1]: at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:240)
app[web.1]: at java.sql.DriverManager.getConnection(DriverManager.java:247)
app[web.1]: at org.postgresql.Driver.connect(Driver.java:280)
app[web.1]: at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
app[web.1]: at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
app[web.1]: at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
app[web.1]: ... 18 more
heroku[web.1]: Process exited with status 255
Not just in Heroku, but when I run my Play app with a user whose name is different than the default user name in the database.
My Play Framework "application.conf" is like this...
db.default.username="nameOfDatabaseUser"
db.default.password="passOfDatabaseUser"
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://urlofdatabase:5432/name_of_database"
Here's the thing. When my terminal user is named "nameOfDatabaseUser", it works. But when my terminal user has a different name, it connects to the database as the name of the current Linux terminal user.
In the above case it appears that Heroku tried to connect as a user lcnjgrwbmbffwv and there was no user lcnjgrwbmbffwv in the database.
How do I specify the default database username so that it doesn't use my terminal username?
The correct key to specify the user is db.default.user, not db.default.username.

heroku permission denied on netty start

I have deployed a play scala/java web app on heroku that uses an embeded netty server. The Procfile command is web: target/universal/stage/bin/mmbu-timesheets -Dhttp.port=80
Taken from heroku logs:
2015-04-27T13:49:27.160198+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/mmbu-timesheets -Dhttp.port=80`
2015-04-27T13:49:29.321552+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx384m -Xss512k -Dfile.encoding=UTF-8 -Djava.rmi.server.useCodebaseOnly=true
2015-04-27T13:49:29.898379+00:00 app[web.1]: Play server process ID is 3
2015-04-27T13:49:32.549840+00:00 app[web.1]: [[37minfo[0m] application - mongodb connection ds031701.mongolab.com:31701 db->heroku_app36286493
2015-04-27T13:49:33.374954+00:00 app[web.1]: [[37minfo[0m] play - Application started (Prod)
2015-04-27T13:49:33.628067+00:00 app[web.1]: Oops, cannot start the server.
2015-04-27T13:49:33.630568+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:89)
2015-04-27T13:49:33.630523+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$8.apply(NettyServer.scala:92)
2015-04-27T13:49:33.630859+00:00 app[web.1]: at play.core.server.NettyServer$.createServer(NettyServer.scala:206)
2015-04-27T13:49:33.630358+00:00 app[web.1]: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
2015-04-27T13:49:33.630483+00:00 app[web.1]: at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
2015-04-27T13:49:33.630606+00:00 app[web.1]: at scala.Option.map(Option.scala:146)
2015-04-27T13:49:33.630802+00:00 app[web.1]: at play.core.server.NettyServer.<init>(NettyServer.scala:89)
2015-04-27T13:49:33.630898+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:243)
2015-04-27T13:49:33.630941+00:00 app[web.1]: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:238)
2015-04-27T13:49:33.631096+00:00 app[web.1]: at play.core.server.NettyServer$.main(NettyServer.scala:238)
2015-04-27T13:49:33.630975+00:00 app[web.1]: at scala.Option.map(Option.scala:146)
2015-04-27T13:49:33.631150+00:00 app[web.1]: at play.core.server.NettyServer.main(NettyServer.scala)
2015-04-27T13:49:33.633017+00:00 app[web.1]: Caused by: java.net.SocketException: Permission denied
2015-04-27T13:49:33.633065+00:00 app[web.1]: at sun.nio.ch.Net.bind0(Native Method)
2015-04-27T13:49:33.633136+00:00 app[web.1]: at sun.nio.ch.Net.bind(Net.java:437)
2015-04-27T13:49:33.633179+00:00 app[web.1]: at sun.nio.ch.Net.bind(Net.java:429)
2015-04-27T13:49:33.633235+00:00 app[web.1]: at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2015-04-27T13:49:33.633396+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
2015-04-27T13:49:33.633444+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
2015-04-27T13:49:33.633550+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
2015-04-27T13:49:33.633600+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2015-04-27T13:49:33.633643+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2015-04-27T13:49:33.633305+00:00 app[web.1]: at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2015-04-27T13:49:33.633525+00:00 app[web.1]: at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
2015-04-27T13:49:33.633703+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745)
2015-04-27T13:49:34.926567+00:00 heroku[web.1]: Process exited with status 255
2015-04-27T13:49:34.945535+00:00 heroku[web.1]: State changed from starting to crashed
I get "Permission denied" exception. Is there a way to start the netty server in heroku?
I had to let heroky specify the port with
web: target/universal/stage/bin/mmbu-timesheets -Dhttp.port=$PORT
in Procfile

playframework-1.x heroku postgres

I just tried to deployed a play 1.2.4 app to heroku.
The App works great locally, but on heroku i just got some strange errors, as soon as i try to save some data.
2012-07-02T21:26:04+00:00 app[web.1]: Internal Server Error (500) for request POST /players/save
2012-07-02T21:26:04+00:00 app[web.1]:
2012-07-02T21:26:04+00:00 app[web.1]: Oops: UnexpectedException
2012-07-02T21:26:04+00:00 app[web.1]: An unexpected error occured caused by exception UnexpectedException: Unexpected Error
2012-07-02T21:26:04+00:00 app[web.1]:
2012-07-02T21:26:04+00:00 app[web.1]: play.exceptions.UnexpectedException: Unexpected Error
2012-07-02T21:26:04+00:00 app[web.1]: at play.data.validation.ValidationPlugin.beforeActionInvocation(ValidationPlugin.java:59)
2012-07-02T21:26:04+00:00 app[web.1]: at play.plugins.PluginCollection.beforeActionInvocation(PluginCollection.java:594)
2012-07-02T21:26:04+00:00 app[web.1]: at play.mvc.ActionInvoker.invoke(ActionInvoker.java:134)
2012-07-02T21:26:04+00:00 app[web.1]: at Invocation.HTTP Request(Play!)
2012-07-02T21:26:04+00:00 app[web.1]: Caused by: play.exceptions.UnexpectedException: Unexpected Error
2012-07-02T21:26:04+00:00 app[web.1]: at play.db.jpa.JPAPlugin.bind(JPAPlugin.java:84)
2012-07-02T21:26:04+00:00 app[web.1]: at play.plugins.PluginCollection.bind(PluginCollection.java:534)
2012-07-02T21:26:04+00:00 app[web.1]: at play.data.binding.Binder.bind(Binder.java:111)
2012-07-02T21:26:04+00:00 app[web.1]: at play.mvc.ActionInvoker.getActionMethodArgs(ActionInvoker.java:642)
2012-07-02T21:26:04+00:00 app[web.1]: at play.data.validation.ValidationPlugin$Validator.validateAction(ValidationPlugin.java:96)
2012-07-02T21:26:04+00:00 app[web.1]: at play.data.validation.ValidationPlugin.beforeActionInvocation(ValidationPlugin.java:51)
2012-07-02T21:26:04+00:00 app[web.1]: ... 3 more
2012-07-02T21:26:04+00:00 app[web.1]: Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:307)
2012-07-02T21:26:04+00:00 app[web.1]: at play.db.jpa.JPAPlugin.bind(JPAPlugin.java:79)
2012-07-02T21:26:04+00:00 app[web.1]: ... 8 more
2012-07-02T21:26:04+00:00 app[web.1]: Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.doList(Loader.java:2536)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.list(Loader.java:2271)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:274)
2012-07-02T21:26:04+00:00 app[web.1]: ... 9 more
2012-07-02T21:26:04+00:00 app[web.1]: Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = bytea
2012-07-02T21:26:04+00:00 app[web.1]: Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2012-07-02T21:26:04+00:00 app[web.1]: Position: 130
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
2012-07-02T21:26:04+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.doQuery(Loader.java:802)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
2012-07-02T21:26:04+00:00 app[web.1]: at org.hibernate.loader.Loader.doList(Loader.java:2533)
2012-07-02T21:26:04+00:00 app[web.1]: ... 17 more
The App is public accessable here:
https://github.com/phaus/kickster
I also tried to use db evolutions first. It did not work neither.
I found several pages for
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = bytea
but i looks, like the problem is within the Play Framework?
This is a Play Framework bug that has been fixed in Play 1.2.5.