Grails 2.3.5需要“grails clean”在每次代码更改后 [英] Grails 2.3.5 requiring "grails clean" after every code change

查看:456
本文介绍了Grails 2.3.5需要“grails clean”在每次代码更改后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次修改我的代码时,我必须在运行 grails run-app 之前运行 grails clean 。如果我不这样做,我会收到如下消息:

  | Error 2014-02-13 16:33:16,774 [localhost-startStop-1] ERROR context.GrailsContextLoader  - 初始化应用程序时出错:创建名为'transactionManagerPostProcessor'的bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'dataSource'时无法解析对bean'dataSource'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dataSource'的bean时出错:在设置bean属性'targetDataSource'时无法解析对bean'dataSourceUnproxied'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dataSourceUnproxied'的bean时出错:设置属性值时出错;嵌套异常是org.springframework.beans.PropertyBatchUpdateException;嵌套PropertyAccessExceptions(1):
PropertyAccessException 1:org.springframework.beans.MethodInvocationException:属性'driverClassName'引发异常;嵌套异常是java.lang.IllegalStateException:无法加载JDBC驱动程序类[oracle.jdbc.OracleDriver]
消息:创建名为'transactionManagerPostProcessor'的bean时出错:Bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'dataSource'时无法解析对bean'dataSource'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dataSource'的bean时出错:在设置bean属性'targetDataSource'时无法解析对bean'dataSourceUnproxied'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dataSourceUnproxied'的bean时出错:设置属性值时出错;嵌套异常是org.springframework.beans.PropertyBatchUpdateException;嵌套PropertyAccessExceptions(1):
PropertyAccessException 1:org.springframework.beans.MethodInvocationException:属性'driverClassName'引发异常;嵌套异常是java.lang.IllegalStateException:无法加载JDBC驱动程序类[oracle.jdbc.OracleDriver]
行|方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 744 |在java.lang.Thread中运行

这很奇怪,因为看起来Grails无法加载Oracle数据库驱动程序...但它加载罚款,如果我运行

  grails clean 
grails run-app

我正在使用的这个应用程序今天已经从Grails 2.2.4升级了。升级是没有用的(直到这个)。我所要做的只是更改hibernate和tomcat版本,然后运行 grails upgrade; grails clean



任何想法我都可以得到它,所以我可以修改代码并使用 grails run-应用或更好的...让重载功能起作用,所以当我修改代码时,它会自动编译我刚刚保存的文件(这在Grails 2.2.4中效果很好)。

b $ b

解决方案

您是否试过 grails -reloading run-app



由于您提到升级过程中只更改了插件版本,因此我认为您没有使用分叉模式,默认情况下启用了重新加载。



查看分叉执行和重新加载代理一>。另请注意,2.3。*中已弃用 grails upgrade 命令。


Every time I modify my code I have to run grails clean before running grails run-app. If I don't, I get messages like this:

| Error 2014-02-13 16:33:16,774 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver]
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver]
    Line | Method
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run       in java.lang.Thread

This is really odd, because it seems Grails cannot load the Oracle database driver... but it loads fine if I run

grails clean
grails run-app

This app I'm working on was upgraded today from Grails 2.2.4. The upgrade was seemless (until this). All I had to do was change the hibernate and tomcat versions then run grails upgrade; grails clean

Any ideas how I can get it so I can modify the code and just restart using grails run-app or better... get the reload functionality to work, so when I make code modifications it automatically compiles the file I just saved (this worked great in Grails 2.2.4).

解决方案

Have you tried grails -reloading run-app?

Since you have mentioned you have only changed the plugin versions during upgrade, I suppose you are not using forked mode where reloading is enabled by default.

Have a look at Forked Execution and the Reloading Agent. Also note that grails upgrade command has been deprecated in 2.3.*.

这篇关于Grails 2.3.5需要“grails clean”在每次代码更改后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