小编Mor*_*itz的帖子

尝试在Tomcat中启动grails App时出现"SEVERE:Error listenerStart"

我有一个grails应用程序的问题,我正在努力,我无法搞清楚.这是一个grails 2.0应用程序,应该在带有Tomcat7的Debian稳定版上运行.所以我构建了war文件并将其部署到Tomcat.一旦启动它,我就会在Tomcat日志文件(catalina.out)中获得以下日志输出:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
28-Jan-2012 13:02:00 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
28-Jan-2012 13:02:00 org.apache.catalina.core.StandardContext start
SEVERE: Context [/Gibbons5] startup failed due to previous errors
28-Jan-2012 13:02:00 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/Gibbons5] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Run Code Online (Sandbox Code Playgroud)

我试着通过将Tomcats loglevel增加到FINEST来使输出更加冗长,但这并没有给我任何更多信息.我还将应用程序的loglevel更改为debug,但这也无济于事. …

grails debian tomcat

12
推荐指数
2
解决办法
1万
查看次数

没有加载Spock GlobalExtension(grails)

我想在我的grails-app中为所有spock geb规范注册一个Listener,所以我在myapp/src/groovy中添加了一个IGlobalExtension

package myapp.spock

class TakeScreenshotExtension implements IGlobalExtension {
    @Override
    void visitSpec(SpecInfo specInfo) {
        System.err.println "ADDING LISTENER"
        specInfo.addListener(new TakeScreenshotOnFailureListener())
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我将org.spockframework.runtime.extension.IGlobalExtension文件添加到myapp/src/resources/META-INF /包含该行的服务

myapp.spock.TakeScreenshotExtension
Run Code Online (Sandbox Code Playgroud)

所以现在根据我的理解,当运行grails test-app functional:时,应该加载Extension,但是我没有在输出中的任何地方看到"ADDING LISTENER".我究竟做错了什么?

grails spock geb

8
推荐指数
1
解决办法
592
查看次数

Grails和HibernateException:连接代理在事务完成后不可用

我刚遇到一个我不明白的问题.我们的grails(2.2.2)应用程序在第一个用户登录后抛出以下异常.一旦完成,没有人再见过它.目前我们正在通过Geb测试再现它.

Caused by HibernateSystemException: connnection proxy not usable after transaction completion; nested exception is org.hibernate.HibernateException: connnection proxy not usable after transaction completion
->>   24 | doCall    in gibbons5.recommender.ActivityRatingTagLib$_closure1
Run Code Online (Sandbox Code Playgroud)

ActivityRatingTagLib中的行(由gsp调用)非常简单:

if (!User.get(session.user.id).permissions.publishStream) {
Run Code Online (Sandbox Code Playgroud)

如果我删除User.get()这里并立即访问session.user,一切正常,但它会在下一个TagLib调用中崩溃,在该调用中访问用户User.get().

我现在正在互联网上寻找解决方案,但是还没有任何有用的东西.由于这个例外似乎相当罕见,我想我们做的事情基本上是错的,但是什么呢?

User.groovy:

class User implements HttpSessionBindingListener {
    ...

    boolean isOnline = false
    Permissions permissions = new Permissions()

    static embedded = ['infoPopups', 'permissions', 'userSettings']

    void valueBound(HttpSessionBindingEvent event) {
        isOnline = true
    }

    void valueUnbound(HttpSessionBindingEvent event) {
        // we do not have a session any …
Run Code Online (Sandbox Code Playgroud)

grails hibernate grails-orm

5
推荐指数
1
解决办法
3456
查看次数

Grails资源插件并使用每个环境不同的资源

在我目前的grails项目中,我们正在使用UglifyJS缩小我们的JavaScript文件,并且还在开发环境中使用这些缩小的资源.正如您可以想象的那样,在缩小版本上进行调试时会有点痛苦,修复未缩小版本中的错误,将其缩小并再次调试.因此,我想在开发环境中包含非缩小版本,在生产环境中包含缩小版本.所以我尝试调整ApplicationResources.groovy以获得以下方案:

environments {
    development {
        modules = {
            core {
                resource url:"js/core.js"
            }
        }
    }
    production {
        modules = {
            core {
                resource url:"js/core.min.js"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这在某种程度上是行不通的,例如抛出异常

Caused by GrailsTagException: Error executing tag <r:layoutResources>: No module found with name [core]
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?

更新:

我不确定我是否正确理解这一点.我尝试了以下无效的方法:

更新:

添加ID可以解决问题:)

ApplicationResources.groovy

modules = {
    core {
        resource id: 'core', url:"js/core.min.js"
    }
}
Run Code Online (Sandbox Code Playgroud)

DevelopmentResources.groovy

environment {
    development {
        modules = {
            overrides {
                core {
                    resource id: 'core', url:"js/core.js"
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

grails resources minify

3
推荐指数
1
解决办法
1499
查看次数

标签 统计

grails ×4

debian ×1

geb ×1

grails-orm ×1

hibernate ×1

minify ×1

resources ×1

spock ×1

tomcat ×1