-
Couldn't load subscription status.
- Fork 67
Description
Environment Details
- Transformer Version: org.eclipse.transformer.cli-0.5.0-20220610.152928-25-distribution.jar
- JDK version: 11
- OS: Windows Server 2019, Red Hat Enterprise Linux 7.9
Problem Description
Jakarta EE deployment descriptor is not converted correctly.
ex)web.xml
<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_3_1.xsd"
version="3.1">When this file is converted, the xsd file name and version are not converted.
This web.xml is broken, because it is against the schema(web-app_3_1.xsd).
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_3_1.xsd"
version="3.1">So we cannot deploy the generated application to glassfish.
# glassfish6/glassfish/bin/asadmin deploy /root/EAP/transformer/output_servlet31api001
remote failure: Error occurred during deployment: Exception while deploying the app [output_servlet31api001] : org.xml.sax.SAXParseExceptionpublicId: file:/root/EAP/transformer/glassfish6/glassfish/lib/schemas/web-app_3_1.xsd; lineNumber: 26; columnNumber: 27; Deployment descriptor file WEB-INF/web.xml in archive [output_servlet31api001]. TargetNamespace.1: Expecting namespace 'https://jakarta.ee/xml/ns/jakartaee', but the target namespace of the schema document is 'http://xmlns.jcp.org/xml/ns/javaee'.. Please see server.log for more details.
Command deploy failed.
The correct web.xml working on Jakarta EE 9 is as follows.
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">This is a problem for all Jakarta EE deployment descriptors that use the schema("http://xmlns.jcp.org/xml/ns/javaee" and "http://xmlns.jcp.org/xml/ns/persistence"), not just web.xml.
Steps to reproduce
- An application contains Jakarta EE deployment descriptors listed in the following file.
https://github.com/eclipse/transformer/blob/main/org.eclipse.transformer.jakarta/src/main/resources/org/eclipse/transformer/jakarta/jakarta-text-master.properties - The deployment descriptor uses "http://xmlns.jcp.org/xml/ns/javaee" or "http://xmlns.jcp.org/xml/ns/persistence".
They are written in the following file. https://github.com/eclipse/transformer/blob/main/org.eclipse.transformer.jakarta/src/main/resources/org/eclipse/transformer/jakarta/jakarta-direct.properties - Execute latest transformer to the application which contains the deployment descriptor.
- Deploy the translated application to GlassFish 6 or later.
Cause
The jakarta-direct.properties file contains the following, which is not sufficient.
Version and xsd file name must be converted simultaneously.
# Jakarta EE
http\://xmlns.jcp.org/xml/ns/javaee=https://jakarta.ee/xml/ns/jakartaee# Other
http\://xmlns.jcp.org/xml/ns/persistence=https://jakarta.ee/xml/ns/persistenceWe have two options to fix this problem.
-
Option 1
Stop converting the schema in Jakarta EE deployment descriptor.
On an application server which has old schema files, applications are expected to work without converting the schema location in deployment descriptors. -
Option 2
Create the correct rules file to convert not only schema location but also version and dtd filename
in Jakarta EE deployment descriptor listed in jakarta-text-master.properties.
Impact of Issue
After executing transformer, most Java EE 7 or Jakarta EE 8 applications are not available.
For us, it is a critical problem.