首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

HTTP Status 404 - Servlet action is not available

2011-11-25 
struts+Spring+hibernate整合问题要在事例struts1.2+spring2.0+hibernate3.0出现如下问题:HTTP Status 404

struts+Spring+hibernate整合问题
要在事例struts1.2+spring2.0+hibernate3.0出现如下问题:
HTTP Status 404 - Servlet action is not available
--------------------------------------------
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
--------------------------------------------
//strutsconfig.xml配置内容如下:
<struts-config>
  <data-sources />
  <form-beans >
  <form-bean name="loginForm" type="edu.mju.ui.form.LoginForm" />

  </form-beans>

  <global-exceptions />
  <global-forwards />
  <action-mappings >
  <action
  attribute="loginForm"
  input="/login.jsp"
  name="loginForm"
  path="/login"
  scope="request"
  type="org.springframework.web.struts.DelegatingActionProxy">
  <forward name="success" path="/success.jsp"></forward>
  <forward name="fail" path="/fail.jsp"></forward>
  </action>
  </action-mappings>

  <message-resources parameter="edu.mju.ui.ApplicationResources" />
  
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> 
  <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" /> 
  </plug-in>  
  
</struts-config>
//applicationContext.xml配置内容如下:
<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 id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName">
  <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
  </property>
  <property name="url">
  <value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=studb</value>
  </property>
  <property name="username">
  <value>sa</value>
  </property>
  <property name="password">
  <value>123456</value>
  </property>
  </bean>
  
  <!-- 配置SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<!--引用 -->
<ref bean="dataSource" />
</property>

<!-- 映射文件配置 -->
<property name="mappingResources">
<list>
<!-- 映射文件,如果有多个持久化类,则将有多个映射文件 -->
<value>edu/mju/pojo/TbUser.hbm.xml</value>
</list>
</property>

<!-- 配置Hibernate属性 -->
<property name="hibernateProperties">
<props>
<!-- 选择Hibernate使用的方言 -->
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<!-- 在控制台显示Hibernate执行的SQL语句 -->
<prop key="hibernate.show_sql">true</prop>


</props>
</property>
</bean>

<!-- 对象Dao配置 -->
<bean id="userDao" class="edu.mju.service.UserDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
  <!-- Action的配置,接管struts对Action的管理 -->
  <bean name="/login" class="edu.mju.ui.action.LoginAction">
  </bean>
  </beans>

在测试过程中若我将上面的经色部分删除掉见就要吧.一旦将关于sessionFactory配置进行就出错上面提示错误,这是为什么?



[解决办法]
SSH整合先运行一下整合的包是否齐备,再去查业务逻辑是否有错。
[解决办法]
加入log4j 查看详细日志 一定会找到报错信息的

错误的可能:
1.没有配置好
2.类包版本冲突

具体还得看你的日志。

HTTP Status 404 - Servlet action is not available 
-------------------------------------------- 
type Status report 
message Servlet action is not available 
description The requested resource (Servlet action is not available) is not available.
这样的报错 说明你的整个web应用没有启动成功
报错信息远远不止这些;log4j可以提供帮助的

热点排行