gpt4 book ai didi

grails发布插件错误 "class not found loading plugin resource [spring.resources]"

转载 作者:行者123 更新时间:2023-12-02 17:27:29 26 4
gpt4 key购买 nike

当发布我使用“Realease-2.0.4”和 Grails 2.0.1 构建的特定插件时,我遇到了一个奇怪的异常,我似乎无法摆脱它。我有许多具有类似设置的插件,但这些插件都不会产生此异常。

| Error 2012-11-15 17:00:25,604 [main] ERROR plugins.DefaultGrailsPlugin  - Class not found loading plugin resource [spring.resources]. Resource skipped.
Message: spring.resources
Line | Method
->> 202 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 190 | findClass in java.net.URLClassLoader
| 306 | loadClass in java.lang.ClassLoader
| 247 | loadClass in ''
| 178 | doCall . in _PluginDependencies_groovy$_run_closure5_closure23
| 176 | doCall in _PluginDependencies_groovy$_run_closure5
| 60 | doCall . in _GrailsPackage_groovy$_run_closure2
| 45 | doCall in PublishPlugin$_run_closure1
^ 62 | doCall . in ''
| Error 2012-11-15 17:00:25,977 [main] ERROR plugins.DefaultGrailsPlugin - Class not found loading plugin resource [spring.resources]. Resource skipped.
Message: spring.resources
Line | Method
->> 202 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 190 | findClass in java.net.URLClassLoader
| 306 | loadClass in java.lang.ClassLoader
| 247 | loadClass in ''
| 178 | doCall . in _PluginDependencies_groovy$_run_closure5_closure23
| 176 | doCall in _PluginDependencies_groovy$_run_closure5
| 60 | doCall . in _GrailsPackage_groovy$_run_closure2
| 45 | doCall in PublishPlugin$_run_closure1
^ 62 | doCall . in ''

这就是堆栈跟踪的全部内容。

grails-app/conf/spring/resources 下没有定义资源。

知道如何解决这个问题吗?

最佳答案

1.上下文

我正在使用 grails 2.4.3 和 java 1.7 来开发一个自定义插件并在应用程序中使用它。自定义插件使用 spring-security-core 插件并添加了一些功能。该应用程序使用自定义插件并添加其他功能。这个想法是在自定义插件中设置 spring-security 和其他常见功能,并在多个项目中使用它。

当我在 conf/BuildConfig.groovy 文件中使用下一个配置运行应用程序时,没有问题:

...
grails.plugin.location.'author-security-plugin' = "../AuthorSecurityPlugin"
...

但是,当我打包插件并使用以下命令将其安装到我的 Maven 本地存储库时:

$ grails clean
$ grails refresh-dependencies
$ grails maven-install

使用 conf/BuildConfig.groovy 文件中的下一个配置:

dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
compile: ':domino-connection-lib:'
runtime: 'postgresql:postgresql:9.2-1002.jdbc4'

//custom plugin
compile: "com.company:author-security-plugin:0.1"
}
...
//grails.plugin.location.'author-security-plugin' = "../AuthorSecurityPlugin"
...

并执行“grails run-app”命令,项目抛出下一个异常:

| Packaging Grails application.....
2015-04-20 17:12:42,067 [main] ERROR plugins.DefaultGrailsPlugin - Class not found loading plugin resource [spring.resources]. Resource skipped.
java.lang.ClassNotFoundException: spring.resources
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at _PluginDependencies$_run_closure2.doCall(_PluginDependencies.groovy:48)
at _GrailsPackage$_run_closure2.doCall(_GrailsPackage.groovy:57)
at RunApp$_run_closure1.doCall(RunApp.groovy:28)

注意: spring/resources.groovy 文件包含:

// Place your Spring DSL code here
beans = {
customAuthenticationProvider(CustomAuthenticationProvider){
springSecurityService=ref('springSecurityService')
customUserService=ref('customUserService')
}
...
}

2.解决方案

就我而言,解决方案是删除自定义插件中的 grails-app/conf/spring/resources.groovy 文件,并将其内容移至应用程序中的 grails-app/conf/spring/resources.groovy 。

希望这可以帮助你。

关于grails发布插件错误 "class not found loading plugin resource [spring.resources]",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13401524/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com