Cloud DB Java Server SDK Demo does not compile
alterEgo123 opened this issue · 5 comments
Compiling the Cloud DB Java Server SDK Demo App.java returns the following errors
public class main {
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:19: error: package com.huawei.agc.clouddb.quickstart.model does not exist
import com.huawei.agc.clouddb.quickstart.model.BookEditFields;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:20: error: package com.huawei.agc.clouddb.quickstart.model does not exist
import com.huawei.agc.clouddb.quickstart.model.BookInfo;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:21: error: package com.huawei.agc.clouddb.quickstart.model does not exist
import com.huawei.agc.clouddb.quickstart.model.CloudDBZoneWrapper;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:22: error: package com.huawei.agc.clouddb.quickstart.utils does not exist
import com.huawei.agc.clouddb.quickstart.utils.BookUtils;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:23: error: package com.huawei.agc.clouddb.quickstart.utils does not exist
import com.huawei.agc.clouddb.quickstart.utils.DateUtils;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:24: error: package com.huawei.agconnect.server.clouddb.exception does not exist
import com.huawei.agconnect.server.clouddb.exception.AGConnectCloudDBException;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:25: error: package com.huawei.agconnect.server.clouddb.request does not exist
import com.huawei.agconnect.server.clouddb.request.CloudDBZoneQuery;
^
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:29: error: cannot find symbol
CloudDBZoneWrapper cloudDBZoneWrapper = new CloudDBZoneWrapper();
^
symbol: class CloudDBZoneWrapper
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:29: error: cannot find symbol
CloudDBZoneWrapper cloudDBZoneWrapper = new CloudDBZoneWrapper();
^
symbol: class CloudDBZoneWrapper
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:30: error: cannot find symbol
BookUtils bookUtils = new BookUtils();
^
symbol: class BookUtils
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:30: error: cannot find symbol
BookUtils bookUtils = new BookUtils();
^
symbol: class BookUtils
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:47: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class CloudDBZoneQuery
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:47: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class BookInfo
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:48: error: cannot find symbol
.greaterThan(BookEditFields.PRICE, 55.0);
^
symbol: variable BookEditFields
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:47: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class BookInfo
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:47: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: variable CloudDBZoneQuery
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:51: error: cannot find symbol
} catch (AGConnectCloudDBException e) {
^
symbol: class AGConnectCloudDBException
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:69: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class CloudDBZoneQuery
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:69: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class BookInfo
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:70: error: cannot find symbol
.lessThan(BookEditFields.PUBLISH_TIME, DateUtils.parseDate("1900-01-01 00:00:00 000"));
^
symbol: variable BookEditFields
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:69: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: class BookInfo
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:69: error: cannot find symbol
CloudDBZoneQuery<BookInfo> query = CloudDBZoneQuery.where(BookInfo.class)
^
symbol: variable CloudDBZoneQuery
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:70: error: cannot find symbol
.lessThan(BookEditFields.PUBLISH_TIME, DateUtils.parseDate("1900-01-01 00:00:00 000"));
^
symbol: variable DateUtils
location: class main
src/main/java/com/huawei/agc/clouddb/quickstart/App.java:73: error: cannot find symbol
} catch (AGConnectCloudDBException e) {
^
symbol: class AGConnectCloudDBException
location: class main
25 errors
@alterEgo123 The dependency related to the error exists in the demo and has been imported to the app.java file (for example, the BookInfo class exists in the directory of .\src\main\java\com\huawei\agc\clouddb\quickstart\model).Check whether the compiled demo project is consistent with that in the repo file and try again.for more guides,please refer to documents.
@Mayism Even the JavaScript demo doesn't work. It returns this error
at Function.CloudDBSdkUtils.getCloudGwUrl (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/node_modules/@agconnect/database-server/dist/utils/CloudDBSdkUtils.js:34:56)
at new HttpsCommunicator (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/node_modules/@agconnect/database-server/dist/communicator/https/HttpsCommunicator.js:79:64)
at AGConnectCloudDB.CloudDBService (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/node_modules/@agconnect/database-server/dist/services/CloudDBService.js:29:30)
at new AGConnectCloudDB (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/node_modules/@agconnect/database-server/dist/services/AGConnectCloudDB.js:31:28)
at Function.AGConnectCloudDB.initialize (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/node_modules/@agconnect/database-server/dist/services/AGConnectCloudDB.js:49:37)
at new CloudDBZoneWrapper (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/model/CloudDBZoneWrapper.js:15:38)
at start (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/Start.js:6:32)
at Object.<anonymous> (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/Start.js:56:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
queryBooks=> TypeError: Cannot read property 'executeQuery' of undefined
at CloudDBZoneWrapper.startAtQuery (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/model/CloudDBZoneWrapper.js:114:55)
at start (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/Start.js:36:30)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
queryBooks=> TypeError: Cannot read property 'executeAverageQuery' of undefined
at CloudDBZoneWrapper.averageQuery (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/model/CloudDBZoneWrapper.js:125:55)
at start (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/Start.js:39:30)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
TypeError: Cannot read property 'runTransaction' of undefined
at CloudDBZoneWrapper.deleteOverdueBooks (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/model/CloudDBZoneWrapper.js:143:54)
at start (/home/rsf/Desktop/agc/agc-demos/Server/agc-clouddb-demo-javascript/src/Start.js:44:34)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
CloudDBClient is null, try re-initialize it
CloudDBClient is null, try re-initialize it
I have changed my credentials file and created the Cloud DB Zone as mentioned in the tutorial.
@alterEgo123 the property of 'executeQuery' depends on the javascript server sdk of clouddb. maybe you should integrate it firstly to solve the error.
'undefined' refers to cloudDBZoneClient
in CloudDBZoneWrapper
which is not being initialized, even though I've set credentialPath
and zoneName
Hello, @alterEgo123 can you please provide the full stack trace of the java error. I shall take a look at this for you, lets focus on the java error first. If you do want to look into the javascript as well let's keep it on a separate ticket to avoid confusion.
Thank you!