java中使用play框架的无头异常

时间:2014-08-21 05:27:18

标签: java playframework-2.0

我在java中使用joptionpane我收到错误"播放 - 无法调用操作,最终出错:java.awt.HeadlessException"我把代码放在下面,我正在使用播放框架

enter code here
        System.setProperty("java.awt.headless", "true");
        JFrame frame = new JFrame();
        frame.setVisible(true);
        JOptionPane.showMessageDialog(frame, "Login into Your Account");

error message
         ! @6j9l3c30p - Internal server error, for (POST) [/login] ->

play.api.Application $$ anon $ 1:执行异常[[HeadlessException:null]]         at play.api.Application $ class.handleError(Application.scala:293)〜[play_2.10.jar:2.2.3]         at play.api.DefaultApplication.handleError(Application.scala:399)[play_2.10.jar:2.2.3]         at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 3 $$ anonfun $ applyOrElse $ 3.apply(PlayDefaultUpstreamHandler.scala:264)[play_2.10.jar:2.2.3]         at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 3 $$ anonfun $ applyOrElse $ 3.apply(PlayDefaultUpstreamHandler.scala:264)[play_2.10.jar:2.2.3]         在scala.Option.map(Option.scala:145)[scala-library.jar:na]         at play.core.server.netty.PlayDefaultUpstreamHandler $$ anonfun $ 3.applyOrElse(PlayDefaultUpstreamHandler.scala:264)[play_2.10.jar:2.2.3] 引起:java.awt.HeadlessException:null         在java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)〜[na:1.7.0_51]         在java.awt.Window。(Window.java:535)〜[na:1.7.0_51]         at java.awt.Frame。(Frame.java:420)〜[na:1.7.0_51]         at java.awt.Frame。(Frame.java:385)〜[na:1.7.0_51]         在javax.swing.JFrame。(JFrame.java:174)〜[na:1.7.0_51]         在controllers.Application.login(Application.java:68)〜[na:na]

1 个答案:

答案 0 :(得分:0)

我有点困惑。看起来你试图通过http传递一个swing UI。

要使用游戏构建UI,您应该考虑使用他们的scala模板和渲染html。您可能需要浏览他们的一个教程以帮助您入门。

https://typesafe.com/activator/template/play-spring-data-jpa