我在ECLIPSE里做测试,在做STRUTS+SPRING时可以正常运行,当加入HIBERNATE时产生,运行后,页面产生HTTP Status 404 - Servlet action is not available,我把applicationContext.xml里产生的HIBERNATE的部分删掉后,又可以正常的把STRUTS+SPRING部分运行出来,请看看这个文件是自动产生的,应该不会有问题吧<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean name="/insert" class="com.ssh.struts.action.InsertAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url">
<value>value="jdbc:mysql://127.0.0.1:3306/mysql"></value>
</property>
<property name="username"> <value>value="root"></value> </property>
<property name="password"> <value>value="123"></value> </property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/dao/Test.hbm.xml</value></list>
</property></bean>
<bean id="TestDAO" class="com.dao.TestDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="Test" class="com.dao.Test" abstract="false"
lazy-init="default" autowire="default" dependency-check="default">
</bean></beans>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean name="/insert" class="com.ssh.struts.action.InsertAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url">
<value>value="jdbc:mysql://127.0.0.1:3306/mysql"></value>
</property>
<property name="username"> <value>value="root"></value> </property>
<property name="password"> <value>value="123"></value> </property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/dao/Test.hbm.xml</value></list>
</property></bean>
<bean id="TestDAO" class="com.dao.TestDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="Test" class="com.dao.Test" abstract="false"
lazy-init="default" autowire="default" dependency-check="default">
</bean></beans>
解决方案 »
- JSTL新手求救,为什么页面不跳转?
- 初学Struts2.0的问题~请教各位大侠~
- 一些面试题目,怎么答
- 用户列表问题
- Ext combox 数据不显示---为什么昨天同样的被删了?!!
- ==========================+天上掉个小馅饼+=============================散分!
- 有没有将torque用到实际项目中的朋友,欢迎加入讨论
- ******在线等待!兄弟们,如何在JSP中插入像DELPHI中DBGrid一样的东东呢?
- 菜鸟求助
- springboot单例登录
- tomcat jsp 怪问题
- MVC结构_JSP通过servlet处理后forward回JSP的路径问题
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url">
<value>value="jdbc:mysql://127.0.0.1:3306/mysql"> </value>
</property>
<property name="username"> <value>value="root"> </value> </property>
<property name="password"> <value>value="123"> </value> </property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect </prop>
<prop key="hibernate.show_sql">true </prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/dao/Test.hbm.xml </value> </list>
</property> </bean>
<bean id="TestDAO" class="com.dao.TestDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
我就把这段删了,STRUTS+SPRING就可以正常运行,上面代码全都照视频做,自动产生的,感觉怎么都不会有错啊,都没手写的
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect </prop>
<prop key="hibernate.show_sql">true </prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/dao/Test.hbm.xml </value> </list>
</property> </bean>
应该主要是这段,这段删了就可以正常运行