- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我遇到此错误,我找不到解决方案
我在Grails中使用postgres
这是不断发生的错误
org.springframework.beans.factory.BeanCreationException: 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': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=beans.AbsPessoa]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:207)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
at grails.boot.GrailsApp.run(GrailsApp.groovy:374)
at grails.boot.GrailsApp.run(GrailsApp.groovy:363)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at trabalhoestagio.Application.main(Application.groovy:8)
Caused by: 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': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=beans.AbsPessoa]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1481)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1226)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.grails.transaction.TransactionManagerPostProcessor.initialize(TransactionManagerPostProcessor.java:75)
at org.grails.transaction.TransactionManagerPostProcessor.setBeanFactory(TransactionManagerPostProcessor.java:53)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1565)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 20 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=beans.AbsPessoa]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 34 common frames omitted
Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=beans.AbsPessoa]
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:225)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:323)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:196)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.doBuildSessionFactory(HibernateMappingContextSessionFactoryBean.java:476)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.buildSessionFactory(HibernateMappingContextSessionFactoryBean.java:470)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.afterPropertiesSet(HibernateMappingContextSessionFactoryBean.java:93)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 41 common frames omitted
Caused by: java.lang.ClassCastException: org.grails.config.NavigableMap$NullSafeNavigator cannot be cast to java.lang.Boolean
at net.kaleidos.hibernate.PostgresqlExtensionsDialect$TableNameSequenceGenerator.configure(PostgresqlExtensionsDialect.java:60)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
... 50 common frames omitted
Error |
Failed to start server (Use --stacktrace to see the full trace)
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.8.2"
classpath "org.grails.plugins:hibernate4:5.0.5"
}
}
version "0.1"
group "trabalhoestagio"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"asset-pipeline"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
repositories {
jcenter()
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.6"
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2"
runtime "com.h2database:h2"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
compile 'org.grails.plugins:postgresql-extensions:4.6.1'
provided 'org.postgresql:postgresql:9.4-1203-jdbc4'
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
}
hibernate:
dialect: net.kaleidos.hibernate.PostgresqlExtensionsDialect
cache:
queries: false
use_second_level_cache: true
use_query_cache: false
region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
dataSource:
pooled: true
jmxExport: true
driverClassName: org.postgresql.Driver
username: postgres
password: password
url: jdbc:postgresql://localhost:5432/trabalho
dbCreate: update
environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:postgresql://localhost:5432/trabalho
test:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/trabalho
production:
dataSource:
dbCreate: update
url: jdbc:postgresql://localhost:5432/trabalho
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
---
---
grails:
profile: web
codegen:
defaultPackage: trabalhoestagio
spring:
transactionManagement:
proxies: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
groovy:
template:
check-template-location: false
---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none
endpoints:
jmx:
unique-names: true
最佳答案
从您的日志中:
Caused by: java.lang.ClassCastException: org.grails.config.NavigableMap$NullSafeNavigator.....
grails-postgresql-extensions
插件有关
关于grails - 创建名称为 'transactionManager'的bean时出错:无法解析对bean的引用 '' sessionFactory '' while setting bean property ' sessionFactory',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37234578/
我正在尝试 Spring 3(.0.2.RELEASE) 和 JPA2 以及 Hibernate 3.5.1-Final...让我不爽的一件事是 spring 似乎只接受一个名为“transactio
我正在 jUnit4 + spring4 下运行单元测试,事情是:我的 transactionManager 不叫“transactionManager”,它叫“transactionManagerA
我这里有一个基于 Spring MVC 的应用程序。我的同事(顺便说一句,他不在这里)以编程方式配置了它,一切似乎都正常,除了 TransactionManager。我从来没有像这样配置过 Sprin
我在 JSF 2 项目中使用 JPA 2,所以我在 GlassFish v3 中配置了我的数据源,一切都很好,但是如果我尝试在 Hibernate Tools 中测试 JPA 查询,它会给我以下错误:
我最近一直在研究 Jms API,但不确定我是否理解本地与事务管理器的差异。 场景1: 使用来自 Jms 代理的消息,处理消息并在处理成功后提交事务,否则回滚。 场景 2: 我想将消息从一个代理代理到
我需要使用 TransactionManager 和 ResourceManager 实现两阶段提交协议(protocol)。我已经用谷歌搜索了几个小时,但找不到任何有用的东西。我知道协议(proto
我有两个事务管理器,很好奇是否有可能获得已使用的那个。 更具体地说,underlyingMethod(..) 如何找出使用了哪个 transactionManager(无需向其发送附加参数“trans
PROPAGATIO
所以,我已经尝试了很多天来运行我的项目,但没有成功。Spring Boot + Hibernate + JPA。甲骨文数据库。有人可以帮助我吗? 配置属性: hibernate.dialect=org
我正在尝试创建基于 Spring 的解决方案,以便在 MySQL 5.5 服务器上运行批处理 SQL 查询。“查询”是指任何编译的 SQL 语句,因此 SQL 批处理作业可以包含例如多个 CREATE
当我尝试使用 spring 代码创建关系时,我收到事务管理器错误。我在我的项目中使用 Mysql 和 Neo4j 数据库。我尝试了不同的解决方案但无法解决。 org.springframework.b
当我的Grails 2.1应用试图使一个名为ServiceParamService的Grails服务实例化时,它的启动会随着下面的BeanCreationException而启动。我不奇怪没有找到一位
我的 DAO 中的以下代码运行良好。 public void insert(final Person person) { transactionTemplate.execute(new Tra
我有一个处理两个不同数据库实例的项目。对数据库的每次访问都是事务性的,但数据库 1 上的事务不需要链接到数据库 2 上的事务。 我正在使用 Hibernate 和 spring-tx 4.0.3 Re
我有一个我认为是简单的项目,其中我使用 Spring 来管理 JPA,并使用 EclipseLink 作为我的持久性单元。我在前端使用 JavaFX,并将项目分为客户端模块、公共(public)模块和
我已经为此苦苦思索了一段时间,并且有一种我忽略了一些愚蠢的事情的沮丧感觉。我正在尝试使用事务管理器进行非常简单的集成测试,但似乎无法像我认为的那样让它回滚。 被测类: public class Jdb
我有一个基本的 Spring Controller package org.foo; @Controller public class HelloWorldController implements
我正在尝试了解如何使用 Spring DataSourceTransactionManager。 我正在尝试关注这个 example .但是,当我从 Eclipse 启动 Tomcat 时,出现以下错
大家好,我在尝试将 spring 3.0 与 hibernate 3.1 集成时遇到问题,为什么我会收到此类错误。在“HibernateDAO”类中,我只是对“HibernateTemplate”使用
据我了解,DataSourceTransactionManager 将指定数据源的 JDBC 连接绑定(bind)到当前线程,允许每个数据源有一个线程绑定(bind)连接。如果它是连接池,它将采用可用
我是一名优秀的程序员,十分优秀!