用myeclipse建立基于ssh的javaweb工程不能访问起始页面问题。 5
严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframewor...
严重: 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.InvalidMappingException: Unable to read XML
.................................
applicationContext.xml的配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans
...............">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/jxc"></property>
<property name="username" value="root"></property>
<property name="password" value="qinx"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>db/User.hbm.xml</value></list>
</property></bean>
<bean id="UserDAO" class="db.UserDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
.......
</beans> 展开
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.InvalidMappingException: Unable to read XML
.................................
applicationContext.xml的配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans
...............">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/jxc"></property>
<property name="username" value="root"></property>
<property name="password" value="qinx"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>db/User.hbm.xml</value></list>
</property></bean>
<bean id="UserDAO" class="db.UserDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
.......
</beans> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询