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

问题描述

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

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

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

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上发布了一条消息,称在master分支中已将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.

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

10-12 06:25