【问题标题】:OAUTH2 transaction manager grails mongodbOAUTH2 事务管理器 grails mongodb
【发布时间】:2014-01-16 18:06:49
【问题描述】:

我正在开发一个使用 mongodb、内置在 grails 中并使用 oauth2 作为身份验证服务的应用程序。我已经构建了服务和控制器(我认为)并且正在尝试运行我的服务器以手动测试与谷歌的连接。我遇到了无法解决的“创建名称为 transactionManagerPostProcessor ... 的 bean 时出错”。我知道我需要安装一个为我处理“事务”的插件,或者在 resources.groovy 中创建一个 bean。

我已经对此进行了大量研究和阅读,但在过去的几天里,我一直在努力实现这一目标。谁能告诉我如何解决这个问题、创建正确的 bean 或安装正确的插件?下面是部分堆栈跟踪,带有指向完整堆栈跟踪的链接:

|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
............................................
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Error |
2014-01-16 09:30:52,840 [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 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': Cannot resolve reference to bean 'mongoMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoMappingContext': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/springframework/format/datetime/DateFormatterRegistrar

可以在以下位置找到完整的堆栈跟踪:http://pastebin.com/5mW5uwtu

我已经尝试添加

static transaction = 'mongo'

调用 google 来验证用户身份的服务。这是我在 stackoverflow 上的一个类似问题上找到的解决方案。我还在构建配置中摆弄了不同的插件和依赖项。不知道还有什么可以尝试的。

谢谢!

【问题讨论】:

  • 那是一大堆!作为提示,请考虑将诸如此类的大堆栈粘贴到 pastebin.com 或类似内容中,然后在此处发布链接。
  • 谢谢,会的。可以说,我是新手。

标签: spring mongodb grails oauth2client


【解决方案1】:

为了使用一些插件解决这个问题,我在 resources.groovy 的 beans 块中添加了以下内容

// some plugins need a transaction manager, 
// although the mongo one isn't properly transactional
// and could produce unexpected results in some cases.
springConfig.addAlias('transactionManager', 'mongoTransactionManager')

但是,您看到的具体错误与找不到 Spring 类 DateFormatterRegistrar 有关。您使用的是最新版本的 Grails(例如 2.3+)和 mongo 插件吗?是否在 BuildConfig 中添加了 mongo 插件作为编译插件依赖项?:

compile ":mongodb:1.3.3"

【讨论】:

    猜你喜欢
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多