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
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
Comment