在GAE上将Play应用从JDK 6更新到7 [英] Updating Play app from JDK 6 to 7 on GAE

查看:88
本文介绍了在GAE上将Play应用从JDK 6更新到7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用play framework开发一个web应用程序(使用eclipse)。我使用的是Play 1.2.3和JDK6,然后我不得不改变我使用JDK7的开发环境(新电脑)。
我的依赖关系是:

$ p $ require:
- play
- play - > crudsiena 2.0.1
- play - >锡耶纳2.0.5
- play - >安全
- 播放 - > gae 1.6
- 提供 - > opencsv 2.3
- provided - > ddlutils_siena 1.0
- 已提供 - > gae_aws_sdk 1.1.7.1
# - 提供 - >玩1.2.4
# - 提供 - > httpclient 4.1.1
# - 提供 - > httpcore 4.1
存储库:
- 提供:
类型:local
工件:$ {application.path} / jar / [module] - [revision] .jar
包含:
- 提供 - > *

更新后,我甚至无法在本地主机上运行该应用程序,因此我开始了研究。我发现Play 1.2.3不支持JDK7,所以我改为1.2.4。然后,我还将Siena版本更新到2.0.7,并将以下代码行添加到了我的application.conf文件中:

  java.source = 1.7 

我甚至用play创建了一个新项目并将必要的文件复制到新项目中。
我设置了适当的JAVA_HOME环境变量。我的本地主机上的应用程序工作正常。但是,当我更新Google App Engine上的版本时,我仍然收到以下错误:

 从servlet获取未捕获的异常
java .lang.UnsupportedClassVersionError:控制器/管理:不支持的版本MAJOR.MINOR 51.0
。在com.google.appengine.runtime.Request.process-1921becf6a885374(Request.java)
。在java.lang.ClassLoader.defineClass1 (本机方法)
。在需要java.lang.ClassLoader.defineClass(ClassLoader.java:174)
在play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:118)
在play.classloading .ApplicationClassloader.getAllClasses(ApplicationClassloader.java:401)
at play.Play.preCompile(Play.java:570)
at play.Play.init(Play.java:299)
at在org.mortbay.jetty.handler.ContextHandler.startContext play.server.ServletWrapper.contextInitialized(ServletWrapper.java:77)
(ContextHandler.java:548)
。在org.mortbay.jetty.servlet。 Context.startContext(Context.java:136)
在org.mortbay.jetty。 webapp.WebAppContext.startContext(WebAppContext.java:1250)
处org.mortbay.jetty.webapp.WebAppContext org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
。 DOSTART(WebAppContext.java:467)在org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

。在com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java: 452)
,位于com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:459)
,位于com.google.tracing.TraceContext.runInContext(TraceContext.java:701)
。在在com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:328)
$ com.google.tracing.TraceContext AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:336)
。在COM。 google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:456)$ b $在java.lang.Thread.run(Thread.java:679)

我意识到它有一些事情g与从JDK6到JDK7的转换有关,但我不知道为了让应用程序在GAE上运行,还有什么地方需要注意。此外,eclipse中的编译器设置为1.7。



请帮我解决这个问题。 解决方案

要在App Engine上使用Java,您必须使用JDK 6:
https://developers.google.com/appengine/docs/java/overview



他们有一个问题,在他们的问题跟踪器: http://code.google.com/p/googleappengine / issues / detail?id = 6972



对不起!但我认为你必须改变。



(请注意,目前这是真的,我怀疑Google有某种升级计划,没有听说过任何Java 7的公告。他们可能会有一个有限的值得信任的测试人员程序,在大致可用的时间段之前有相当长的时间。)

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.

解决方案

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.)

这篇关于在GAE上将Play应用从JDK 6更新到7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