在grails中配置shiro-oauth插件

时间:2013-12-09 11:31:42

标签: grails oauth grails-plugin shiro

我在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

1 个答案:

答案 0 :(得分:0)

你有一个错字:

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