Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Jetty 12 Error

    SmartGWT Enterprise 14.1-p20250512

    I'm upgrading to Jetty 12 based on the maven archetype from TBroyer: https://github.com/tbroyer/gwt-maven...ypes/tree/main

    I have my application updated and it starts fine. However, when a ds.xml is loaded, I get an error:

    Code:
    Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 73: .../src/main/webapp/titan/sc/system/schema/fmt:bundle.ds.xml
        at sun.nio.fs.WindowsPathParser.normalize (WindowsPathParser.java:204)
        at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:175)
        at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse (WindowsPath.java:92)
        at sun.nio.fs.WindowsUriSupport.fromUri (WindowsUriSupport.java:166)
        at sun.nio.fs.WindowsFileSystemProvider.getPath (WindowsFileSystemProvider.java:96)
        at java.nio.file.Path.of (Path.java:204)
        at java.nio.file.Paths.get (Paths.java:98)
        at org.eclipse.jetty.util.resource.PathResource.resolve (PathResource.java:294)
        at org.eclipse.jetty.util.resource.CombinedResource.resolve (CombinedResource.java:155)
        at org.eclipse.jetty.ee10.servlet.ServletContextHandler.getResource (ServletContextHandler.java:776)
        at org.eclipse.jetty.ee10.webapp.WebAppContext.getResource (WebAppContext.java:367)
        at org.eclipse.jetty.ee10.maven.plugin.MavenWebAppContext.getResource (MavenWebAppContext.java:370)
        at org.eclipse.jetty.ee10.webapp.WebAppContext$ServletApiContext.getResource (WebAppContext.java:1482)
        at com.isomorphic.io.file.ISCContainerFile.<init> (ISCContainerFile.java:69)
        at com.isomorphic.io.ISCFile.newInstance (ISCFile.java:160)
        at com.isomorphic.io.ISCFile.newInstance (ISCFile.java:182)
        at com.isomorphic.store.DataStructCache.newISCFileInstance (DataStructCache.java:690)
        at com.isomorphic.store.DataStructCache.XMLOrJSFile (DataStructCache.java:661)
        at com.isomorphic.store.DataStructCache.XMLOrJSFile (DataStructCache.java:647)
        at com.isomorphic.store.DataStructCache._getFrameworkInstanceFile (DataStructCache.java:608)
        at com.isomorphic.store.DataStructCache._getInstanceFile (DataStructCache.java:482)
        at com.isomorphic.store.DataStructCache.getInstanceFile (DataStructCache.java:345)
        at com.isomorphic.datasource.DataSource.loadDS (DataSource.java:611)
        at com.isomorphic.datasource.DataSource.forName (DataSource.java:577)
        at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject (PoolableDataSourceFactory.java:127)
        at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject (PoolableDataSourceFactory.java:152)
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject (GenericKeyedObjectPool.java:1220)
        at com.isomorphic.pool.PoolManager.borrowObject (PoolManager.java:90)
        at com.isomorphic.datasource.DataSourceManager._getDataSource (DataSourceManager.java:214)
        at com.isomorphic.datasource.DataSourceManager.getDataSource (DataSourceManager.java:163)
        at com.isomorphic.datasource.ValidationContext.getType (ValidationContext.java:453)
        at com.isomorphic.datasource.BasicDataSource.findDataSource (BasicDataSource.java:3895)
        at com.isomorphic.datasource.BasicDataSource.getType (BasicDataSource.java:3818)
        at com.isomorphic.datasource.BasicDataSource.findElementType (BasicDataSource.java:3507)
        at com.isomorphic.datasource.BasicDataSource.elementAsRecord (BasicDataSource.java:2459)
        at com.isomorphic.datasource.BasicDataSource.toRecord (BasicDataSource.java:2203)
        at com.isomorphic.datasource.BasicDataSource.handleExtraElementValue (BasicDataSource.java:3103)
        at com.isomorphic.datasource.BasicDataSource.elementAsRecord (BasicDataSource.java:2978)
        at com.isomorphic.datasource.BasicDataSource.toRecord (BasicDataSource.java:2203)
        at com.isomorphic.datasource.BasicDataSource.toRecords (BasicDataSource.java:2162)
        at com.isomorphic.datasource.DataSource.recordsFromXML (DataSource.java:2929)
        at com.isomorphic.xml.XML.toDSRecords (XML.java:529)
        at com.isomorphic.xml.XML.toDSRecords (XML.java:515)
        at com.isomorphic.xml.XML$RecordsFromXMLCache.loadObjectFromFile (XML.java:715)
        at com.isomorphic.store.ProcessedFileCache.loadAndUnwrapObjectFromFile (ProcessedFileCache.java:222)
        at com.isomorphic.store.ProcessedFileCache.getObjectFromFile (ProcessedFileCache.java:177)
        at com.isomorphic.xml.XML.loadCacheableDSRecords (XML.java:727)
        at com.isomorphic.store.DataStructCache.loadInstance (DataStructCache.java:220)
        at com.isomorphic.datasource.DataSource.loadDS (DataSource.java:617)
        at com.isomorphic.datasource.DataSource.forName (DataSource.java:577)
        at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject (PoolableDataSourceFactory.java:127)
        at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject (PoolableDataSourceFactory.java:152)
        at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject (GenericKeyedObjectPool.java:1220)
        at com.isomorphic.pool.PoolManager.borrowObject (PoolManager.java:90)
        at com.isomorphic.datasource.DataSourceManager._getDataSource (DataSourceManager.java:214)
        at com.isomorphic.datasource.DataSourceManager.getDataSource (DataSourceManager.java:163)
        at com.isomorphic.datasource.DataSourceManager.getDataSource (DataSourceManager.java:121)
        at com.isomorphic.datasource.DSRequest.getDataSource (DSRequest.java:4091)
    All of our datasources have the "fmt:bundle" declaration in them like this:

    Code:
    <DataSource ID="FrameMeasurement"
                serverType="sql"
                tableName="frame_measurement"
                dropExtraFields="false"
                xmlns:fmt="WEB-INF/">
        <fmt:bundle basename="shared.Messages"/>
    I'm including jakarta.servlet.jsp.jstl-api:3.0.2 in our server, but still gets that error. Is there any fix for this?

    #2
    We think what's going on is that Jetty 12.0 is naively passing fmt:bundle into Paths.get() without sanitization, then if you are on Windows, "fmt:" looks like an invalid drive letter.

    A workaround would be to use:

    Code:
         xmlns:fmt="/WEB-INF/"
    .. because the leading slash should have no effect on resource lookups, but will work around Jetty's behavior here.

    Please let us know if that solves the problem and your i18n resources still load.

    Comment


      #3
      I tried that change, I still get the same error:

      Code:
      Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 73: .../titan-server/src/main/webapp/titan/sc/system/schema/fmt:bundle.ds.xml
          at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204) ~[?:?]
          at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175) ~[?:?]
          at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[?:?]
          at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[?:?]
          at java.base/sun.nio.fs.WindowsUriSupport.fromUri(WindowsUriSupport.java:166) ~[?:?]
          at java.base/sun.nio.fs.WindowsFileSystemProvider.getPath(WindowsFileSystemProvider.java:96) ~[?:?]
          at java.base/java.nio.file.Path.of(Path.java:204) ~[?:?]
          at java.base/java.nio.file.Paths.get(Paths.java:98) ~[?:?]

      Comment


        #4
        OK, to explain what's happening: SmartGWT's .ds.xml engine encounters the <fmt:bundle> XML tag and looks for a schema file for that tag, which would have the name "fmt:bundle.ds.xml".

        Even though we're calling ServletContext.getResource(), this causes Jetty to checks the actual filesystem, presumably because you are running in "exploded war" mode or similar.

        At that point Windows (or really the Java code that is about to call native Windows APIs) throws an exception, because ":" is an illegal character in Windows file names, even if the drive letter is already unambiguously specified at the beginning of the path.

        It's too bad it throws an Exception instead of just indicating there is no such file, especially when the caller is getResource() (!!!!). That makes this is a Jetty bug, because JAR paths are not restricted to Windows-valid chars, so getResource() should not be blowing up - that effectively means you can't put anything in a .jar that doesn't follow Windows' filename conventions!

        But oh well, we'll have to work around it: we'll specify that schema IDs cannot have characters that are disallowed in Windows file names, and put in a backcompat release note and backcompat flag for people who don't care about Windows.

        We should have this in place within a couple of days. In the meantime, if you're blocked, you may be able to put Jetty in a mode where getResource() does not try to hit the filesystem, and only looks in .jars.

        ChatGPT tells us this is not possible via Jetty settings but may be possible like so (context is the servletContext). We haven't tested this and it could be a hallucination:

        Code:
        context.setBaseResource(Resource.newClassPathResource("/webapp"));

        Comment


          #5
          I don't see that method in ServletContext. We're blocked in an upgrade to Jetty 12, but that's not something that has to happen on a timeline. We can wait for the change, thank you!

          Comment


            #6
            Sounds good.

            Just for background it's this API:

            https://docs.oracle.com/cd/E17802_01...va.lang.String)

            .. and it's how you get the resources that were deployed (in .jars) with your app, in deployments where you are not allowed to access the filesystem.

            Comment


              #7
              This should be fixed now, in 14.1 and 15.0 builds as of tomorrow, June 4th. Please try your case with a new build and let us know, thanks.

              Comment


                #8
                That worked! Thank you very much for the quick fix

                Comment

                Working...
                X