Announcement

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

    Cannot load DataSource

    Hi,
    I'm trying to load a DataSource by javascript but it seems it cannot find it. I have copied the datasource from your example contactDS.ds.xml and put it into
    src/main/webapp/shared/ds/contactsDS.ds.xml

    I'm using SmartClient 13.0 from 2023-02-23
    Browser = Chrome and Edge

    src/mai/webapp/WEB-INF/jsp/index.jsp looks like

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@ taglib uri="http://www.smartclient.com/taglib" prefix="isomorphic" %>
    <HTML>
    <HEAD>
    <SCRIPT>var isomorphicDir="isomorphic/";</SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Core.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Containers.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Grids.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_Forms.js></SCRIPT>
    <SCRIPT SRC=isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
    <SCRIPT SRC=isomorphic/skins/Stratus/load_skin.js></SCRIPT>
    </HEAD>
    <BODY>
    <SCRIPT SRC=isomorphic/DataSourceLoader?dataSource=contactsDS></SCRIPT>
    <SCRIPT>
    isc.DataSource.load("contactsDS");
    isc.DynamicForm.create({ ID: "contactsForm", left: 50, top: 200, width: 300, dataSource: "contactsDS" });
    //isc.say('loaded');
    </SCRIPT>
    </BODY>
    </HTML>




    The output in the browsers console is
    DevTools failed to load source map: Could not load content for chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND
    localhost/:16 GET http://localhost:8080/isomorphic/Dat...rce=contactsDS net::ERR_ABORTED 404
    ISC_Core.js:1703 [Violation] Avoid using document.write(). https://developers.google.com/web/up...document-write
    isc_c_Page_loadStyleSheet @ ISC_Core.js:1703
    isc.loadSkin @ load_skin.js:22
    (anonymous) @ load_skin.js:2100
    ISC_Core.js:1233 *06:03:50.178:WARN:Log:TypeError: Cannot read properties of undefined (reading 'contactsDS')
    Stack from error.stack:
    [c]DataSource.load(<no args: exited>) on [Class DataSource] @ ISC_DataBinding.js:224:63
    null.<anonymous>(<no args: exited>) @ :18:28

    isc.B.push.isc.A.addToMasterLog @ ISC_Core.js:1233
    isc_c_Log_addLogMessage @ ISC_Core.js:1231
    isc_c_Log_log @ ISC_Core.js:1224
    logMessage @ ISC_Core.js:1213
    logWarn @ ISC_Core.js:1213
    isc__debug__reportJSErrorStack @ ISC_Core.js:1186
    isc__debug__reportJSError @ ISC_Core.js:1186
    window.onerror @ ISC_Core.js:1273
    error (async)
    (anonymous) @ ISC_Core.js:1273
    ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'contactsDS')
    at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
    at (index):18:28
    isc_c_DataSource_load @ ISC_DataBinding.js:224
    (anonymous) @ (index):18
    DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/atoms.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/polyfills.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/escape.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/playback.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/record.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    favicon.ico:1 GET http://localhost:8080/favicon.ico 404
    localhost/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

    But if I remove
    <SCRIPT SRC=isomorphic/DataSourceLoader?dataSource=contactsDS></SCRIPT>
    from index.jsp
    then everything works normally. I get the feeling that id doesn't find the contactsDS.ds.xml file at all.

    $ java --version
    openjdk 19.0.2 2023-01-17
    OpenJDK Runtime Environment (build 19.0.2+7-44)
    OpenJDK 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)

    $ mvn --version
    Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
    Maven home: C:\Program Files\apache-maven-3.9.0
    Java version: 19.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\jdk-19.0.2
    Default locale: en_US, platform encoding: UTF-8
    OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

    My pom.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
    <!-- Your own application should inherit from spring-boot-starter-parent -->
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.7</version>
    <relativePath/>
    </parent>
    <groupId>the_group</groupId>
    <artifactId>the_artifact</artifactId>
    <packaging>war</packaging>
    <name>Spring Boot Web JSP Sample</name>
    <description>Spring Boot Web JSP Sample</description>
    <dependencies>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>
    </dependencies>
    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>
    </project>

    I'm starting my application with
    $ mvn spring-boot:run
    [INFO] Scanning for projects...
    [INFO]
    [INFO] --------------------------< proj_name >---------------------------
    [INFO] Building Spring Boot Web JSP Sample 2.6.7
    [INFO] from pom.xml
    [INFO] --------------------------------[ war ]---------------------------------
    [INFO]
    [INFO] >>> spring-boot:2.6.7:run (default-cli) > test-compile @ gui >>>
    [INFO]
    [INFO] --- resources:3.2.0:resources (default-resources) @ gui ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Using 'UTF-8' encoding to copy filtered properties files.
    [INFO] Copying 1 resource
    [INFO] Copying 3 resources
    [INFO]
    [INFO] --- compiler:3.8.1:compile (default-compile) @ gui ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- resources:3.2.0:testResources (default-testResources) @ gui ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Using 'UTF-8' encoding to copy filtered properties files.
    [INFO] skip non existing resourceDirectory C:\proj_dir\src\test\resources
    [INFO]
    [INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ gui ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] <<< spring-boot:2.6.7:run (default-cli) < test-compile @ gui <<<
    [INFO]
    [INFO]
    [INFO] --- spring-boot:2.6.7:run (default-cli) @ gui ---
    [INFO] Attaching agents: []

    . ____ _ __ _ _
    /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/ ___)| |_)| | | | | || (_| | ) ) ) )
    ' |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot :: (v2.6.7)

    2023-03-15 06:03:44.193 INFO 14172 --- [ main] proj_name.Application : Starting Application using Java 19.0.2 on xxx with PID 14172 (C:\proj_dir\target\classes started by the_user in C:\proj_dir)
    2023-03-15 06:03:44.195 INFO 14172 --- [ main] proj_name.Application : No active profile set, falling back to 1 default profile: "default"
    2023-03-15 06:03:44.836 INFO 14172 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
    2023-03-15 06:03:44.843 INFO 14172 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
    2023-03-15 06:03:44.844 INFO 14172 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.62]
    2023-03-15 06:03:45.066 INFO 14172 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    2023-03-15 06:03:45.077 INFO 14172 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
    2023-03-15 06:03:45.077 INFO 14172 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 846 ms
    2023-03-15 06:03:45.220 INFO 14172 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
    2023-03-15 06:03:45.293 INFO 14172 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
    2023-03-15 06:03:45.300 INFO 14172 --- [ main] proj_name.Application : Started Application in 1.376 seconds (JVM running for 1.625)
    2023-03-15 06:03:49.467 INFO 14172 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
    2023-03-15 06:03:49.467 INFO 14172 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
    2023-03-15 06:03:49.468 INFO 14172 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms


    The iscTabLib.xml and web.xml are copied from your examples

    The server.properties looks like this
    project.datasources: $webRoot/shared/ds
    project.project: $webRoot/shared/ui
    project.ui: $webRoot/shared/ui
    project.apps: $webRoot/shared/app
    Last edited by GraphUser; 14 Mar 2023, 21:49.

    #2
    Hi GraphUser,

    Step one will be to look at how the server responded to the DataSourceLoader call, and the server logs, if any, for that request.

    Without that basic information, we can't say much yet, but it appears as if the servlet either wasn't installed, was installed at a different URL, or failed due to missing dependencies or similar reasons.

    Comment


      #3
      Well, the problem is that it doesn't say anything. You have all the output above.

      Comment


        #4
        Hi GraphUser, see above: "step one will be to look at how the server responded to the DataSourceLoader call,".

        So what's the response, a 404, 500 server error, etc? You can use the built-in browser tools.

        Note that, if you are saying there are no server logs for this at all, then the problem is very likely that the servlet hasn't been installed, or is available at a different URL.

        Comment


          #5
          The browser says:

          DevTools failed to load source map: Could not load content for chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND
          127.0.0.1/:16 GET http://127.0.0.1:8080/isomorphic/Dat...rce=contactsDS net::ERR_ABORTED 404
          ISC_Core.js:1233 *23:12:04.365:INFO:Log:initialized
          ISC_Core.js:1703 [Violation] Avoid using document.write(). https://developers.google.com/web/up...document-write
          isc_c_Page_loadStyleSheet @ ISC_Core.js:1703
          isc.loadSkin @ load_skin.js:22
          (anonymous) @ load_skin.js:2100
          ISC_Core.js:1233 *23:12:04.517:WARN:Log:TypeError: Cannot read properties of undefined (reading 'contactsDS')
          Stack from error.stack:
          [c]DataSource.load(<no args: exited>) on [Class DataSource] @ ISC_DataBinding.js:224:63
          null.<anonymous>(<no args: exited>) @ :18:16

          isc.B.push.isc.A.addToMasterLog @ ISC_Core.js:1233
          isc_c_Log_addLogMessage @ ISC_Core.js:1231
          isc_c_Log_log @ ISC_Core.js:1224
          logMessage @ ISC_Core.js:1213
          logWarn @ ISC_Core.js:1213
          isc__debug__reportJSErrorStack @ ISC_Core.js:1186
          isc__debug__reportJSError @ ISC_Core.js:1186
          window.onerror @ ISC_Core.js:1273
          error (async)
          (anonymous) @ ISC_Core.js:1273
          ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'contactsDS')
          at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
          at (index):18:16
          isc_c_DataSource_load @ ISC_DataBinding.js:224
          (anonymous) @ (index):18
          ISC_Core.js:1233 *23:12:04.601:INFO:Log:isc.Page is loaded
          DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/atoms.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
          DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/polyfills.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
          DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/escape.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
          DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/playback.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
          DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/record.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
          favicon.ico:1 GET http://127.0.0.1:8080/favicon.ico 404

          Comment


            #6
            So that's a 404, as we guessed. There's no mystery here: you're simply not contacting our DataSourceLoader servlet at all!

            Assuming the servlet is installed (as it is by default, and you say you're using the default web.xml), if you're not sure what the correct relative path is in your environment, you could try the dynamic API DataSource.load(), and if that's working, just look at the request that was sent by DataSource.load: there's the correct relative path.

            If you have tried the above, and if you don't know how to determine the correct path to an installed servlet that you have declared, let us know.

            Comment


              #7
              I have already tried all of the above. If I try to load it dynamically I get the response

              DataSource.load('contactsDS')
              ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'contactsDS')
              at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
              at <anonymous>:1:12
              isc_c_DataSource_load @ ISC_DataBinding.js:224
              (anonymous) @ VM1174:1


              DataSource.load()
              ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'undefined')
              at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
              at <anonymous>:1:12
              isc_c_DataSource_load @ ISC_DataBinding.js:224
              (anonymous) @ VM1207:1


              isc.DataSource.load('contactsDS')
              ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'contactsDS')
              at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
              at <anonymous>:1:16
              isc_c_DataSource_load @ ISC_DataBinding.js:224
              (anonymous) @ VM1344:1


              isc.DataSource.load()
              ISC_DataBinding.js:224 Uncaught TypeError: Cannot read properties of undefined (reading 'undefined')
              at Object.isc_c_DataSource_load [as load] (ISC_DataBinding.js:224:63)
              at <anonymous>:1:16
              isc_c_DataSource_load @ ISC_DataBinding.js:224
              (anonymous) @ VM1379:1


              So, where can I see the path?

              Comment


                #8
                There's no need to try variants - as previously discussed, you need to use the browser tools to see what the server's response was.

                These will all be 404s, like the first one. The way you call it doesn't matter. There simply is no servlet there.

                Unfortunately, we can't tell you the correct path, because, it's configured by your environment, not by our software. Also, we can't even tell if you actually installed the servlet, which again is configuration for another piece of software, not our framework.

                So, here's what we'd recommend: between this and your other thread, you're not struggling with our product, you're struggling with servlet engine setup. However, our SDK comes with a preconfigured servlet engine. There are "start" scripts right in the top directory of the SDK that run a servlet engine (it's Tomcat).

                Just run that, and you can immediately start actual work. You can come back to your faulty environment after you've seen how things work when the servlet engine is set up correctly.

                Comment

                Working...
                X