zoukankan      html  css  js  c++  java
  • Tomcat源码分析-开篇(Tomcat源码部署运行 Maven方式)

    1.下载tomcat源码

    我这里下载的是 apache-tomcat-8.0.53-src.zip

    2.新建maven工程

    我这里创建一个maven工程,名称为 apache-tomcat-8.0.53-src

    3.pom.xml中添加相关依赖

    <dependency>
        <groupId>ant</groupId>
        <artifactId>ant</artifactId>
        <version>1.6.5</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.birt.runtime.3_7_1</groupId>
        <artifactId>javax.wsdl</artifactId>
        <version>1.5.1</version>
    </dependency>
    
    <dependency>
        <groupId>org.eclipse.jdt</groupId>
        <artifactId>org.eclipse.jdt.core</artifactId>
        <version>3.10.0</version>
    </dependency>
    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxrpc</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest</artifactId>
        <version>2.1</version>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>3.4</version>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
        <scope>test</scope>
    </dependency>
    4.拷贝源码包下的目录
    • 将解压的源码下的 conf目录、webapps目录、拷贝至新建项目的根目录
    • 将解压的源码下的 java目录、test目录 srcmain 目录下
    • 删除webapps目录下的 examples 目录(否则启动的过程中会提示找不到类)
    目录结构如下:
     
     
    5.修改 ContextConfig 中的 configureStart() 方法

    在configureStart() 方法末尾添加这行代码: context.addServletContainerInitializer(new JasperInitializer(), null);

    6.启动

    找到BootStarp 类,执行main方法就可以启动tomcat了

  • 相关阅读:
    学习的原动力
    “六顶思考帽”给我的启示
    关于DataSet与Strongly typed DataSet几点思考(原创)
    设计模式之Singleton和Factory
    CentOS修改网络配置
    Proxmox VE(PVE)安装教程
    CentOS开启SELinux导致samba无法访问的解决办法
    nano编辑器使用教程
    CentOS 如何挂载硬盘
    PVE硬盘直通
  • 原文地址:https://www.cnblogs.com/caoxb/p/12512996.html
Copyright © 2011-2022 走看看