You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Naveen <nb...@tibco.com> on 2017/11/24 09:27:24 UTC
Rest API not working for GET
Hello All
I am using Apache ignite 2.3
I have a cache called ACCOUNT, when I try to execute the rest api with the
bellow URL it does not seems to be working.
<http://10.144.114.113:8080/ignite?cmd=get&key=A000000001&cacheName=Account>
http://10.144.114.113:8080/ignite?cmd=get&key=A000000001&cacheName=Account
this is the error I keep getting
{"successStatus":1,"sessionToken":null,"error":"Failed to handle request:
[req=CACHE_GET, err=com.ril.edif.Account]","response":null}
However, when I execute size command on the same cache, it works fine, here
is the command
<http://10.144.114.113:8080/ignite?cmd=size&cacheName=Account>
http://10.144.114.113:8080/ignite?cmd=size&cacheName=Account
response is
{"successStatus":0,"affinityNodeId":null,"sessionToken":null,"error":null,"r
esponse":9999}
When I query Account cache on sqlline, i could see the data
select * from "Account".Account where Account_id='A000000001';
I could get the response for the above statement
What could be the reason, why this is not working when I execute the rest
api for the same data.
Is it a known bug or I am doing something wrong.
WOuld be great if you can help me out with this issue
Regards, Naveen
91-9561721495
Re: Rest API not working for GET
Posted by Denis Magda <dm...@apache.org>.
Did you create the SQL table using CREATE TABLE command? If it’s so then a cache name won’t be equal to “Person” by default.
Pass “Person” as a cache name directly via CACHE_NAME parameter of CREATE TABLE as explained here:
https://apacheignite-sql.readme.io/docs/create-table
—
Denis
> On Dec 1, 2017, at 4:48 AM, Naveen <na...@gmail.com> wrote:
>
> I have another case where REST APi is not working.
>
> Here is the use case.
> I am using 2.3, have 4 nodes running as server and one node running as
> client and rest api is exposed only in the client.
>
> I was trying to access the client node which is exposing the rest API
>
> Rest API does not seems to be working for the below.
>
> http://10.144.114.115:8080/ignite?cmd=get&key=1&cacheName=Person
>
> {"successStatus":1,"sessionToken":null,"error":"Failed to handle request:
> [req=CACHE_GET, err=Failed to find cache for given cache name:
> Person]","response":null}
>
> at java.lang.Thread.run(Thread.java:748)
> [16:06:26,203][SEVERE][rest-#74%IgnitePOC%][GridCacheCommandHandler] Failed
> to execute cache command: GridRestCacheRequest [cacheName=Person,
> cacheFlags=0, ttl=null, super=GridRestRequest [destId=null, clientId=null,
> addr=/10.139.68.42:55810, cmd=CACHE_GET]]
> class org.apache.ignite.IgniteCheckedException: Failed to find cache for
> given cache name: Person
> at
> org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.localCache(GridCacheCommandHandler.java:815)
> at
> org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.executeCommand(GridCacheCommandHandler.java:738)
> at
> org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.handleAsync(GridCacheCommandHandler.java:440)
> at
> org.apache.ignite.internal.processors.rest.GridRestProcessor.handleRequest(GridRestProcessor.java:266)
> at
> org.apache.ignite.internal.processors.rest.GridRestProcessor.access$100(GridRestProcessor.java:89)
> at
> org.apache.ignite.internal.processors.rest.GridRestProcessor$2.body(GridRestProcessor.java:155)
> at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
>
> 0: jdbc:ignite:thin://10.144.114.113> select * from person;
> +--------------------------------+--------------------------------+--------------------------------+
> | ID | NAME |
> CITY_ID |
> +--------------------------------+--------------------------------+--------------------------------+
> | 3 | Mary Major | 1
> |
> | 1 | John Doe | 3
> |
> | 2 | Jane Roe | 2
> |
> | 4 | Richard Miles | 2
> |
> +--------------------------------+--------------------------------+--------------------------------+
>
> However, for another cache, rest api is working fine.
>
> http://10.144.114.115:8080/ignite?cmd=get&key=P100000007&cacheName=Customer
>
> Here is the list of tables we have in the cluster.
>
> 0: jdbc:ignite:thin://10.144.114.113> !tables
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
> | TABLE_CAT | TABLE_SCHEM |
> TABLE_NAME | TABLE_TYPE | REMARKS
> |
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
> | | PUBLIC | CITY
> | TABLE | |
> | | Account | ACCOUNT
> | TABLE | |
> | | Customer | CUSTOMER
> | TABLE | |
> | | PUBLIC | PERSON
> | TABLE | |
> +--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
>
>
> Thanks
> Naveen
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
RE: Rest API not working for GET
Posted by Naveen <na...@gmail.com>.
I have another case where REST APi is not working.
Here is the use case.
I am using 2.3, have 4 nodes running as server and one node running as
client and rest api is exposed only in the client.
I was trying to access the client node which is exposing the rest API
Rest API does not seems to be working for the below.
http://10.144.114.115:8080/ignite?cmd=get&key=1&cacheName=Person
{"successStatus":1,"sessionToken":null,"error":"Failed to handle request:
[req=CACHE_GET, err=Failed to find cache for given cache name:
Person]","response":null}
at java.lang.Thread.run(Thread.java:748)
[16:06:26,203][SEVERE][rest-#74%IgnitePOC%][GridCacheCommandHandler] Failed
to execute cache command: GridRestCacheRequest [cacheName=Person,
cacheFlags=0, ttl=null, super=GridRestRequest [destId=null, clientId=null,
addr=/10.139.68.42:55810, cmd=CACHE_GET]]
class org.apache.ignite.IgniteCheckedException: Failed to find cache for
given cache name: Person
at
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.localCache(GridCacheCommandHandler.java:815)
at
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.executeCommand(GridCacheCommandHandler.java:738)
at
org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler.handleAsync(GridCacheCommandHandler.java:440)
at
org.apache.ignite.internal.processors.rest.GridRestProcessor.handleRequest(GridRestProcessor.java:266)
at
org.apache.ignite.internal.processors.rest.GridRestProcessor.access$100(GridRestProcessor.java:89)
at
org.apache.ignite.internal.processors.rest.GridRestProcessor$2.body(GridRestProcessor.java:155)
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
0: jdbc:ignite:thin://10.144.114.113> select * from person;
+--------------------------------+--------------------------------+--------------------------------+
| ID | NAME |
CITY_ID |
+--------------------------------+--------------------------------+--------------------------------+
| 3 | Mary Major | 1
|
| 1 | John Doe | 3
|
| 2 | Jane Roe | 2
|
| 4 | Richard Miles | 2
|
+--------------------------------+--------------------------------+--------------------------------+
However, for another cache, rest api is working fine.
http://10.144.114.115:8080/ignite?cmd=get&key=P100000007&cacheName=Customer
Here is the list of tables we have in the cluster.
0: jdbc:ignite:thin://10.144.114.113> !tables
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
| TABLE_CAT | TABLE_SCHEM |
TABLE_NAME | TABLE_TYPE | REMARKS
|
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
| | PUBLIC | CITY
| TABLE | |
| | Account | ACCOUNT
| TABLE | |
| | Customer | CUSTOMER
| TABLE | |
| | PUBLIC | PERSON
| TABLE | |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+-------------------------------+
Thanks
Naveen
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
RE: Rest API not working for GET
Posted by Naveen <nb...@tibco.com>.
It worked after keeping the jar in $IGNITE_HOME/libs folder.
Thanks very much
Regards, Naveen
91-9561721495
From: Alexey Kukushkin [mailto:kukushkinalexey@gmail.com]
Sent: Friday, November 24, 2017 4:57 PM
To: user@ignite.apache.org
Subject: Re: Rest API not working for GET
Hi,
Please make sure:
* com.ril.edif.Account is on the server Ignite's CLASSPATH. You can just deploy the JAR to $IGNITE_HOME/libs/user direcgtory
* com.ril.edif.Account has public getters and setters
Re: Rest API not working for GET
Posted by Alexey Kukushkin <ku...@gmail.com>.
Hi,
Please make sure:
- com.ril.edif.Account is on the server Ignite's CLASSPATH. You can just
deploy the JAR to $IGNITE_HOME/libs/user direcgtory
- com.ril.edif.Account has public getters and setters