我尝试添加drools插件: https://grails.org/plugin/drools 到Grails中的webapp,只需在BuildConfig.groovy中添加它:
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile "org.grails.plugins:mail:1.0.7"
compile ":rest-client-builder:2.0.3"
compile ":spring-security-core:2.0-RC3"
compile ":spring-security-oauth2-provider:1.0.5.2"
compile ":browser-detection:0.4.3"
compile ":asset-pipeline:2.1.5"
compile ":remote-pagination:0.4.8"
compile ":drools:1.1.0"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
runtime ':twitter-bootstrap:3.3.1'
}
,但我收到了一个错误:
Configuring Spring Security OAuth2 provider ...
... done configuring Spring Security OAuth2 provider Running Common
Auth Plugin... | Error 2015-05-25 13:25:09,499 [localhost-startStop-1]
ERROR context.GrailsContextLoaderListener - Error initializing the
application: Error creating bean with name 'oauth2ProviderFilter':
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter]:
Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError:
com/sun/xml/bind/v2/model/annotation/AnnotationReader Message: Error
creating bean with name 'oauth2ProviderFilter': Instantiation of bean
failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter]:
Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError:
com/sun/xml/bind/v2/model/annotation/AnnotationReader
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker ^
745 | run in java.lang.Thread Caused by
BeanInstantiationException: Could not instantiate bean class
[org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter]:
Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError:
com/sun/xml/bind/v2/model/annotation/AnnotationReader
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker ^
745 | run in java.lang.Thread Caused by NoClassDefFoundError:
com/sun/xml/bind/v2/model/annotation/AnnotationReader
->> 800 | defineClass in java.lang.ClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 142 | defineClass in java.security.SecureClassLoader | 449 | defineClass in java.net.URLClassLoader | 71 | access$100 in
'' | 361 | run . . . in java.net.URLClassLoader$1 | 355 | run
in '' | 354 | findClass in java.net.URLClassLoader | 425 |
loadClass in java.lang.ClassLoader | 2615 |
privateGetDeclaredMethods in java.lang.Class | 2856 | getMethod0 in
'' | 1668 | getMethod in '' | 243 | newInstance in
javax.xml.bind.ContextFinder | 235 | newInstance in '' | 432
| find in '' | 637 | newInstance in
javax.xml.bind.JAXBContext | 584 | newInstance in '' | 262 |
run . . . in java.util.concurrent.FutureTask | 1145 | runWorker in
java.util.concurrent.ThreadPoolExecutor | 615 | run . . . in
java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run in
java.lang.Thread Caused by ClassNotFoundException:
com.sun.xml.bind.v2.model.annotation.AnnotationReader
->> 366 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 355 | run in '' | 354 | findClass in java.net.URLClassLoader | 425 | loadClass in java.lang.ClassLoader
| 800 | defineClass in '' | 142 | defineClass in
java.security.SecureClassLoader | 449 | defineClass in
java.net.URLClassLoader | 71 | access$100 in '' | 361 | run
. . . in java.net.URLClassLoader$1 | 355 | run in '' |
354 | findClass in java.net.URLClassLoader | 425 | loadClass in
java.lang.ClassLoader | 2615 | privateGetDeclaredMethods in
java.lang.Class | 2856 | getMethod0 in '' | 1668 | getMethod
in '' | 243 | newInstance in javax.xml.bind.ContextFinder |
235 | newInstance in '' | 432 | find in '' | 637 |
newInstance in javax.xml.bind.JAXBContext | 584 | newInstance in
'' | 262 | run . . . in java.util.concurrent.FutureTask | 1145 |
runWorker in java.util.concurrent.ThreadPoolExecutor | 615 | run .
. . in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run
in java.lang.Thread Error | Forked Grails VM exited with error
似乎Drools和spring-security-oauth2-provider之间存在冲突。
答案 0 :(得分:0)
好的,我通过添加:
解决了这个问题compile ":cxf:2.1.1"
到BuildConfig插件。
你可以在评论中找到更多关于Ken的详细信息:https://github.com/kensiprell/grails-drools/issues/8#issuecomment-105252639