最近在开发单点登录CAS时,将默认内存存放票据改为了数据库存放,CAS本身支持的,结果报下面的错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ticketRegistry' defined in ServletContext resource [/WEB-INF/spring-configuration/ticketRegistry.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring-configuration/ticketRegistry.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: CasPersistence] Unable to build EntityManagerFactory
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring-configuration/ticketRegistry.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: CasPersistence] Unable to build EntityManagerFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
Truncated. see log file for complete stacktrace
Caused By: javax.persistence.PersistenceException: [PersistenceUnit: CasPersistence] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
Truncated. see log file for complete stacktrace
Caused By: org.hibernate.HibernateException: Missing sequence or table: SEQ_UM_RS
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1141)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
Truncated. see log file for complete stacktrace
SEQ_UM_RS这个序列名是我后来修改的,原本使用的是HIBERNATE默认的HIBERNATE_SEQUENCE,但由于我们其它系统已经有在使用这个序列了,所以需要重新创建一个。
我们的数据库用户有两个,一个是XXDATA用户,一个是XXOPR用户,前者用于管理相关表的创建,权限较大,后者只有相关的使用权限,表的URD等。
SEQ_UM_RS序列是用XXDATA用户创建的,然后创建同义词,再授权给XXOPR用户,一切都很正常,但是程序在布署后就报上面的错误。
最终查找原因为HIBERNATE方言设置的问题
org.hibernate.dialect.OracleDialect设置为这个时会报错
org.hibernate.dialect.Oracle10gDialect设置为这个时则正常
原因有可能OracleDialect不支持间授权,再使用同义词的方式。
分享到:
相关推荐
Hibernate Session 绑定线程解决方案 在 Java web 开发中, Hibernate 是一个非常流行的 ORM(Object-Relational Mapping)框架,用于将 Java 对象映射到关系数据库中。然而,在使用 Hibernate 进行数据库操作时,...
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/...
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.connection.C3P0ConnectionProvider] at org.hibernate.engine.jdbc.connections.internal....
3. `org.hibernate.HibernateException`:Hibernate抛出的异常类。 4. `org.hibernate.Query`和`org.hibernate Criteria`:用于执行HQL(Hibernate Query Language)和Criteria API查询,比直接使用SQL更加灵活。 ...
query.setHint("org.hibernate.fetchSize", 20); // 设置查询结果集大小 query.setFetchSize(20); List<Game> games = query.list(); tx.commit(); } catch (HibernateException e) { if (tx != null) { tx....
由于项目需求的需要,我们引入了连接池。...我们采用了Hibernate,所以可以考虑hibernate自带的连接池机制,但是发现效率不高,而且Hibernate也推荐使用c3p0或Proxool连接池,在我们的项目中采用了Proxool
错误表现:在初始化SessionFactory时,可能出现“org.hibernate.HibernateException: Could not instantiate dialect class”等异常,这通常是因为Hibernate配置文件中的dialect设置不正确或对应的JDBC驱动未引入。...
18. class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 19. <property name="dataSource" ref="dataSource" /> 20. <property name="hibernateProperties"> 21. <props> 22...
2、报错:org.hibernate.HibernateException: No Session found for current thread 意思是必须在transcation.isActive()条件下才能执行, 可以解决办法是:当方法不需要事务支持的时候,使用 Session ...
3. org.hibernate.HibernateException: No CurrentSessionContext configured! 该异常的解决方法是添加 hibernate-jpa-2.0-api-1.0.0.Final.jar。这是因为 Hibernate 需要配置 CurrentSessionContext,以便正确地...
"GeneratingArtifacts" org.hibernate.HibernateException: ProxoolProvider unable to load JAXP configurator file: proxool_mysql.xml ``` **解析:** 这个错误提示表明,在使用Proxool作为连接池提供者时,...
import org.hibernate.HibernateException; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; ``` 2. **类声明:** ```java public class HibernateUtil { ``` 3. **静态...
错误八:Exception in thread "main" org.hibernate.HibernateException: More than one row with the given identifier was found: 1, for class: org.model.User 错误原因:这个错误表示在尝试获取主键为1的实体...
5. 异常处理:Hibernate将SQL异常转换为特定的HibernateException,便于理解和处理。 总之,Hibernate 5.4.25为Java开发者提供了强大的数据持久化解决方案,通过合理的jar包配置和应用,可以极大地提升开发效率,...
3. Session:Hibernate的Session接口是操作数据库的主要接口,它负责管理对象的状态,并处理事务。 4. Configuration:配置对象用于加载Hibernate的配置信息,如数据库连接参数等。 5. Hibernate.cfg.xml:配置文件...
3. 异常体系:Hibernate有自己的异常体系,如HibernateException、ConstraintViolationException等,便于捕获和处理错误。 综上所述,Hibernate帮助文档详尽地介绍了如何在Java应用中有效地利用ORM技术,提升开发...
import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.cfg.Configuration; /** * Configures and provides access to Hibernate sessions, tied to the * current ...
public org.hibernate.classic.Session getCurrentSession() throws HibernateException { if (currentSessionContext == null) { throw new HibernateException("No CurrentSessionContext configured!"); } ...