无法导出 Play!应用程序作为战争

发布于 2024-12-08 09:27:08 字数 2566 浏览 0 评论 0原文

我正在尝试打包一个 Play!针对 Java 7 构建的应用程序。我收到此错误。另外,我无法从命令行启动该应用程序,但可以从 Eclipse 启动该应用程序。

D:\Dropbox\eclipseProjectsClassic>play war MyApp -o MyApp.war --zip
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.2.3, http://www.playframework.org
~
Listening for transport dt_socket at address: 8000
04:17:03,694 INFO  ~ Starting D:\Dropbox\eclipseProjectsClassic\MyApp
Exception in thread "main" java.lang.UnsupportedClassVersionError: DocViewerPlugin : Unsupported maj
or.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java
:158)
        at play.classloading.ApplicationClassloader.loadClass(ApplicationClassloader.java:84)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:100)
        at play.Play.init(Play.java:286)
        at play.server.Server.main(Server.java:158)

~ Packaging current version of the framework and the application to D:\Dropbox\eclipseProjectsClassi
c\MyApp.war ...
Traceback (most recent call last):
  File "C:\play\play", line 153, in 
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remai
ning_args, env=play_env, cmdloader=cmdloader)
  File "C:\play\framework\pym\play\commands\war.py", line 65, in execute
    package_as_war(app, env, war_path, war_zip_path, war_exclusion_list)
  File "C:\play\framework\pym\play\utils.py", line 117, in package_as_war
    copy_directory(app.path, os.path.join(war_path, 'WEB-INF/application'), war_exclusion_list)
  File "C:\play\framework\pym\play\utils.py", line 230, in copy_directory
    shutil.copyfile(from_, to_)
  File "C:\play\python\lib\shutil.py", line 53, in copyfile
    fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: 'D:\\Dropbox\\eclipseProjectsClassic\\MyApp.war\\WEB-
INF/application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB
-INF\\application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB-INF\\application\\test\\data
\\DataCollectorTest.java'

更新 我通过将 JAVA_HOME 系统变量更改为 jdk7 目录解决了 UnsupportedClassVersionError。但 IOError 仍然出现。

UPDATE2 通过将输出目录更改为“C:\MyApp.war”解决了 IOError

I'm trying to package a Play! app built against Java 7. I'm getting this error. Also, I cannot launch the app from the command line, but from Eclipse it works.

D:\Dropbox\eclipseProjectsClassic>play war MyApp -o MyApp.war --zip
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.2.3, http://www.playframework.org
~
Listening for transport dt_socket at address: 8000
04:17:03,694 INFO  ~ Starting D:\Dropbox\eclipseProjectsClassic\MyApp
Exception in thread "main" java.lang.UnsupportedClassVersionError: DocViewerPlugin : Unsupported maj
or.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java
:158)
        at play.classloading.ApplicationClassloader.loadClass(ApplicationClassloader.java:84)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:100)
        at play.Play.init(Play.java:286)
        at play.server.Server.main(Server.java:158)

~ Packaging current version of the framework and the application to D:\Dropbox\eclipseProjectsClassi
c\MyApp.war ...
Traceback (most recent call last):
  File "C:\play\play", line 153, in 
    status = cmdloader.commands[play_command].execute(command=play_command, app=play_app, args=remai
ning_args, env=play_env, cmdloader=cmdloader)
  File "C:\play\framework\pym\play\commands\war.py", line 65, in execute
    package_as_war(app, env, war_path, war_zip_path, war_exclusion_list)
  File "C:\play\framework\pym\play\utils.py", line 117, in package_as_war
    copy_directory(app.path, os.path.join(war_path, 'WEB-INF/application'), war_exclusion_list)
  File "C:\play\framework\pym\play\utils.py", line 230, in copy_directory
    shutil.copyfile(from_, to_)
  File "C:\play\python\lib\shutil.py", line 53, in copyfile
    fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: 'D:\\Dropbox\\eclipseProjectsClassic\\MyApp.war\\WEB-
INF/application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB
-INF\\application\\MyApp.war\\WEB-INF\\application\\MyApp.war\\WEB-INF\\application\\test\\data
\\DataCollectorTest.java'

UPDATE I've solved the UnsupportedClassVersionError by changing the JAVA_HOME system variable to jdk7 directory. The IOError is still coming up though.

UPDATE2 Solved IOError by changing te output directory to "C:\MyApp.war"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧故 2024-12-15 09:27:08

如果我从 Play 1.2.4RC1 的发行说明中了解到的话,那么 Play 1.2.3 并没有完整的 Java 7 支持。尝试使用 Play 框架下载页面 中的新 Play 1.2.4 候选版本吗?它的发行说明表明“Java 7 现在已得到开箱即用的支持”。

If I understood right from the release notes of Play 1.2.4RC1, Play 1.2.3 did not have full Java 7 support. Try it with the new Play 1.2.4 release candidate from the Play framework download page? It's release notes tell that "Java 7 is now supported out of the box in play".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文