【问题标题】:Grails 2.4.4 unable to create codecLookup beanGrails 2.4.4 无法创建 codecLookup bean
【发布时间】:2015-02-06 01:12:15
【问题描述】:

我正在将 2.3 应用升级到 2.4.4,但在启动时遇到了一个奇怪的错误:

Caused by BeanCreationException: Error creating bean with name 'codecLookup': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
->>  788 | callContextInitialized in org.eclipse.jetty.server.handler.ContextHandler

有没有人见过这个或者可以给我任何可能导致它的指针?

【问题讨论】:

    标签: grails grails-2.0


    【解决方案1】:

    我明白了这一点。我在 grails-app/utils 中定义了一个抽象的基本编解码器以及几个子类,即

    grails-app/utils/
                    BaseCodec.groovy
                    MyCodec.groovy
    
    abstract class BaseCodec {
    ...
    }
    
    class MyCodec extends BaseCodec {
    ...
    }
    

    在 2.3+ 中这有效,但是在 2.4 中 grails 不喜欢 utils 中的抽象类,所以我将其移至 src/groovy:

    src/groovy/BaseCodec.groovy
    grails-app/utils/MyCodec.groovy
    

    这解决了错误。我希望从现在开始,所有抽象的“grails managed”类(编解码器、服务、域等)都应该放在 src/groovy 中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-18
      • 2022-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多