【问题标题】:Configuring shiro-oauth plugin in grails在 grails 中配置 shiro-oauth 插件
【发布时间】:2013-12-09 11:31:41
【问题描述】:

我在 grails 中使用 shiro-oauth 插件。 我已将插件配置如下

    oauth {
    providers {
        facebook {
            provider = org.scribe.builder.api.FacebookApi
            key = 'zuckerberg'
            secret = 'brothers'
            callback = "${grails.serverURL}/auth/callback"
            successUri = "/oauth/OnSuccess?provider=facebook"
            failureUri = "${grails.serverURL}/auth/unauthorized"
        }

    }
    debug = true
}

但在运行应用程序后,我得到了如下错误

Class: uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException
Message
[:] is not a Class

堆栈跟踪如下

 Line | Method
->>  116 | logThrowable     in AbstractFilter.java
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     70 | doFilter         in     ''
|     55 | doFilter . . . . in SavedRequestFilter.java
|    449 | executeChain     in org.apache.shiro.web.servlet.AbstractShiroFilter
|    365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
|     90 | doCall           in org.apache.shiro.subject.support.SubjectCallable
|     83 | call . . . . . . in     ''
|    380 | execute          in org.apache.shiro.subject.support.DelegatingSubject
|    362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
|    125 | doFilter         in org.apache.shiro.web.servlet.OncePerRequestFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . .  in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'uk.co.desirableobjects.oauth.scribe.OauthController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthController]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthService]: Constructor threw exception; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
->>  196 | getBean          in AbstractFilter.java
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    842 | lookupController in PageFragmentCachingFilter.java
|    176 | doFilter . . . . in     ''
|     63 | doFilter         in AbstractFilter.java
|     55 | doFilter . . . . in SavedRequestFilter.java
|    449 | executeChain     in org.apache.shiro.web.servlet.AbstractShiroFilter
|    365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
|     90 | doCall           in org.apache.shiro.subject.support.SubjectCallable
|     83 | call . . . . . . in     ''
|    380 | execute          in org.apache.shiro.subject.support.DelegatingSubject
|    362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
|    125 | doFilter         in org.apache.shiro.web.servlet.OncePerRequestFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . .  in java.lang.Thread

Caused by BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthController]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'oauthService': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthService]: Constructor threw exception; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
->>  196 | getBean          in AbstractFilter.java
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    842 | lookupController in PageFragmentCachingFilter.java
|    176 | doFilter . . . . in     ''
|     63 | doFilter         in AbstractFilter.java
|     55 | doFilter . . . . in SavedRequestFilter.java
|    449 | executeChain     in org.apache.shiro.web.servlet.AbstractShiroFilter
|    365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
|     90 | doCall           in org.apache.shiro.subject.support.SubjectCallable
|     83 | call . . . . . . in     ''
|    380 | execute          in org.apache.shiro.subject.support.DelegatingSubject
|    362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
|    125 | doFilter         in org.apache.shiro.web.servlet.OncePerRequestFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . .  in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'oauthService': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthService]: Constructor threw exception; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
->>  196 | getBean          in AbstractFilter.java
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    842 | lookupController in PageFragmentCachingFilter.java
|    176 | doFilter . . . . in     ''
|     63 | doFilter         in AbstractFilter.java
|     55 | doFilter . . . . in SavedRequestFilter.java
|    449 | executeChain     in org.apache.shiro.web.servlet.AbstractShiroFilter
|    365 | call . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
|     90 | doCall           in org.apache.shiro.subject.support.SubjectCallable
|     83 | call . . . . . . in     ''
|    380 | execute          in org.apache.shiro.subject.support.DelegatingSubject
|    362 | doFilterInternal in org.apache.shiro.web.servlet.AbstractShiroFilter
|    125 | doFilter         in org.apache.shiro.web.servlet.OncePerRequestFilter
|   1145 | runWorker . . .  in java.util.concurrent.ThreadPoolExecutor
|    615 | run              in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . .  in java.lang.Thread

Caused by BeanInstantiationException: Could not instantiate bean class [uk.co.desirableobjects.oauth.scribe.OauthService]: Constructor threw exception; nested exception is uk.co.desirableobjects.oauth.scribe.exception.InvalidOauthProviderException: [:] is not a Class
->>  196 | getBean          in AbstractFilter.java
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


Caused by InvalidOauthProviderException: [:] is not a Class

有人能告诉我在配置 oauth 时我哪里出错了吗? follow this link

【问题讨论】:

    标签: grails oauth grails-plugin shiro


    【解决方案1】:

    你有一个错字:

    oauth {
        providers {
            facebook {
                ...
            }
        }
    }
    

    【讨论】:

    • “谢谢”的回复,你能告诉更多确切的问题是什么吗?
    猜你喜欢
    • 2012-01-27
    • 2011-07-03
    • 2014-11-24
    • 2015-07-14
    • 1970-01-01
    • 2012-04-13
    • 2012-10-04
    • 2018-08-29
    • 2010-10-25
    相关资源
    最近更新 更多