Announcement

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

    Cannot set relative webRoot path

    I'm trying to use some SmartClient classes in my tests, and to do that I'm setting webRoot relative to my project's directory, but this fails:

    Code:
    package test;
    
    import com.isomorphic.base.ISCInit;
    import org.junit.jupiter.api.Test;
    
    import static org.junit.jupiter.api.Assertions.assertNotNull;
    
    public class IscInitTest {
        @Test
        void test() {
            System.setProperty("isc_config:webRoot", "src/main/webapp");
            ISCInit.go();
            assertNotNull(com.isomorphic.datasource.DataSource.getBuiltinType("string"));
        }
    }
    Logs:
    Code:
    0:21:41.083 INFO com.isomorphic.base.ISCInit - Using Configured webRoot: src/main/webapp
    00:21:41.083 INFO com.isomorphic.base.ISCInit - Isomorphic SmartClient/SmartGWT Framework (v13.0p_2023-07-29/PowerEdition Deployment 2023-07-29) - Initialization Complete
    00:21:41.083 WARN com.isomorphic.base.ISCInit - Potentially insecure settings: Domain synching is enabled and not restricted to any baseDomains. See the "XSS and CSRF Security" overview in the client reference for details to disable this warning
    Problem loading builtinTypes.xml
    Exception when loading from src/main/webapp/isomorphic/system/schema/builtinTypes.xml:
    java.io.FileNotFoundException: src\main\webapp\src\main\webapp\isomorphic\system\schema\builtinTypes.xml (System nie może odnaleźć określonej ścieżki)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at com.isomorphic.io.file.ISCNativeFile.getInputStream(ISCNativeFile.java:159)
        at com.isomorphic.xml.XML$DocumentCache.loadObjectFromFile(XML.java:418)
        at com.isomorphic.store.ProcessedFileCache.getObjectFromFile(ProcessedFileCache.java:167)
        at com.isomorphic.xml.XML.getXMLDocument(XML.java:438)
        at com.isomorphic.xml.XML.toDSRecords(XML.java:446)
        at com.isomorphic.xml.XML.toDSRecords(XML.java:450)
        at com.isomorphic.xml.XML.toDSRecords(XML.java:455)
        at com.isomorphic.datasource.DataSource.<clinit>(DataSource.java:1365)
        at test.IscInitTest.test(IscInitTest.java:13)
    The file mentioned in logs, "src/main/webapp/isomorphic/system/schema/builtinTypes.xml", does exist, but ISCNativeFile is trying to load an incorrect file "src/main/webapp/src/main/webapp/isomorphic/system/schema/builtinTypes.xml" (note the repeated webRoot location). When i run it under a debugger I saw that this change happens within the chain of XML.toDSRecords calls.
    Last edited by Crack; 16 Aug 2023, 15:33.

    #2
    Relative webRoot path is not allowed, but since it is an existing path we did not report that at startup. To fix this immediately you should use an absolute path.

    That said we are going to change this so that if webRoot is set to a relative path, but it is an existing path and it is a directory, we will detect its absolute path and use as webRoot. This change will be in nightly builds since Aug 25 (tomorrow).

    Comment

    Working...
    X