Updating Play app from JDK 6 to 7 on GAE

懵懂的女人 提交于 2020-01-06 07:48:49

问题


I have been developing a web app using play framework for a while (using eclipse). I was using Play 1.2.3 and JDK6 then I had to change my development environment (new pc) where I use JDK7. My dependencies were:

require:
- play
- play -> crudsiena 2.0.1
- play -> siena 2.0.5
- play -> secure
- play -> gae 1.6
- provided -> opencsv 2.3
- provided -> ddlutils_siena 1.0
- provided -> gae_aws_sdk 1.1.7.1
#- provided -> play 1.2.4
#- provided -> httpclient 4.1.1
#- provided -> httpcore 4.1
repositories: 
- provided: 
   type:       local 
   artifact:   "${application.path}/jar/[module]-[revision].jar" 
   contains: 
     - provided -> * 

After the update I could not get the app running even on my localhost so I started the research. I found out the Play 1.2.3 does not support JDK7, so I changed to 1.2.4. Then I also updated the Siena version to 2.0.7 and I included the following line to my application.conf:

java.source=1.7

I even created a new project with play and copied the necessary files to the new project. I set the proper JAVA_HOME environment variable. The application on my localhost is working fine. however when I update the version on Google App Engine I still get the following error:

Uncaught exception from servlet
java.lang.UnsupportedClassVersionError: controllers/Admin : Unsupported major.minor version 51.0
at com.google.appengine.runtime.Request.process-1921becf6a885374(Request.java)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:174)
at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:118)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:401)
at play.Play.preCompile(Play.java:570)
at play.Play.init(Play.java:299)
at play.server.ServletWrapper.contextInitialized(ServletWrapper.java:77)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:452)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:459)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:701)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:456)
at java.lang.Thread.run(Thread.java:679)

I do realise that it has something to do with the transition from JDK6 to JDK7 however I have no more idea where else to look in order to get the app running on GAE. Additionally the compiler is set to 1.7 in eclipse.

Please help me sort this out with me.


回答1:


To use Java on App Engine, you must use JDK 6: https://developers.google.com/appengine/docs/java/overview

They have an issue for it, in their issue-tracker: http://code.google.com/p/googleappengine/issues/detail?id=6972

Sorry! But I think that you will have to change.

(Note that this is true for now. I suspect that the Google has some sort of upgrade plan, but I haven't heard any announcement of Java 7. They would probably have a limited "trusted tester" program for that, for a significant amount of time before general availability.)



来源:https://stackoverflow.com/questions/12587432/updating-play-app-from-jdk-6-to-7-on-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!