2016-03-20 4 views
2

Ich versuche, einen JAX-Dienst auf Heroku gehostet aufzurufen, die mit einer Datenbank verbinden und holen einige Datensätze Postgress DB bilden. Wenn ich diese App lokal ausführen es funktioniert gut ich bin in der Lage, die Datensätze zu holen, aber während das gleiche auf Heroku Ergebnisse inErste java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField auf Heroku

läuft
Getting java.lang.ClassNotFoundException: j ava.time.temporal.TemporalField on Heroku 

Dies ist das Fehlerprotokoll dh erzeugt immer

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$1.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$1.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$1.run(ServerRuntime.java:259) 
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal 
.Errors$1.call(Errors.java:271) 
2016-03-20T06:54:27.253190+00:00 app[web.1]: at org.glassfish.jersey.internal 
.Errors$1.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$3.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$1.run 
(URLClassLoader.java:366) 
2016-03-20T06:54:27.253251+00:00 app[web.1]: at java.net.URLClassLoader$1.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$1.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$1.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$1.run(ServerRuntime.java:259) 
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal 
.Errors$1.call(Errors.java:267) 
2016-03-20T06:54:27.253268+00:00 app[web.1]: at org.glassfish.jersey.internal 
.Errors$1.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$3.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) 

Code Verbindung zum Postgress DB:

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); 
+1

java.time.temporal.TemporalField wurde in Java 8 (https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalField.html) enthalten. Es scheint, dass Heroku eine frühere Java-Version installiert hat. – RubioRic

+0

@RubioRic vielen Dank .. es hat gut funktioniert ich habe es auf 1.8 geändert .. können Sie Ihren Kommentar ändern, um zu antworten, damit ich meine Frage schließen kann – rajasekhar

+0

Natürlich. Bitte. :-) – RubioRic

Antwort

Verwandte Themen