matthiasblaesing commented on issue #8520: URL: https://github.com/apache/netbeans/issues/8520#issuecomment-2953072208
Checked this and I see an issue in OpenEJB here. The web application holds this `web.xml`: ```xml <?xml version="1.0" encoding="UTF-8"?> <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_6_0.xsd" version="6.0"> <session-config> <session-timeout> 30 </session-timeout> </session-config> </web-app> ``` This version is accepted by Apache Tomcat, but not by TomEE. This generates an error output like this: <details> <summary> Relevant part (expand for full trace): ``` Caused by: java.lang.NumberFormatException: For input string: " 30 " at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) at java.base/java.lang.Integer.parseInt(Integer.java:654) at java.base/java.lang.Integer.valueOf(Integer.java:999) at org.apache.openejb.jee.SessionConfig$JAXB._read(SessionConfig$JAXB.java:110) at org.apache.openejb.jee.SessionConfig$JAXB.readSessionConfig(SessionConfig$JAXB.java:53) at org.apache.openejb.jee.WebApp$JAXB._read(WebApp$JAXB.java:349) ``` </summary> ``` 07-Jun-2025 22:58:40.599 SCHWERWIEGEND [Catalina-utility-1] org.apache.catalina.core.StandardContext.reload Ausnahme beim Starten des Kontextes [/mavenproject2] org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mavenproject2]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:406) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:179) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3261) at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1460) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1435) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1665) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:299) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:973) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1172) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1176) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1154) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Encountered unknown error parsing the web.xml file: file:/tmp/mavenproject2/target/mavenproject2-1.0-SNAPSHOT/WEB-INF/web.xml: For input string: " 30 " at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2383) at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1226) at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1159) at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4383) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) ... 17 more Caused by: org.apache.openejb.OpenEJBException: Encountered unknown error parsing the web.xml file: file:/tmp/mavenproject2/target/mavenproject2-1.0-SNAPSHOT/WEB-INF/web.xml: For input string: " 30 " at org.apache.openejb.config.ReadDescriptors.readWebApp(ReadDescriptors.java:848) at org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:956) at org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:818) at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:230) at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2381) ... 23 more Caused by: java.lang.NumberFormatException: For input string: " 30 " at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) at java.base/java.lang.Integer.parseInt(Integer.java:654) at java.base/java.lang.Integer.valueOf(Integer.java:999) at org.apache.openejb.jee.SessionConfig$JAXB._read(SessionConfig$JAXB.java:110) at org.apache.openejb.jee.SessionConfig$JAXB.readSessionConfig(SessionConfig$JAXB.java:53) at org.apache.openejb.jee.WebApp$JAXB._read(WebApp$JAXB.java:349) at org.apache.openejb.jee.WebApp$JAXB.read(WebApp$JAXB.java:855) at org.apache.openejb.jee.WebApp$JAXB.read(WebApp$JAXB.java:109) at org.apache.openejb.sxc.Sxc.unmarshall(Sxc.java:160) at org.apache.openejb.sxc.Sxc.unmarhsal(Sxc.java:151) at org.apache.openejb.sxc.Sxc.unmarshalJavaee(Sxc.java:136) at org.apache.openejb.sxc.WebXml.unmarshal(WebXml.java:40) at org.apache.openejb.config.ReadDescriptors.readWebApp(ReadDescriptors.java:840) ... 27 more 07-Jun-2025 22:58:40.599 INFORMATION [Catalina-utility-1] org.apache.catalina.core.StandardContext.reload Reloading Context with name [/mavenproject2] is completed ``` </details> Reformatting the `session-timeout` element to: ```xml <session-timeout>30</session-timeout> ``` makes it work on TomEE too. The question is now: Is the problem in the `web.xml` or in the TomEE parser. Lets have a look at the definition of `session-timeout`. - https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd is referenced from `web.xml`, but does not directly hold the definition. - The definition is in https://jakarta.ee/xml/ns/jakartaee/web-common_6_0.xsd (referenced via the `web-commonType` group): ```xml <xsd:element name="session-timeout" type="jakartaee:xsdIntegerType" minOccurs="0"> <xsd:annotation> <xsd:documentation> The session-timeout element defines the default session timeout interval for all sessions created in this web application. The specified timeout must be expressed in a whole number of minutes. If the timeout is 0 or less, the container ensures the default behaviour of sessions is never to time out. If this element is not specified, the container must set its default timeout period. </xsd:documentation> </xsd:annotation> </xsd:element> ``` - So `session-timeout` is of type `jakartaee:xsdIntegerType`. That is defined in https://jakarta.ee/xml/ns/jakartaee/jakartaee_10.xsd (imported): ```xml <xsd:complexType name="xsdIntegerType"> <xsd:annotation> <xsd:documentation> This type adds an "id" attribute to xsd:integer. </xsd:documentation> </xsd:annotation> <xsd:simpleContent> <xsd:extension base="xsd:integer"> <xsd:attribute name="id" type="xsd:ID"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> ``` - The definition of `xsd:integer` can be found here: https://www.w3.org/TR/xmlschema11-2/#integer. The important part here is the fixed value of `collapse` for the whitespace facet - https://www.w3.org/TR/xmlschema11-2/#rf-whiteSpace indicates, that the treatment of the values should be: - apply `replace` behavior: All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space) - After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and any #x20 at the start or end of the string is then removed. Based on this, the parser should yield us: `30` for an input of: ``` 30 ``` And this is where I see the problem. The whitespace is not collapsed before the value is fed to `Integer#valueOf`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists