首页 > j2ee实验报告 - 网上下载的sshdemo在tomcat中部署调试(jsp页面404)

j2ee实验报告 - 网上下载的sshdemo在tomcat中部署调试(jsp页面404)

网上下载的sshdemo在tomcat中部署调试,页面报404

实验介绍

实验目的

网上下载的sshdemo在tomcat中部署调试。

实验内容

网上下载的sshdemo在tomcat中部署调试。

实验状态

jsp页面404。

实验环境

intellij13
tomcat

实验资源

实验过程

工程结构

启动tomcat控制台正常,自动跳出的页面404

访问几个页面也报404

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>test_struts</display-name>
    <!-- 注意: 1、只用在spring中配置了事物才能在web.xml配置openSessionInViewFilter 否则会出错。 2、openSessionInViewFilter必须配置在strutsfilter之前。 -->
    <filter>
        <filter-name>openSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>openSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
   
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    
    
    <listener>
        <listener-class>test.listener.Struts2ListenerOnBAE</listener-class>
    </listener>
    
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

经过排查发现没有部署到webapp中,进行部署

上面图中exploded与Archive选项的区别

  1. exploded archive (development mode)
    这种叫开发模式这是直接把文件夹,jsp页面 ,classes等等移到tomcat 部署文件夹里面,进行加载部署

  2. Packaged Archive(production mode)
    这种叫发布模式,这是先打成war包,再发布

next step

启动项目

输出环境变量。

![图片上传中...]

链接虚拟机,输出环境变量、端口号等配置信息。

部署项目,卡住,查看日志。

next step


restart。

卡主一段时间后继续输出日志。

跳出默认首页。

next step

输入账号密码。

success页面

实验总结

1、

经过几次试验,建议初学者尽量在eclispe中进行试验。原因有:
(1)eclipse对于大部分人来说是已经熟悉的IDE。
(2) meterials about eclipse are more than meterials about about intellij.

2、xml配置调试技巧

控制台未报错,但系统运行404.

故意写错struts.xml配置,发现项目启动控制台仍不报错,说明部署不到位,就此进一步排查

下次实验

 configure database, and fix the bugs of business logic。
【热门文章】
【热门文章】