1

您好,在我的 playframework 项目中配置 deadbolt 模块时遇到了一个小问题。我正在使用 playframework 2.2.1 版本,我正在一步一步做,就像他们在 deadbolt 文档页面 http://deadbolt.ws/#/java-docs上显示的那样

我遇到的第一个问题是在 application.conf 中,因为在这里我看起来像这样:

# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="0ki/vB`gn_SY]NWR;8I0OM1^/<>3AF;dMG^VFc8JQ5sGJ9eL4:/7Hpc2/y>Ug;bu"

# The application languages
# ~~~~~
application.langs="en,de"
parsers.text.maxLength=10000000K

deadbolt.java.handler
deadbolt {
before-auth-check-timeout=4000,
java {
    cache-user=true,
        handlers {
        defaultHandler=com.example.security.MyDeadboltHandler,
        be.objectify.deadbolt.java.DeadboltHandler,
        be.objectify.deadbolt.core.models.Subject,
        foo=com.example.security.FooDeadboltHandler,
        be.objectify.deadbolt.java.DynamicResourceHandler,
            bar=com.example.security.BarDeadboltHandler
        }
    }
}


# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global

我不知道我添加了良好的锁栓配置,因为它看起来与 application.conf 中的其他配置有点不同

当我开始播放应用程序播放调试〜运行

有些东西正在更新和安装,然后我得到错误

[info] Done updating.

java.lang.NoSuchMethodException:  
play.core.server.NettyServer.mainDevHttpMode(play.core.SBTLink,
play.core.SBTDocHandler, int)
    at java.lang.Class.getMethod(Class.java:1665)
    at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$1.apply(PlayRun.scala:232)
    at play.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$1.apply(PlayRun.scala:91)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
    at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.lang.NoSuchMethodException:   
play.core.server.NettyServer.mainDevHttpMode(play.core.SBTLink,  
play.core.SBTDocHandler, int)
[error] Total time: 6 s, completed 2014-09-17 13:00:41
1. Waiting for source changes... (press enter to interrupt)

也许有人遇到这个问题或者知道我做错了什么,我会非常感谢每一个帮助!

4

1 回答 1

1

看起来您的处理程序块也是错误的。它应该是键/值对,但你只有一对。它应该看起来更像

handlers { 
    defaultHandler=com.example.security.MyDeadboltHandler,
    foo=com.example.security.FooDeadboltHandler,
    bar=com.example.security.BarDeadboltHandler 
}
于 2014-09-30T05:40:53.500 回答