Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [classpath:cn/vvexpo/web/entitys/*.hbm.xml] cannot be opened because it does not exist at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872) ~[org.springframework.context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423) ~[org.springframework.context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) ~[org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) ~[org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]小弟在整合ssh时,hibernate映射文件找不到,上面是错误信息,提示说是找不到映射文件。可我明明有啊
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546) ~[org.springframework.beans-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872) ~[org.springframework.context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423) ~[org.springframework.context-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) ~[org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) ~[org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.0.2.RELEASE.jar:3.0.2.RELEASE]小弟在整合ssh时,hibernate映射文件找不到,上面是错误信息,提示说是找不到映射文件。可我明明有啊
说明你配置spring bean时factory-method没配对,自己检查下
<!-- <import resource="classpath:WEB-INF/dwr-context.xml"/> -->
<!-- 二级缓存 -->
<import resource="classpath:cn_core/vvexpo/web/web/cache-context.xml"/>
<!-- 配置mysql中text属性 org.springframework.orm.hibernate3.support.ClobStringType -->
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true" />
<!-- 数据源配置 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<!-- dataSource config -->
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/ssh_demo"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<!-- SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop> <!-- 显示执行sql代码 -->
<prop key="hibernate.cache.use_query_cache">true</prop><!-- 启用二级缓存为true -->
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop><!-- 二级缓存提供的核心包 -->
<prop key="hibernate.format_sql">true</prop><!-- 格式化sql输出 -->
<prop key="hibernate.use_sql_comments">true</prop><!-- 如果开启, Hibernate将在SQL中生成有助于调试的注释信息 -->
<prop key="hbm2ddl.auto">update</prop><!-- 映射实体类hibernate加载时表的操作 -->
<prop key="hibernate.jdbc.batch_size">20</prop><!-- 设定对数据库每次更新,删除, 插入的批次大小 -->
</props>
</property>
<property name="mappingResources">
<list>
<value>classpath*:cn/vvexpo/web/entitys/*.hbm.xml</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.vvexpo.web..*Service.*(..))"
advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.vvexpo.web..*Manager.*(..))"
advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.vvexpo.web..*Dao.*(..))"
advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* cn_core.org.web..*Dao.*(..))"
advice-ref="txAdvice"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save"/>
<tx:method name="save*"/>
<tx:method name="modify*"/>
<tx:method name="remove*"/>
<tx:method name="delete*"/>
<tx:method name="change*"/>
<tx:method name="find*"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
请问大虾那里错了???