spring+struts+hibernate出现这个问题,请大神解惑

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [applicationContext.xml]: 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' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321)

首先,有可能是数据库连接相关的配置有问题,找一个完整的applicationContext.xml的配置文件看看sessionFactory的配置方法。
其次, javax.persistence.JoinColumn.foreignKey()这行错误可能是jar版本不对,当前版本缺少该方法。
不行的话,重新建一个配置正确的项目,再修改试试。

http://blog.csdn.net/w1053288979/article/details/7705383

一般出现这个问题很可能是配置文件的问题,看看你的配置文件里的路径对不对