Grails升级到2.2.2失败,迁移脚本上出现ClassNotFoundException
在尝试将Grails项目从2.1.1升级到2.2.2时,我得到了一个奇怪的堆栈跟踪Grails升级到2.2.2失败,迁移脚本上出现ClassNotFoundException,grails,grails-2.2,Grails,Grails 2.2,在尝试将Grails项目从2.1.1升级到2.2.2时,我得到了一个奇怪的堆栈跟踪 | Error 2013-05-01 17:54:46,935 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext res
| Error 2013-05-01 17:54:46,935 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: devportal.schema.schema-0
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: devportal.schema.schema-0
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 680 | run . . in java.lang.Thread
Caused by GrailsConfigurationException: Class not found loading Grails application: devportal.schema.schema-0
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 680 | run . . in java.lang.Thread
Caused by ClassNotFoundException: devportal.schema.schema-0
->> 202 | run in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 190 | findClass in java.net.URLClassLoader
| 306 | loadClass in java.lang.ClassLoader
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run . . in ''
^ 680 | run in java.lang.Thread
出于某种原因,它看起来像是在尝试从运行数据库迁移
我在这个问题上找到了答案
看起来我真的可以加上:
封装电流
到我的迁移来解决问题。
也许我应该一直这样
但将我的软件包添加到脚本中没有任何帮助(我甚至尝试了current
)
有人有什么想法吗?几乎在发布后就找到了解决方案 接下来,我通过向中添加包声明解决了这个问题 与文件夹匹配的迁移脚本文件的开头 结构。不确定这是Grails更改还是Groovy更改 导致问题,但文件正在编译为 使用声明的包结构的target/classes目录(其中 在本例中为nothing,导致它们位于根文件夹中)。 然而,Grails正在检测文件结构中的文件,并且 创建具有匹配路径的Spring文件系统资源。这些 传递给DefaultGrailsApplication构造函数和 ClassLoader未能在匹配位置找到类 grails应用程序/migrations/releases/release_1/foo.groovy-> 目标/类/foo.class 通过在foo.groovy的开头添加“package releases.release_1”, 随后发生了以下情况: grails应用程序/migrations/releases/release_1/foo.groovy-> 目标/类/发布/发布1/foo.class 然后类加载器为 文件系统资源