Discuss / Java / 实测,只装一个插件就可以了。

实测,只装一个插件就可以了。

Topic source

Loading...

#1 Created at ... [Delete] [Delete and Lock User]

实测,只装一个插件就可以了。

  <dependencies>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
       
    </dependencies>

实测,只装一个插件就可以了。另外一个插件tomcat-embed-jasper是对jsp文件的支持,不装这个启动的时候会报个错。但是不影响使用。还有一个注意的点,路径不能重复。因为我把上一节的和这一节的都放在了一个项目里,两个servlet都指向了/,请求/路径的时候tomcat不知道使用哪个servlet进行处理。排查了半天就是没有耐心看报错。还有给大家提醒一下解错的时候从下往上解😂😂

 The servlets named [com.shen.web.ServletMain] and [com.shen.web.tomcat.HelloServlet] are both mapped to the url-pattern [/] which is not permitted

廖雪峰

#2 Created at ... [Delete] [Delete and Lock User]

你是跑过代码的。

Loading...

#3 Created at ... [Delete] [Delete and Lock User]

哈哈,一直在想自己什么时候才能达到廖大这种水平。装插件的时候也在猜这这些插件干了些啥,tomcat-embed-core我能猜到解析http,生成serveSocket啥的,但是另一个插件就不知道了,就想看看不装报什么错 ,再加上百度大概知道了😂


  • 1

Reply