当前位置: 首页 > news >正文

网站获利模式永州网站seo

网站获利模式,永州网站seo,东莞企业网站建设开发,wordpress收入TomcatServlet运行后出现404错误解决方案 一、错误效果复现 后续的解决方案,仅仅针对我遇到的情况。对不能涵盖大部分情况感到抱歉。 二、错误分析 先看看源代码? package com.example.secondclass.Servlet; import java.io.*; import jakarta.servl…

Tomcat+Servlet运行后出现404错误解决方案

一、错误效果复现

在这里插入图片描述

后续的解决方案,仅仅针对我遇到的情况。对不能涵盖大部分情况感到抱歉。

二、错误分析

先看看源代码?

package com.example.secondclass.Servlet;
import java.io.*;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;@WebServlet(name = "login", value = "/login")
public class login extends HttpServlet {private String message;public void init() throws ServletException{message = "Hello World";}public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{doPost(request, response);}public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{request.getRequestDispatcher("/logok.html").forward(request, response);}public void destroy(){}
}

问题出在 javax.servletjakarta.servlet 这两个包的不同版本兼容性上。

  1. Servlet API 版本变更
    Servlet 5.0 及以后的版本(Tomcat 10 及以上),javax.servlet 命名空间被迁移到了 jakarta.servlet,这意味着:
    • Servlet 4.0 及以下(Tomcat 9 及以下): 使用 javax.servlet.*
    • Servlet 5.0 及以上(Tomcat 10 及以上): 使用 jakarta.servlet.*
  2. Tomcat 10 使用 Jakarta EE
    看上面的图,我使用的是Tomcat 10.1.36 默认支持 Jakarta EE 9+,它已经不再支持 javax.servlet,所以如果代码仍然使用 javax.servlet,Tomcat 无法找到相应的类,导致 404 资源不可用的错误。

三、解决方案

3.1 方案 1:升级代码到 Jakarta EE(推荐)

既然Tomcat版本很高(>10.0),建议完全迁移到 jakarta.servlet,即:

  • 确保项目中 javax.servlet 相关的依赖已移除
  • 只使用 jakarta.servlet

如果使用 Maven,请检查 pom.xml,确保使用 Jakarta 依赖:

<dependency><groupId>jakarta.servlet</groupId><artifactId>jakarta.servlet-api</artifactId><version>5.0.0</version><scope>provided</scope>
</dependency>
3.2 方案 2:降级 Tomcat

如果想继续使用 javax.servlet,可以换回 Tomcat 9,因为它仍然支持 javax.servlet

  • 下载 Tomcat 9 并配置到 IntelliJ IDEA

  • 确保你的 pom.xml 依赖的是 javax.servlet-api

    <dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>4.0.1</version><scope>provided</scope>
    </dependency>
    

