SSH框架整合中读取不到Spring的配置文件

求大神指导 下面附上源码:
错误提示:
严重: 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 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: entity class not found: po.BizClaimVoucherDetail
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.MappingException: entity class not found: po.BizClaimVoucherDetail
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:125)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:191)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:135)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:485)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:133)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:286)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
... 21 more
Caused by: java.lang.ClassNotFoundException: po.BizClaimVoucherDetail
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:122)
... 34 more

Spring配置文件的位置在SRC下创建了一个resource的文件夹

applicationContext.xml的配置文件源码:

<bean id = "sessionFactory" class = "org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name = "configLocation" value="classpath:Hibernate.cfg.xml"></property>
</bean> 


<!-- 实体类的bean   依赖注入-->
<bean id="bizCheckResult" class="com.bdqn.zzt.jboa.entity.BizCheckResult"></bean>
<bean id="bizClaimVoucher" class="com.bdqn.zzt.jboa.entity.BizClaimVoucher"></bean>
<bean id="bizClaimVoucherDetail" class="com.bdqn.zzt.jboa.entity.BizClaimVoucherDetail"></bean>
<bean id="sysDepartment" class="com.bdqn.zzt.jboa.entity.SysDepartment"></bean>
<bean id="sysEmployee" class="com.bdqn.zzt.jboa.entity.SysEmployee"></bean>
<bean id="sysPosition" class="com.bdqn.zzt.jboa.entity.SysPosition"></bean>

<!--数据层的bean  依赖注入  -->
<bean id = "userDaoImpl" class = "com.bdqn.zzt.jboa.dao.UserDaoImpl">
    <property name = "sessionFactory" ref = "sessionFactory"></property>
</bean>


<!--业务层的bean  依赖注入  -->
<bean id = "userBizImpl" class = "com.bdqn.zzt.jboa.biz.UserBizImpl">
    <property name = "userDao" ref = "userDaoImpl"></property>
</bean>


<!-- 事务的管理 -->
<bean id = "transactionManager" class = "org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name = "sessionFactory" ref = "sessionFactory"></property>
</bean>
<tx:advice id = "txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name = "get*" read-only="false"></tx:method>
        <tx:method name = "find*" ></tx:method>
        <tx:method name = "add*" ></tx:method>
        <tx:method name = "save*" ></tx:method>
        <tx:method name = "update*" ></tx:method>
        <tx:method name = "delete*" ></tx:method>
        <tx:method name = "merge" ></tx:method>
    </tx:attributes>
</tx:advice>
<aop:config>
    <aop:pointcut id = "serviceMethod" expression="execution(public * com.bdqn.zzt.jboa.biz.*.*(..))"></aop:pointcut>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"></aop:advisor>
</aop:config>

Web.xml的源码:
 <!--Spring 配置文件的存放位置  -->

<!--
contextConfigLocation
classpath:applicationContext.xml
-->

contextConfigLocation
classpath:applicationContext.xml

<!-- Spring 的监听器 WEB环境中启动Spring容器 -->
<!--
org.springframework.web.context.ContextLoaderListener
-->


org.springframework.web.context.ContextLoaderListener

<!-- OpenSessionInView过滤器的配置 使回sesstion的管理范围增加-->
<!--
OpenSessionInViewFilter
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


OpenSessionInViewFilter
*.action
-->


openSessionInViewFilter
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

sessionFactoryBeanName
sessionFactory



openSessionInViewFilter
*.action

<!--Strurs2的核心过滤器配置 -->
<!--
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


struts2
/*
-->


struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


struts2
/*

5个回答

看看是不是hibernate配置文件的类BizClaimVoucherDetail的路径配置错误了

qq_33432015
雪夜微舞 能具体说一下吗
3 年多之前 回复

检查你的jar包,可能存在多余的jar,或者有低版本的同名jar包要删除

po.BizClaimVoucherDetail类不存在,是不是项目没有编译成功呢?重新clean下项目试试。

没有看见你引入数据源呀,还要你的配置文件Hibernate.cfg.xml的H大写可以检查一下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问