**1、**org.springframework.web.context.support.XmlWebApplicationContext.refresh:544
- Exception encountered during context initialization
- cancelling refresh attempt org.springframework.beans.factory.BeanCreationException:
- Error creating bean with name 'sessionFactory' defined in class path resource
config/hbmSessionFactory.xml]: Invocation of init method failed; nested exception is
ava.lang.NoSuchMethodError: org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.
Lorg/hibernate/boot/spi/MetadataBuildingOptions;)V at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
initializeBean(AbstractAutowireCapableBeanFactory.java:1578)...
该问题是添加了对org.hibernate
hibernate-annotations
3.5.6-Final的依赖
在maven中去对hibernate-annotations的依赖就可以解决该问题
**2、**Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [config/hbmSessionFactory.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor
解决:
transaction-manager="transactionManager"/>
id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
**3、**com.opensymphony.xwork2.util.LocalizedTextUtil.debug:84
- Base class org.apache.catalina.loader.WebappClassLoader doesn
field, trying with parent!java.lang.NoSuchFieldException: resourceEntries at
java.lang.Class.getDeclaredField(Class.java:2070)
问题是tomcat得原因:tomcat8中没有该字段,改用tomcat7就可以。
**4、**Cannot run program "/Applications/tomcat-7.0.64/bin/catalina.sh": error=13, Permission denied
该文件没有执行的权限,添加执行的权限即可:
chmod a+x /Applications/tomcat-7.0.64/bin/catalina.sh
**5、**Invocation of init method failed; nested exception is org.hibernate.boot.
InvalidMappingException: Could not parse mapping document: null
问题在于hibernate mapping的映射出错,必须有id字段,模型中没有id字段添加就可以解决问题
**6** nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
问题由于包冲突引起:
一个包是
<dependency>
<groupId>org.hibernategroupId>
<artifactId>ejb3-persistenceartifactId>
<version>1.0.2.GAversion>
dependency>
一个包hibernate-core依赖的persistence-jpa
解决:去掉ejb3-persistence