各位哥哥姐姐们,小弟急求帮助,现在情况是这样的,我在MyEclipse8.0中建了一个java web项目结构是这样的|Demo3.0
|--|src
|--|--|各种包
|--|webroot
|--|--|jsp
|--|--|--|各种页面
|--|--|--|META-INF
|--|--|--|WEB-INF这个是我的struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
  <data-sources>
   <data-source key="dataSource" type="org.apache.commons.dbcp.BasicDataSource">
<set-property value="com.mysql.jdbc.Driver" property="driverClassName" />
<set-property
value="jdbc:mysql://localhost/cnmbdatabase?useUnicode=true&amp;characterEncoding=UTF-8"
property="url" />
<set-property value="root" property="username" />
<set-property value="8517870" property="password" />
</data-source>
  </data-sources>
  <form-beans>
  <!-- 配置用户登录表单 -->
  <form-bean name="loginForm" type="com.cnmb.form.LoginForm"></form-bean>
  <!-- 配置货物注册表单 -->
  <form-bean name="productRegistForm" type="com.cnmb.form.ProductRegistForm"></form-bean>
  <!-- 配置货物日期表单 -->
  <form-bean name="productDateForm" type="com.cnmb.form.ProductDateForm"></form-bean>
  <!-- 配置日期选择表单 -->
  <form-bean name="dateSelectFTForm" type="com.cnmb.form.DateSelectFTForm"></form-bean>
  
  <!-- 配置addUser表单 -->
  <form-bean name="addUserForm" type="com.cnmb.form.AddUserForm"></form-bean>
  <!-- 配置updateProduct表单 -->
  <form-bean name="updateProductForm" type="com.cnmb.form.UpdateProductForm"></form-bean>
  <!-- 配置rootProductRegist表单 -->
  <form-bean name="rootProductRegistForm" type="com.cnmb.form.RootProductRegistForm"></form-bean>
  </form-beans>
  <global-exceptions />
  <global-forwards>
   <!-- 为总部用户全局首页转向 -->
   <forward name="rootsuccess" path="/jsp/root/rootIndex.jsp"></forward>
   <!-- 为支点用户全局首页转向 -->
   <forward name="branchsuccess" path="/jsp/branch/branchIndex.jsp"></forward>
   <!-- 为管理员用户配置全局首页转向 -->
   <forward name="adminsuccess" path="/jsp/back/adminIndex.jsp"></forward>
  
   <!-- 为管理员用户配置全局提示转向 -->
   <forward name="adminprompt" path="/jsp/back/prompt.jsp"></forward>
   <!-- 为总部用户配置全局提示转向 -->
   <forward name="rootprompt" path="/jsp/root/prompt.jsp"></forward>
   <!-- 为支点用户配置全局提示转向 -->
   <forward name="branchprompt" path="/jsp/branch/prompt.jsp"></forward>
  
   <!-- 为回到登录页面全局首页转向 -->
   <forward name="success" path="/jsp/index.jsp"></forward>
  
   <!-- 为总部用户全局error转向 -->
   <forward name="rfailure" path="/jsp/root/rootError.jsp"></forward>
   <!-- 为支点用户全局error转向 -->
   <forward name="bfailure" path="/jsp/branch/branchError.jsp"></forward>
   <!-- 为管理员配置全局error转向 -->
   <forward name="adminfailure" path="/jsp/back/adminError.jsp"></forward>
  
  </global-forwards>
  <action-mappings >
    <action
      attribute="loginForm"
      name="loginForm"
      parameter="method"
      path="/login"
      scope="request"
      type="com.cnmb.action.LoginAction">
      <set-property property="cancellable" value="true" />
      <forward name="login" path="/jsp/userLogin.jsp" />
    </action>
    <action
      attribute="productRegistForm"
      name="productRegistForm"
      parameter="method"
      path="/productRegist"
      scope="request"
      type="com.cnmb.action.ProductRegistAction">
      <set-property property="cancellable" value="true" />
      <forward name="bProRegist" path="/jsp/bProInfListWithDateSelc.jsp" />
      <forward name="temp" path="/jsp/temp.jsp" />
      <forward name="rProRegist" path="/jsp/rProRegist.jsp" />
      <forward name="bRegistPro" path="/jsp/bProRegist.jsp" />
    </action>
    <action
      attribute="productDateForm"
      name="productDateForm"
      parameter="method"
      path="/viewProduct"
      scope="request"
      type="com.cnmb.action.ViewProductAction">
      <set-property property="cancellable" value="true" />
      <forward name="bhistoryCheckedSelc" path="/jsp/bProInfListWithDateSelc2.jsp" />
      <forward name="unchecked" path="/jsp/bProInfListWithDateSelc.jsp" />
      <forward name="rhistoryCheckedSelc" path="/jsp/proInfListWithDateSel.jsp" />
      <forward name="bdone" path="/jsp/bProInfList.jsp" />
      <forward name="historyTotalSelc" path="/jsp/proInfListWithDateSel2.jsp" />
      <forward name="rdone" path="/jsp/proInfList.jsp" />
    </action>
    <action
      attribute="dateSelectFTForm"
      name="dateSelectFTForm"
      parameter="method"
      path="/settleAccount"
      scope="request"
      type="com.cnmb.action.SettleAccountAction">
      <set-property property="cancellable" value="true" />
      <forward name="checked" path="/jsp/accountCheck.jsp" />
      <forward name="dateSelc" path="/jsp/accInfWithDateSel3.jsp" />
    </action>
    <action
      attribute="addUserForm"
      name="addUserForm"
      parameter="method"
      path="/userManager"
      scope="request"
      type="com.cnmb.action.UserManagerAction">
      <set-property property="cancellable" value="true" />
      <forward name="addUser" path="/jsp/back/addUser.jsp" />
      <forward name="userList" path="/jsp/back/userList.jsp" />
      <forward name="updateUser" path="/jsp/back/updateUser.jsp" />
    </action>
    <action
      attribute="updateProductForm"
      name="updateProductForm"
      parameter="method"
      path="/productManager"
      scope="request"
      type="com.cnmb.action.ProductManagerAction">
      <set-property property="cancellable" value="true" />
      <forward name="productList" path="/jsp/back/productList.jsp" />
      <forward name="updateProduct" path="/jsp/back/updateProduct.jsp" />
      <forward name="conditionSelect" path="/jsp/back/conditionSelect.jsp" />
    </action>
    <action
      attribute="rootProductRegistForm"
      name="rootProductRegistForm"
      parameter="method"
      path="/rootProductRegist"
      scope="request"
      type="com.cnmb.action.RootProductRegistAction">
      <set-property property="cancellable" value="true" />
      <forward name="productRegist" path="/jsp/root/productRegist.jsp" />
    </action>
    <action
      parameter="method"
      path="/rootSearchProduct"
      scope="request"
      type="com.cnmb.action.RootSearchProductAction">
      <set-property property="cancellable" value="true" />
      <forward name="productList" path="/jsp/root/productList.jsp" />
      <forward name="conditionSelect" path="/jsp/root/conditionSelect.jsp" />
    </action>
    <action
      parameter="method"
      path="/rootSettleAccount"
      scope="request"
      type="com.cnmb.action.RootSettleAccountAction">
      <set-property property="cancellable" value="true" />
      <forward name="accountList" path="/jsp/root/accountList.jsp" />
      <forward name="conditionSelect2" path="/jsp/root/conditionSelect2.jsp" />
    </action>
    <action
      parameter="method"
      path="/branchProductRegist"
      scope="request"
      type="com.cnmb.action.BranchProductRegistAction">
      <set-property property="cancellable" value="true" />
      <forward name="productRegist" path="/jsp/branch/productRegist.jsp" />
      <forward name="productList" path="/jsp/branch/productList.jsp" />
      <forward name="conditionSelect" path="/jsp/branch/conditionSelect.jsp" />
    </action>
    <action
      parameter="method"
      path="/branchSearchProduct"
      scope="request"
      type="com.cnmb.action.BranchSearchProductAction">
      <set-property property="cancellable" value="true" />
      <forward name="productList2" path="/jsp/branch/productList2.jsp" />
      <forward name="conditionSelect2" path="/jsp/branch/conditionSelect2.jsp" />
    </action>
    <action
      parameter="method"
      path="/branchSettleAccount"
      scope="request"
      type="com.cnmb.action.BranchSettleAccountAction">
      <set-property property="cancellable" value="true" />
      <forward name="conditionSelect3" path="/jsp/branch/conditionSelect3.jsp" />
      <forward name="accountList" path="/jsp/branch/accountList.jsp" />
    </action>
  </action-mappings>  <message-resources parameter="com.cnmb.struts.ApplicationResources" />
