【问题标题】:Grails Audit plugin not working with MongoDBGrails Audit 插件不适用于 MongoDB
【发布时间】:2015-08-03 15:11:50
【问题描述】:

Grails audit plugin 不适用于 MongoDB

尽管文档中提到它将与 mongoDB 一起使用

兼容性问题

Grails 1.2.x 及以下版本的用户应使用此插件的 0.5.3 版本。 Grails 1.3.x 及更高版本的用户应使用此插件的 0.5.5.3 版本。如果您使用 Grails >= 2.3,我们建议使用 1.0.0 或更高版本。

从 1.0.0 版开始,此插件与 ORM 映射器无关,因此您可以将其与您选择的 ORM 映射器(Hibernate3、Hibernate4、MongoDB 等)一起使用。

我有以下配置设置

BuildConfig.groovy

compile ":mongodb:3.0.3"
compile ":audit-logging:1.0.5"

注意:不使用任何 Hibernate 插件

我在启动应用程序时遇到的错误是:

Configuring Spring Security Core ...
... finished configuring Spring Security Core
2015-08-03 20:30:48,774 +0530 ERROR GrailsContextLoaderListener:213  - Error initializing the application: Cannot get property 'datastores' on null object
java.lang.NullPointerException: Cannot get property 'datastores' on null object
    at org.codehaus.groovy.runtime.NullObject.getProperty(NullObject.java:57)
    at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:168)
    at org.codehaus.groovy.runtime.callsite.NullCallSite.getProperty(NullCallSite.java:44)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
    at AuditLoggingGrailsPlugin$_closure1.doCall(AuditLoggingGrailsPlugin.groovy:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at groovy.lang.Closure.call(Closure.java:423)
    at AuditLoggingGrailsPlugin$_closure1.call(AuditLoggingGrailsPlugin.groovy)
    at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.doWithApplicationContext(DefaultGrailsPlugin.java:488)
    at org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager.doPostProcessing(AbstractGrailsPluginManager.java:176)
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.performPostProcessing(GrailsRuntimeConfigurator.java:240)
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:176)
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
    at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:126)
    at org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener.initWebApplicationContext(GrailsContextLoaderListener.java:109)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Disconnected from the target VM, address: '127.0.0.1:35642', transport: 'socket'

我还发现了一个类似的问题,它重定向到这个链接

http://stackoverflow.com/questions/23470095/grails-audit-logging-plugin-for-mongodb-is-not-working

【问题讨论】:

  • 这应该已经用1.0.6-SNAPSHOT 版本修复了,你可以试试吗?
  • 初始化应用程序时出错:没有这样的属性:类的配置:org.grails.datastore.mapping.mongo.MongoDatastore
  • 错误已经改变。
  • if (!application.config.auditLog.disabled && !datastore.config.auditLog.disabled) { ... 这行触发了错误。
  • 你能在 github 上提出一个问题并在描述中引用这个问题吗? github.com/robertoschwald/grails-audit-logging-plugin/issues

标签: mongodb hibernate grails grails-plugin


【解决方案1】:

请尝试使用最新的 1.0.6-SNAPSHOT 版本。见问题https://github.com/robertoschwald/grails-audit-logging-plugin/issues/91

【讨论】:

    猜你喜欢
    • 2014-03-22
    • 1970-01-01
    • 2014-03-25
    • 1970-01-01
    • 2014-06-21
    • 1970-01-01
    • 1970-01-01
    • 2012-11-12
    • 2015-04-06
    相关资源
    最近更新 更多