`
schy_hqh
  • 浏览: 543742 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

(二)play之Eclipse调试

 
阅读更多

转换成Eclipse项目

  1. 启动命令行,输入play new <项目名>,Play会在当前路径下创建项目。
  2. 输入play eclipsify <项目名>,Play会在项目目录中创建eclipse需要的配置文件,将其转换成eclipse项目。
  3. 在eclipse中导入创建的项目。

调试

Play转换eclipse项目时,在eclipse目录中生成了三个启动配置:

  1. JPDA:连接到已经启动的Play Server,实现alive调试
  2. Demo:本地运行项目
  3. Test:以测试模式启动项目

选中它们,右键执行Run As,即可完成相应的任务。

 

本地调试

直接Debug As 执行Demo会报错:

ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp

 

解决办法:

编辑Demo.launch

找到<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value=" -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Dplay.debug=yes ...>

-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n去掉!

附加Play源码,即可调试Play本身。

 

 

 

如果使用JDK1.7,还需要进行配置,否则Play会抛异常

 

异常信息

Execution exception 
VerifyError occured : Expecting a stack map frame Exception Details: Location: controllers/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)
Z @33: istore_3 Reason: Error exists in the bytecode Bytecode: 0000000: b800 7d12 782b b800 7a12 712a b800 77bb 0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904 0000020:
bf3e b800 821d ac Exception Handler Table: bci [0, 23] => handler: 23 Stackmap Table: same_locals_1_stack_item_frame(@23,Object[#55]) 

 

Internal Server Error (500) for request GET /sis/

Execution exception (In /app/controllers/Application.java around line 65)
VerifyError occured : Expecting a stack map frame Exception Details:   Location:     controllers/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z @33: istore_3   Reason:     Error exists in the bytecode   Bytecode:     0000000: b800 7d12 782b b800 7a12 712a b800 77bb     0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904     0000020: bf3e b800 821d ac                         Exception Handler Table:     bci [0, 23] => handler: 23   Stackmap Table:     same_locals_1_stack_item_frame(@23,Object[#55]) 

play.exceptions.JavaExecutionException: Expecting a stack map frame
Exception Details:
  Location:
    controllers/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z @33: istore_3
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: b800 7d12 782b b800 7a12 712a b800 77bb
    0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904
    0000020: bf3e b800 821d ac                      
  Exception Handler Table:
    bci [0, 23] => handler: 23
  Stackmap Table:
    same_locals_1_stack_item_frame(@23,Object[#55])

	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
	at Invocation.HTTP Request(Play!)
Caused by: java.lang.VerifyError: Expecting a stack map frame
Exception Details:
  Location:
    controllers/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z @33: istore_3
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: b800 7d12 782b b800 7a12 712a b800 77bb
    0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904
    0000020: bf3e b800 821d ac                      
  Exception Handler Table:
    bci [0, 23] => handler: 23
  Stackmap Table:
    same_locals_1_stack_item_frame(@23,Object[#55])

	at controllers.Application.setConnectedUser(Application.java:65)
	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
	... 1 more

 

 

解决办法:

IDE中配置JRE环境处,设置启动参数   -XX:-UseSplitVerifier

Window → Preferences → Java → Installed JREs → Edit... → Default VM arguments

If you want to stay with JDK7, would be to use "-XX:-UseSplitVerifier" as an argument for the VM.

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics