在 Heroku 上获取 java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField
Getting java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField on Heroku
我正在尝试调用 heroku 上托管的 jax 服务,该服务将连接到数据库并从 postgress 数据库中获取一些记录。当我 运行 这个应用程序在本地工作正常时,我可以获取记录,但是 运行 在 Heroku 上执行相同操作会导致
Getting java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField on Heroku
这是生成的错误日志
2016-03-20T06:54:27.253174+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:57)
2016-03-20T06:54:27.253175+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-03-20T06:54:27.253177+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvo
cationHandlerFactory.java:81)
2016-03-20T06:54:27.253176+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:606)
2016-03-20T06:54:27.253177+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMet
hodDispatcher.java:151)
2016-03-20T06:54:27.253178+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMe
thodDispatcher.java:171)
2016-03-20T06:54:27.253179+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(Jav
aResourceMethodDispatcherProvider.java:195)
2016-03-20T06:54:27.253186+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResource
MethodDispatcher.java:104)
2016-03-20T06:54:27.253187+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
2016-03-20T06:54:27.253188+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
2016-03-20T06:54:27.253189+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
2016-03-20T06:54:27.253189+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.run(ServerRuntime.java:259)
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:271)
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:267)
2016-03-20T06:54:27.253191+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:315)
2016-03-20T06:54:27.253191+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:297)
2016-03-20T06:54:27.253192+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:267)
2016-03-20T06:54:27.253193+00:00 app[web.1]: at org.glassfish.jersey.process.
internal.RequestScope.runInScope(RequestScope.java:318)
2016-03-20T06:54:27.253193+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.process(ServerRuntime.java:236)
2016-03-20T06:54:27.253194+00:00 app[web.1]: at org.glassfish.jersey.server.A
pplicationHandler.handle(ApplicationHandler.java:1010)
2016-03-20T06:54:27.253194+00:00 app[web.1]: at org.glassfish.jersey.servlet.
WebComponent.service(WebComponent.java:373)
2016-03-20T06:54:27.253195+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:382)
2016-03-20T06:54:27.253196+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:345)
2016-03-20T06:54:27.253196+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:220)
2016-03-20T06:54:27.253197+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHolder.handle(ServletHolder.java:698)
2016-03-20T06:54:27.253197+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doHandle(ServletHandler.java:519)
2016-03-20T06:54:27.253198+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:138)
2016-03-20T06:54:27.253199+00:00 app[web.1]: at org.eclipse.jetty.security.Se
curityHandler.handle(SecurityHandler.java:564)
2016-03-20T06:54:27.253199+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doHandle(SessionHandler.java:213)
2016-03-20T06:54:27.253200+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doHandle(ContextHandler.java:1097)
2016-03-20T06:54:27.253201+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doScope(ServletHandler.java:446)
2016-03-20T06:54:27.253241+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doScope(SessionHandler.java:175)
2016-03-20T06:54:27.253243+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doScope(ContextHandler.java:1031)
2016-03-20T06:54:27.253244+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:136)
2016-03-20T06:54:27.253244+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.HandlerWrapper.handle(HandlerWrapper.java:97)
2016-03-20T06:54:27.253245+00:00 app[web.1]: at org.eclipse.jetty.server.Serv
er.handle(Server.java:445)
2016-03-20T06:54:27.253246+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Channel.handle(HttpChannel.java:269)
2016-03-20T06:54:27.253246+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Connection.onFillable(HttpConnection.java:229)
2016-03-20T06:54:27.253247+00:00 app[web.1]: at org.eclipse.jetty.io.Abstract
Connection$ReadCallback.run(AbstractConnection.java:358)
2016-03-20T06:54:27.253248+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
2016-03-20T06:54:27.253248+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.run(QueuedThreadPool.java:532)
2016-03-20T06:54:27.253249+00:00 app[web.1]: at java.lang.Thread.run(Thread.j
ava:745)
2016-03-20T06:54:27.253249+00:00 app[web.1]: Caused by:
2016-03-20T06:54:27.253250+00:00 app[web.1]: java.lang.ClassNotFoundException: j
ava.time.temporal.TemporalField
2016-03-20T06:54:27.253251+00:00 app[web.1]: at java.net.URLClassLoader.run
(URLClassLoader.java:366)
2016-03-20T06:54:27.253251+00:00 app[web.1]: at java.net.URLClassLoader.run
(URLClassLoader.java:355)
2016-03-20T06:54:27.253252+00:00 app[web.1]: at java.security.AccessControlle
r.doPrivileged(Native Method)
2016-03-20T06:54:27.253253+00:00 app[web.1]: at java.net.URLClassLoader.findC
lass(URLClassLoader.java:354)
2016-03-20T06:54:27.253253+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:425)
2016-03-20T06:54:27.253254+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoa
der.loadClass(Launcher.java:308)
2016-03-20T06:54:27.253254+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:358)
2016-03-20T06:54:27.253255+00:00 app[web.1]: at org.postgresql.jdbc.PgConnect
ion.<init>(PgConnection.java:320)
2016-03-20T06:54:27.253256+00:00 app[web.1]: at org.postgresql.Driver.makeCon
nection(Driver.java:406)
2016-03-20T06:54:27.253256+00:00 app[web.1]: at org.postgresql.Driver.connect
(Driver.java:274)
2016-03-20T06:54:27.253258+00:00 app[web.1]: at java.sql.DriverManager.getCon
nection(DriverManager.java:215)
2016-03-20T06:54:27.253257+00:00 app[web.1]: at java.sql.DriverManager.getCon
nection(DriverManager.java:571)
2016-03-20T06:54:27.253258+00:00 app[web.1]: at com.example.MyResource.getCon
nection(MyResource.java:84)
2016-03-20T06:54:27.253261+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:606)
2016-03-20T06:54:27.253259+00:00 app[web.1]: at com.example.MyResource.getIt(
MyResource.java:33)
2016-03-20T06:54:27.253260+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:57)
2016-03-20T06:54:27.253259+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke0(Native Method)
2016-03-20T06:54:27.253260+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-03-20T06:54:27.253262+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMet
hodDispatcher.java:151)
2016-03-20T06:54:27.253261+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvo
cationHandlerFactory.java:81)
2016-03-20T06:54:27.253264+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(Jav
aResourceMethodDispatcherProvider.java:195)
2016-03-20T06:54:27.253263+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMe
thodDispatcher.java:171)
2016-03-20T06:54:27.253264+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResource
MethodDispatcher.java:104)
2016-03-20T06:54:27.253265+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
2016-03-20T06:54:27.253266+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
2016-03-20T06:54:27.253266+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
2016-03-20T06:54:27.253269+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:315)
2016-03-20T06:54:27.253267+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.run(ServerRuntime.java:259)
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:267)
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:271)
2016-03-20T06:54:27.253271+00:00 app[web.1]: at org.glassfish.jersey.process.
internal.RequestScope.runInScope(RequestScope.java:318)
2016-03-20T06:54:27.253270+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:297)
2016-03-20T06:54:27.253270+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:267)
2016-03-20T06:54:27.253274+00:00 app[web.1]: at org.glassfish.jersey.server.A
pplicationHandler.handle(ApplicationHandler.java:1010)
2016-03-20T06:54:27.253272+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.process(ServerRuntime.java:236)
2016-03-20T06:54:27.253275+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:382)
2016-03-20T06:54:27.253276+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:345)
2016-03-20T06:54:27.253275+00:00 app[web.1]: at org.glassfish.jersey.servlet.
WebComponent.service(WebComponent.java:373)
2016-03-20T06:54:27.253276+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:220)
2016-03-20T06:54:27.253280+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHolder.handle(ServletHolder.java:698)
2016-03-20T06:54:27.253281+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doHandle(ServletHandler.java:519)
2016-03-20T06:54:27.253281+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:138)
2016-03-20T06:54:27.253283+00:00 app[web.1]: at org.eclipse.jetty.security.Se
curityHandler.handle(SecurityHandler.java:564)
2016-03-20T06:54:27.253284+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doHandle(SessionHandler.java:213)
2016-03-20T06:54:27.253284+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doHandle(ContextHandler.java:1097)
2016-03-20T06:54:27.253285+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doScope(ServletHandler.java:446)
2016-03-20T06:54:27.253285+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doScope(SessionHandler.java:175)
2016-03-20T06:54:27.253286+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doScope(ContextHandler.java:1031)
2016-03-20T06:54:27.253310+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.HandlerWrapper.handle(HandlerWrapper.java:97)
2016-03-20T06:54:27.253329+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Connection.onFillable(HttpConnection.java:229)
2016-03-20T06:54:27.253287+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:136)
2016-03-20T06:54:27.253330+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
2016-03-20T06:54:27.253325+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Channel.handle(HttpChannel.java:269)
2016-03-20T06:54:27.253330+00:00 app[web.1]: at org.eclipse.jetty.io.Abstract
Connection$ReadCallback.run(AbstractConnection.java:358)
2016-03-20T06:54:27.253331+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.run(QueuedThreadPool.java:532)
2016-03-20T06:54:27.253310+00:00 app[web.1]: at org.eclipse.jetty.server.Serv
er.handle(Server.java:445)
2016-03-20T06:54:27.253376+00:00 app[web.1]: at java.lang.Thread.run(Thread.j
ava:745)
连接到 Postgress 数据库的代码:
Class.forName("org.postgresql.Driver");
URI dbUri = new URI(System.getenv("DATABASE_URL"));
String username = dbUri.getUserInfo().split(":")[0];
String password = dbUri.getUserInfo().split(":")[1];
String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath()+"?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory";
Connection con=DriverManager.getConnection(dbUrl, username, password);
java.time.temporal.TemporalField 被包含在 Java 8 (https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalField.html)
Heroku 似乎安装了以前的 Java 版本。
我正在尝试调用 heroku 上托管的 jax 服务,该服务将连接到数据库并从 postgress 数据库中获取一些记录。当我 运行 这个应用程序在本地工作正常时,我可以获取记录,但是 运行 在 Heroku 上执行相同操作会导致
Getting java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField on Heroku
这是生成的错误日志
2016-03-20T06:54:27.253174+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:57)
2016-03-20T06:54:27.253175+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-03-20T06:54:27.253177+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvo
cationHandlerFactory.java:81)
2016-03-20T06:54:27.253176+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:606)
2016-03-20T06:54:27.253177+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMet
hodDispatcher.java:151)
2016-03-20T06:54:27.253178+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMe
thodDispatcher.java:171)
2016-03-20T06:54:27.253179+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(Jav
aResourceMethodDispatcherProvider.java:195)
2016-03-20T06:54:27.253186+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResource
MethodDispatcher.java:104)
2016-03-20T06:54:27.253187+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
2016-03-20T06:54:27.253188+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
2016-03-20T06:54:27.253189+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
2016-03-20T06:54:27.253189+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.run(ServerRuntime.java:259)
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:271)
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:267)
2016-03-20T06:54:27.253191+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:315)
2016-03-20T06:54:27.253191+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:297)
2016-03-20T06:54:27.253192+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:267)
2016-03-20T06:54:27.253193+00:00 app[web.1]: at org.glassfish.jersey.process.
internal.RequestScope.runInScope(RequestScope.java:318)
2016-03-20T06:54:27.253193+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.process(ServerRuntime.java:236)
2016-03-20T06:54:27.253194+00:00 app[web.1]: at org.glassfish.jersey.server.A
pplicationHandler.handle(ApplicationHandler.java:1010)
2016-03-20T06:54:27.253194+00:00 app[web.1]: at org.glassfish.jersey.servlet.
WebComponent.service(WebComponent.java:373)
2016-03-20T06:54:27.253195+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:382)
2016-03-20T06:54:27.253196+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:345)
2016-03-20T06:54:27.253196+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:220)
2016-03-20T06:54:27.253197+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHolder.handle(ServletHolder.java:698)
2016-03-20T06:54:27.253197+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doHandle(ServletHandler.java:519)
2016-03-20T06:54:27.253198+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:138)
2016-03-20T06:54:27.253199+00:00 app[web.1]: at org.eclipse.jetty.security.Se
curityHandler.handle(SecurityHandler.java:564)
2016-03-20T06:54:27.253199+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doHandle(SessionHandler.java:213)
2016-03-20T06:54:27.253200+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doHandle(ContextHandler.java:1097)
2016-03-20T06:54:27.253201+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doScope(ServletHandler.java:446)
2016-03-20T06:54:27.253241+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doScope(SessionHandler.java:175)
2016-03-20T06:54:27.253243+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doScope(ContextHandler.java:1031)
2016-03-20T06:54:27.253244+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:136)
2016-03-20T06:54:27.253244+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.HandlerWrapper.handle(HandlerWrapper.java:97)
2016-03-20T06:54:27.253245+00:00 app[web.1]: at org.eclipse.jetty.server.Serv
er.handle(Server.java:445)
2016-03-20T06:54:27.253246+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Channel.handle(HttpChannel.java:269)
2016-03-20T06:54:27.253246+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Connection.onFillable(HttpConnection.java:229)
2016-03-20T06:54:27.253247+00:00 app[web.1]: at org.eclipse.jetty.io.Abstract
Connection$ReadCallback.run(AbstractConnection.java:358)
2016-03-20T06:54:27.253248+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
2016-03-20T06:54:27.253248+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.run(QueuedThreadPool.java:532)
2016-03-20T06:54:27.253249+00:00 app[web.1]: at java.lang.Thread.run(Thread.j
ava:745)
2016-03-20T06:54:27.253249+00:00 app[web.1]: Caused by:
2016-03-20T06:54:27.253250+00:00 app[web.1]: java.lang.ClassNotFoundException: j
ava.time.temporal.TemporalField
2016-03-20T06:54:27.253251+00:00 app[web.1]: at java.net.URLClassLoader.run
(URLClassLoader.java:366)
2016-03-20T06:54:27.253251+00:00 app[web.1]: at java.net.URLClassLoader.run
(URLClassLoader.java:355)
2016-03-20T06:54:27.253252+00:00 app[web.1]: at java.security.AccessControlle
r.doPrivileged(Native Method)
2016-03-20T06:54:27.253253+00:00 app[web.1]: at java.net.URLClassLoader.findC
lass(URLClassLoader.java:354)
2016-03-20T06:54:27.253253+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:425)
2016-03-20T06:54:27.253254+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoa
der.loadClass(Launcher.java:308)
2016-03-20T06:54:27.253254+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:358)
2016-03-20T06:54:27.253255+00:00 app[web.1]: at org.postgresql.jdbc.PgConnect
ion.<init>(PgConnection.java:320)
2016-03-20T06:54:27.253256+00:00 app[web.1]: at org.postgresql.Driver.makeCon
nection(Driver.java:406)
2016-03-20T06:54:27.253256+00:00 app[web.1]: at org.postgresql.Driver.connect
(Driver.java:274)
2016-03-20T06:54:27.253258+00:00 app[web.1]: at java.sql.DriverManager.getCon
nection(DriverManager.java:215)
2016-03-20T06:54:27.253257+00:00 app[web.1]: at java.sql.DriverManager.getCon
nection(DriverManager.java:571)
2016-03-20T06:54:27.253258+00:00 app[web.1]: at com.example.MyResource.getCon
nection(MyResource.java:84)
2016-03-20T06:54:27.253261+00:00 app[web.1]: at java.lang.reflect.Method.invo
ke(Method.java:606)
2016-03-20T06:54:27.253259+00:00 app[web.1]: at com.example.MyResource.getIt(
MyResource.java:33)
2016-03-20T06:54:27.253260+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:57)
2016-03-20T06:54:27.253259+00:00 app[web.1]: at sun.reflect.NativeMethodAcces
sorImpl.invoke0(Native Method)
2016-03-20T06:54:27.253260+00:00 app[web.1]: at sun.reflect.DelegatingMethodA
ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-03-20T06:54:27.253262+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.run(AbstractJavaResourceMet
hodDispatcher.java:151)
2016-03-20T06:54:27.253261+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.ResourceMethodInvocationHandlerFactory.invoke(ResourceMethodInvo
cationHandlerFactory.java:81)
2016-03-20T06:54:27.253264+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(Jav
aResourceMethodDispatcherProvider.java:195)
2016-03-20T06:54:27.253263+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMe
thodDispatcher.java:171)
2016-03-20T06:54:27.253264+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResource
MethodDispatcher.java:104)
2016-03-20T06:54:27.253265+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
2016-03-20T06:54:27.253266+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
2016-03-20T06:54:27.253266+00:00 app[web.1]: at org.glassfish.jersey.server.m
odel.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
2016-03-20T06:54:27.253269+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:315)
2016-03-20T06:54:27.253267+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.run(ServerRuntime.java:259)
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:267)
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.call(Errors.java:271)
2016-03-20T06:54:27.253271+00:00 app[web.1]: at org.glassfish.jersey.process.
internal.RequestScope.runInScope(RequestScope.java:318)
2016-03-20T06:54:27.253270+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:297)
2016-03-20T06:54:27.253270+00:00 app[web.1]: at org.glassfish.jersey.internal
.Errors.process(Errors.java:267)
2016-03-20T06:54:27.253274+00:00 app[web.1]: at org.glassfish.jersey.server.A
pplicationHandler.handle(ApplicationHandler.java:1010)
2016-03-20T06:54:27.253272+00:00 app[web.1]: at org.glassfish.jersey.server.S
erverRuntime.process(ServerRuntime.java:236)
2016-03-20T06:54:27.253275+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:382)
2016-03-20T06:54:27.253276+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:345)
2016-03-20T06:54:27.253275+00:00 app[web.1]: at org.glassfish.jersey.servlet.
WebComponent.service(WebComponent.java:373)
2016-03-20T06:54:27.253276+00:00 app[web.1]: at org.glassfish.jersey.servlet.
ServletContainer.service(ServletContainer.java:220)
2016-03-20T06:54:27.253280+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHolder.handle(ServletHolder.java:698)
2016-03-20T06:54:27.253281+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doHandle(ServletHandler.java:519)
2016-03-20T06:54:27.253281+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:138)
2016-03-20T06:54:27.253283+00:00 app[web.1]: at org.eclipse.jetty.security.Se
curityHandler.handle(SecurityHandler.java:564)
2016-03-20T06:54:27.253284+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doHandle(SessionHandler.java:213)
2016-03-20T06:54:27.253284+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doHandle(ContextHandler.java:1097)
2016-03-20T06:54:27.253285+00:00 app[web.1]: at org.eclipse.jetty.servlet.Ser
vletHandler.doScope(ServletHandler.java:446)
2016-03-20T06:54:27.253285+00:00 app[web.1]: at org.eclipse.jetty.server.sess
ion.SessionHandler.doScope(SessionHandler.java:175)
2016-03-20T06:54:27.253286+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ContextHandler.doScope(ContextHandler.java:1031)
2016-03-20T06:54:27.253310+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.HandlerWrapper.handle(HandlerWrapper.java:97)
2016-03-20T06:54:27.253329+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Connection.onFillable(HttpConnection.java:229)
2016-03-20T06:54:27.253287+00:00 app[web.1]: at org.eclipse.jetty.server.hand
ler.ScopedHandler.handle(ScopedHandler.java:136)
2016-03-20T06:54:27.253330+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
2016-03-20T06:54:27.253325+00:00 app[web.1]: at org.eclipse.jetty.server.Http
Channel.handle(HttpChannel.java:269)
2016-03-20T06:54:27.253330+00:00 app[web.1]: at org.eclipse.jetty.io.Abstract
Connection$ReadCallback.run(AbstractConnection.java:358)
2016-03-20T06:54:27.253331+00:00 app[web.1]: at org.eclipse.jetty.util.thread
.QueuedThreadPool.run(QueuedThreadPool.java:532)
2016-03-20T06:54:27.253310+00:00 app[web.1]: at org.eclipse.jetty.server.Serv
er.handle(Server.java:445)
2016-03-20T06:54:27.253376+00:00 app[web.1]: at java.lang.Thread.run(Thread.j
ava:745)
连接到 Postgress 数据库的代码:
Class.forName("org.postgresql.Driver");
URI dbUri = new URI(System.getenv("DATABASE_URL"));
String username = dbUri.getUserInfo().split(":")[0];
String password = dbUri.getUserInfo().split(":")[1];
String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + dbUri.getPath()+"?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory";
Connection con=DriverManager.getConnection(dbUrl, username, password);
java.time.temporal.TemporalField 被包含在 Java 8 (https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalField.html)
Heroku 似乎安装了以前的 Java 版本。