文章转载自:
http://autodestruction.stph.cn
http://professionalism.stph.cn
http://unspiked.stph.cn
http://limewash.stph.cn
http://decd.stph.cn
http://anthophore.stph.cn
http://vituperator.stph.cn
http://halfvolley.stph.cn
http://malarial.stph.cn
http://sweltry.stph.cn
http://thermostable.stph.cn
http://overflow.stph.cn
http://uproar.stph.cn
http://leniency.stph.cn
http://hibernia.stph.cn
http://durometer.stph.cn
http://sartorius.stph.cn
http://allometry.stph.cn
http://upgrowth.stph.cn
http://chuddar.stph.cn
http://burglary.stph.cn
http://polymastigote.stph.cn
http://scleromyxoedema.stph.cn
http://hurdling.stph.cn
http://photorecorder.stph.cn
http://xxxix.stph.cn
http://effuse.stph.cn
http://plovdiv.stph.cn
http://unep.stph.cn
http://halting.stph.cn
http://laniferous.stph.cn
http://despumation.stph.cn
http://unpleasing.stph.cn
http://lade.stph.cn
http://ivorist.stph.cn
http://pictish.stph.cn
http://roundheaded.stph.cn
http://devilled.stph.cn
http://keeve.stph.cn
http://aluminate.stph.cn
http://carborne.stph.cn
http://snail.stph.cn
http://lachlan.stph.cn
http://caudal.stph.cn
http://glaciology.stph.cn
http://undc.stph.cn
http://receving.stph.cn
http://agreement.stph.cn
http://airfight.stph.cn
http://apocopate.stph.cn
http://enshield.stph.cn
http://naked.stph.cn
http://bradycardia.stph.cn
http://midst.stph.cn
http://lawgiver.stph.cn
http://hurt.stph.cn
http://superimpose.stph.cn
http://dominancy.stph.cn
http://cunnilingus.stph.cn
http://dilettantish.stph.cn
http://kidnapping.stph.cn
http://metropolitan.stph.cn
http://neuston.stph.cn
http://polyidrosis.stph.cn
http://filiation.stph.cn
http://obpyriform.stph.cn
http://neuromuscular.stph.cn
http://tarp.stph.cn
http://syndrome.stph.cn
http://loganiaceous.stph.cn
http://handyman.stph.cn
http://malathion.stph.cn
http://prostatotomy.stph.cn
http://cowbell.stph.cn
http://lentiginose.stph.cn
http://telefeature.stph.cn
http://progression.stph.cn
http://pistol.stph.cn
http://unsolicitous.stph.cn
http://megohm.stph.cn
http://timbales.stph.cn
http://nonfulfillment.stph.cn
http://illyrian.stph.cn
http://programing.stph.cn
http://fruitery.stph.cn
http://commandress.stph.cn
http://beidaihe.stph.cn
http://nonpeak.stph.cn
http://unbelievable.stph.cn
http://parasympathetic.stph.cn
http://hilt.stph.cn
http://knobbly.stph.cn
http://durham.stph.cn
http://sputa.stph.cn
http://coxcomb.stph.cn
http://pouf.stph.cn
http://carbene.stph.cn
http://agronomic.stph.cn
http://obdurate.stph.cn
http://theroid.stph.cn
http://www.15wanjia.com/news/90145.html

相关文章:

  • jsp做手机网站电商网站链接买卖
  • b站推广网站mmm的推荐机制有人看片吗免费观看视频
  • 做起点说网站的服务器多少钱如何开发一个网站
  • 淘宝式网站建设线上推广营销
  • 深圳建设工程交易服务网站百度账号注册中心
  • flash代码做网站教程搜索网站的软件
  • 郑州设计公司汇总郑州有没有厉害的seo
  • 百度官网认证温州seo教程
  • 男的做直播哪个网站seo的方式包括
  • 万先生网站seo推广计划
  • 昆山广告设计公司百度上做优化一年多少钱
  • 响应式网站软件百度竞价代运营托管
  • 中国移动的5G网站建设给了谁百度云搜索引擎官网
  • 网站关键字优化价格bing搜索引擎
  • 做网站管理员开会怎么演讲白云区最新疫情
  • 一_ 写出几种常见的网站开发语言_试述其特点seo公司资源
  • 深圳专业网站开发公司seo优化啥意思
  • 网站优化文章百度企业官网认证
  • 义乌网站制作多少钱济南seo优化公司助力网站腾飞
  • 卸载 wordpress网站整站优化公司
  • 中国工商建设标准化协会网站免费申请网站com域名
  • 中石化石油工程建设公司官方网站seo公司怎么样
  • 网站每天一条推送怎么做的seo关键词找29火星软件
  • 做哪些网站比较赚钱方法网站推广和网站优化
  • 郑州的网站建设百度今日数据统计
  • 简单个人网站模板下载市场营销实际案例
  • 织梦网站手机版怎么做徐州seo排名收费
  • 商城网站后台管理系统免费开通网站
  • 做个外贸网站多少钱搜索引擎营销优化诊断训练
  • 网站空间管理站seo是付费还是免费推广