I followed the tutorial introducing the Play framework, but it gives me an error:
Execution exception VerifyError occured : Expecting a stack map frame in method controllers.Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z at offset 33
I'm not sure what I did wrong. The code I'm using (snippets):
package controllers;
..
@With(Secure.class)
public class Applicatio开发者_Python百科n 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);
}
}
...
For the Security class:
package controllers;
import models.*;
public class Security extends Secure.Security {
static boolean authenticate(String username, String password) {
return User.connect(username, password) != null;
}
}
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).
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.
If you are confined to JDK7, you can use the option
java.source=1.6
in your application.conf file.
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.
I had the same, problem, it seems to come from JDK7 indeed.
I to solve it, add
java.source=1.6
to the application.conf file, stop the application, delete everything under the tmp directory of the app and restart it, it should work even if you have the JDK 1.7 installed
if you don't delete the files, play will not recompile them and it will not work, even if you go back to the JDK 1.6
you can also use the -XX:-UseSplitVerifier
flag.
I had the same issue when I run my play application. I am using play 1.2.5 and Java 1.7
I just added
java.source=1.6
in the application.conf.
Then deleted the tmp folder and restart the application and it worked.
It's okay if you wanna use jdk7. Just make sure that your java path configured properly. Check "java -version" and "javac -version".
Example path:
- "C:\Program Files\Java\jdk1.7.0_07\bin" <--- do this
- "C:\Program Files\Java\jdk1.7.0_07\jre\bin" <--- don't do like this
精彩评论