What is the correct schema to use for web.xml in JBoss EAP 7?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
- Red Hat JBoss Developer Studio (JBDS)
- 11.x
Issue
When we migrate our dynamic web project (version 2.4) to Maven and using the Maven Web project structure (src\main\webapp)
. The maven webapp using project facet dynamic web v_3.1 while our web.xml
is version 2.4. Can we manually change the version in web.xml
to version 3.1? Do they cause any error to our code?
Resolution
Users can manually change the web.xml
to use version 3.1 but must make sure to follow the 3.1 schemas and update the project in JBoss Developer Studio. The XML
for version 3.1 should like the following:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
In JBoss Developer Studio, do the following:
- Right-click the project name, click
Properties
, then clickProject Facets
- Right-click
Dynamic Web Module
, clickUnlock
- Uncheck the box next to
Dynamic Web Project
thenApply and Close
- Modify your
web.xml
using a text editor or in JBoss Developer Studio and Save it - Right-click the project name, go to Maven, then click
Update Project
- Click
OK
when the dialog comes up
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments