右键项目–Java EE Tools–Generate Deployment Descriptor Stub 操作后会在项目的src/main/webapp/WEB-INF目录下生成web.xml文件,报错就解决了.