本文介绍了验证错误;在方法controllers.Secure$Security.authenify 中需要一个堆栈映射框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了介绍 Play 框架的教程,但它给了我一个错误:

I followed the tutorial introducing the Play framework, but it gives me an error:

执行异常发生验证错误:在方法controllers.Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z 处期望堆栈映射帧在偏移 33

我不确定我做错了什么.我正在使用的代码(片段):

I'm not sure what I did wrong. The code I'm using (snippets):

package controllers;

..

@With(Secure.class)
public class Application extends Controller 
{
    @Before
    public static void setConnectedUser() 
    {
        if (Security.isConnected()) 
        {
            User user = User.find("byEmail", Security.connected()).first();
            user.password = null;
            renderArgs.put("user", user);
        }
    }

    ...

对于安全类:

package controllers;

import models.*;

public class Security extends Secure.Security {    
    static boolean authenticate(String username, String password) {
        return User.connect(username, password) != null;
    }
}

我还在dependencies.yml 中添加了安全模块,它在重新启动Play 框架后正确加载.我将安全模型添加到我的路线中.Eclipse 没有错误;错误只发生在执行时.Secure.Security 类实际上有可用的公共静态 isConnected 方法.我使用的是 Play 框架的最新版本 (1.2.2).

I also added the secure module to dependencies.yml which loads correctly after restarting Play framework. I added the secure model to my routes. Eclipse gives no errors; error only occurs on execution time. The Secure.Security class does actually have the public static isConnected method available. I'm using the most recent version for the Play framework (1.2.2).

推荐答案

Play 的消息组已经讨论过 JDK1.7 存在一些问题,并且 Play 尚未正式支持此问题.如果可能,请尝试使用 JDK 6,看看是否仍然出现此错误.

The message group for Play has discussed that there are some issues with JDK1.7, and that Play does not officially support this yet. If possible, please try with JDK 6, and see if you still get this error.

如果您仅限于 JDK7,则可以使用该选项

If you are confined to JDK7, you can use the option

java.source=1.6

在您的 application.conf 文件中.

in your application.conf file.

2011 年 8 月 18 日更新: Nicolas Leroux 最近在 Twitter 上发送了一条消息,说 Java 7 支持已添加到主分支中的 Play.它可能不会发布 1.2.3 版本,但会在那之后发布.

Update 18th August 2011: Nicolas Leroux recently sent out a message on Twitter to say that Java 7 support had been added to Play in the master branch. It probably won't make the 1.2.3 release, but will make the release after that.

这篇关于验证错误;在方法controllers.Secure$Security.authenify 中需要一个堆栈映射框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 06:25