How to resolve UnsupportedClassVersionError in ktor-server on Heroku - rest

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)

Related

com.mongodb.MongoSocketOpenException: Exception opening socket on Heroku

I have a deployed Springboot server on heroku that runs like its supposed to except mlab will not create a connection. The weird thing is that it worked one time, but I had to restart the server, and it never connected again. I recreated the issue locally by trying to start the server without starting mongodb. The error I get is
2017-05-24T13:10:56.522858+00:00 app[web.1]:
2017-05-24T13:10:56.522859+00:00 app[web.1]: com.mongodb.MongoSocketOpenException: Exception opening socket
2017-05-24T13:10:56.522860+00:00 app[web.1]: at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.2.jar!/:na]
2017-05-24T13:10:56.522861+00:00 app[web.1]: at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.2.jar!/:na]
2017-05-24T13:10:56.522862+00:00 app[web.1]: at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.2.jar!/:na]
2017-05-24T13:10:56.522863+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522863+00:00 app[web.1]: Caused by: java.net.ConnectException: Connection refused (Connection refused)
2017-05-24T13:10:56.522865+00:00 app[web.1]: at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522865+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522866+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522867+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522867+00:00 app[web.1]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522868+00:00 app[web.1]: at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_121-heroku16]
2017-05-24T13:10:56.522869+00:00 app[web.1]: at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.2.jar!/:na]
2017-05-24T13:10:56.522869+00:00 app[web.1]: at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.2.jar!/:na]
2017-05-24T13:10:56.522871+00:00 app[web.1]: ... 3 common frames omitted
I am using spring.data.mongodb.uri=${MONGODB_URI} to pull the mongo uri, but I am having no luck at all. I've been trying to get this to connect for two days not with only one successful connection for some weird reason. Any recommendations would be greatly appreciated.

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

Play Framework and Ebean: Error in trying to obtain a connection

I have an Akka thread in my Play Framework application (hosted on Heroku) that gets called every 10 minutes. In this thread I access many models in my database in quick succession. After compiling and starting the application this thread runs fine for a few hours. Eventually (and for reasons unknown) the logger returns this:
c.j.b.PoolWatchThread - Error in trying to obtain a connection
My DB configuration (Heroku's PostgreSQL Basic plan) looks like this:
db.default.user=USER
db.default.password=PASS
db.default.jndiName=DefaultDS
db.default.driver=org.postgresql.Driver
db.default.url=URL
db.default.partitionCount=2
db.default.maxConnectionsPerPartition=5
db.default.minConnectionsPerPartition=5
db.default.acquireIncrement=1
db.default.acquireRetryAttempts=1
db.default.acquireRetryDelay=5 seconds
db.default.maxConnectionAge=1 hour
db.default.idleMaxAge=10 minute
I have adjusted these variables without solving the problem.
Here is the stack trace
2013-08-11T21:53:29.304108+00:00 app[web.2]: [error] c.j.b.PoolWatchThread - Error in trying to obtain a connection. Retrying in 5000ms
2013-08-11T21:53:29.304108+00:00 app[web.2]: org.postgresql.util.PSQLException: FATAL: too many connections for role "[DB USER NAME]"
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:469) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:112) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) ~[postgresql-9.1-901.jdbc4.jar:na]
2013-08-11T21:53:29.304108+00:00 app[web.2]: at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) ~[postgresql-9.1-901.jdbc4.jar:na]
I have a hunch it could be something to do with how and when I query the DB for the models. Like, maybe the connections are not released? Help is appreciated.
Edit:
More from the logger
2013-08-13T14:43:49.257852+00:00 app[web.1]: javax.persistence.PersistenceException: java.sql.SQLException: Timed out waiting for a free available connection.
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.transaction.TransactionManager.createQueryTransaction(TransactionManager.java:368)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.DefaultServer.createQueryTransaction(DefaultServer.java:2060)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.OrmQueryRequest.initTransIfRequired(OrmQueryRequest.java:181)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1501)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:904)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at com.avaje.ebeaninternal.util.DefaultExpressionList.findList(DefaultExpressionList.java:177)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at models.Person.findByHandle(Person.java:85)
2013-08-13T14:43:49.257852+00:00 app[web.1]: at models.NapalmJob.run(NapalmJob.java:41)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at models.NapalmActor.onReceive(NapalmActor.java:9)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.actor.ActorCell.invoke(ActorCell.scala:386)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.Mailbox.run(Mailbox.scala:212)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
2013-08-13T14:43:49.258049+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
2013-08-13T14:43:49.258200+00:00 app[web.1]: Caused by: java.sql.SQLException: Timed out waiting for a free available connection.
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at play.db.ebean.EbeanPlugin$WrappingDatasource.getConnection(EbeanPlugin.java:146)
2013-08-13T14:43:49.258200+00:00 app[web.1]: at com.avaje.ebeaninternal.server.transaction.TransactionManager.createQueryTransaction(TransactionManager.java:338)
2013-08-13T14:43:49.258200+00:00 app[web.1]: ... 18 more
Queries are being formed but are not executed... Could some queries be taking longer to finish then others and thus not releasing the resources?
This answer may help:
Heroku POSTGRESQL - "Too many connections for role" error
Also, are you overriding Play's default settings?

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.

Getting invalid Mongo ObjectId on heroku but not locally

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.