</struts-config>这个是我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <filter>
<filter-name>SetCharsetEncodingFilter</filter-name>
<filter-class>com.cnmb.util.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharsetEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>然后我在我的本地Tomcat上运行正常,但是我把它上传到jsp虚拟主机上就出现HTTP Status 404 - Servlet action is not available这个错误,连登录都登不了 ,现在头很大,请问下市什么原因啊,有什么解决办法啊

解决方案 »

  1.   

     <set-property
                    value="jdbc:mysql://localhost/cnmbdatabase?useUnicode=true&amp;characterEncoding=UTF-8"
                    property="url" />
    上传到远程,IP地址应该要改成虚拟主机的IP地址吧。
      

  2.   


    我觉得不是db连接失败的问题吧。还是actionhttp://hi.baidu.com/zhangrg1984/blog/item/a043e61353873f20dc5401ac.html
      

  3.   

    发到本地的话就不需要改这个了——>
    set-property
      value="jdbc:mysql://localhost/cnmbdatabase?useUnicode=true&amp;characterEncoding=UTF-8"
      property="url" />
      

  4.   

    你试着查下tomcat的日志,看下action实际请求的地址是多少?把那个贴上来
      

  5.   

    <forward name="rootsuccess" path="/jsp/root/rootIndex.jsp"></forward>这些路径应该配置成相对路径,或"/工程名/jsp/root/rootIndex.jsp"吧
    因为"/"开头的绝对路径是从服务器的根目录开始的,而不是从工程的根目录开始的,至于你在本地为什么是正常的就不太清楚了 怪怪,只有看了更多的信息才知道了