oracle / nosql-java-sdk

SDK for Java for the Oracle NoSQL Database
https://www.oracle.com/database/nosql/
Universal Permissive License v1.0
24 stars 24 forks source link

Problems running the instruction 'drop table' in Quickstart for Cloud Simulator #4

Closed javierdiegof closed 3 years ago

javierdiegof commented 3 years ago

Hi. Thanks again for your help.

Explanation

I'm trying to run the Quickstart snippet for the Cloud Simulator option and I'm encountering a problem. I'm creating a Maven Project and adding the nosqldriver dependency.

<dependency>
      <groupId>com.oracle.nosql.sdk</groupId>
      <artifactId>nosqldriver</artifactId>
      <version>5.2.27</version>
</dependency>

I'm also creating the Quickstart.java file and running it as expressed in the code. The program successfully creates the table, puts the demo object and reads that same object, but the program breaks when executing the drop table statement.

tableRequest = new TableRequest()
                .setStatement("drop table if exists " + tableName);

handle.doTableRequest(tableRequest,
                      20000,
                     1000);

The stacktrace of the exception thrown is the following:

Acquired handle for service cloudsim at endpoint http://localhost:8080
Created table JavaQuickstart ...
Put row, result non-null Version
Got row, result {"id":123,"name":"joe","data":{"a":1,"b":2}}
Exception in thread "main" oracle.nosql.driver.TableNotFoundException: Table not found: cloudsim:JavaQuickstart
    at oracle.nosql.driver.ops.serde.BinaryProtocol.mapException(BinaryProtocol.java:524)
    at oracle.nosql.driver.http.Client.handleResponseErrorCode(Client.java:1077)
    at oracle.nosql.driver.http.Client.processOKResponse(Client.java:911)
    at oracle.nosql.driver.http.Client.processResponse(Client.java:863)
    at oracle.nosql.driver.http.Client.execute(Client.java:511)
    at oracle.nosql.driver.http.NoSQLHandleImpl.getTable(NoSQLHandleImpl.java:210)
    at oracle.nosql.driver.ops.TableResult.waitForCompletion(TableResult.java:457)
    at oracle.nosql.driver.http.NoSQLHandleImpl.doTableRequest(NoSQLHandleImpl.java:355)
    at com.oracle.Quickstart.main(Quickstart.java:205)

Process finished with exit code 1

The code looks OK, so I'm not able to pinpoint the source of the problem. Any idea how to go about it?

Steps to reproduce the problem

I just created a new project on IntelliJ IDEA using Maven, set the Quickstart file as my main class and ran the code. I'm not adding the jar file to the classpath for executing since I'm using the Maven dependency. I'm using OpenJDK 16 on Oracle Linux 8, the code also fails in OpenJDK 11.

Are you able to reproduce the problem?

Thanks in advance 😊

javierdiegof commented 3 years ago

I encounter the same error when running the BasicTableExample.java with cloudsim option. Equally, the driver says that the table does not exist, even though it was created earlier, and values where put and read from it.

gmfeinberg commented 3 years ago

Hi, Thanks for taking the time to debug the problem and post it here!

The version of the cloud simulator that is posted is quite old and we will be releasing a new one hopefully within a week that will fix this problem. There is no workaround short of ignoring the exception as the table will have been successfully dropped in this path. The issue does not exist in either the cloud service itself or the on-premise product.

Sorry for the confusion.

Regards, George

javierdiegof commented 3 years ago

Hi George. Thanks for answering back, good to know. Will wait for the new version of the cloud simulator to be released then.

gmfeinberg commented 3 years ago

In case you haven't yet seen it there is a new cloud simulator version posted: https://www.oracle.com/downloads/cloud/nosql-cloud-sdk-downloads.html

javierdiegof commented 3 years ago

Thanks, will have a look at it :)