You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse EE 4.7.3环境下无法设置Dynamic Web Project版本为4.0如何解决?

Fixing Dynamic Web Module 4.0 Support in Eclipse EE 4.7.3 (Oxygen)

Hey there, let’s tackle this issue step by step. The root cause here is that Eclipse EE 4.7.3 (Oxygen) doesn’t natively support Servlet 4.0 (which maps to Dynamic Web Module 4.0) — that support was added starting with Eclipse Photon (4.8). But don’t worry, we’ve got two solid ways to get this working with your current setup:

Option 1: Install the Servlet 4.0 Support Update for Eclipse Oxygen

This is the cleanest approach, as it adds official support directly to your Eclipse instance:

  • Open Eclipse, head to Help > Install New Software
  • In the "Work with" dropdown, select the Oxygen update site: http://download.eclipse.org/releases/oxygen
  • Search for Web, XML, Java EE and OSGi Enterprise Development and expand this category
  • Look for the Servlet 4.0 Support feature (it’s usually nested under the Eclipse Java EE Developer Tools subcategory)
  • Check the box next to it, click Next, and follow the prompts to complete the installation
  • Restart Eclipse once the update finishes — you should now see 4.0 as an option when creating a Dynamic Web Project or modifying Project Facets

Option 2: Manually Update Project Configuration Files

If the update doesn’t work for some reason (or you prefer a hands-on approach), you can tweak the project files directly:

  1. Close your project (or Eclipse entirely) to avoid file conflicts
  2. Navigate to your project’s root folder, find the hidden .settings directory
  3. Open org.eclipse.wst.common.project.facet.core.xml in a text editor
  4. Locate the line: <installed facet="jst.web" version="3.1"/>
  5. Change the version to 4.0, so it reads: <installed facet="jst.web" version="4.0"/>
  6. Save the file and reopen your project in Eclipse
  7. Update your web.xml to use the Servlet 4.0 schema (this ensures compatibility):
    Replace the existing root element with this code:
    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
             version="4.0">
    
  8. Verify Tomcat configuration: Go to Window > Preferences > Server > Runtime Environments, select your Tomcat 9.0.6 instance, click Edit — you should now see 4.0 available in the "Dynamic web module version" dropdown

Quick Notes

  • Tomcat 9.0.x fully supports Servlet 4.0, so your server is already compatible — the issue was purely Eclipse’s missing support
  • After making any changes, run a Project > Clean... to ensure all configurations are properly applied

内容的提问来源于stack exchange,提问作者Vladimir M.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:23:20