KB Article #180769

Creating a new REST API in a Project throws this error: Problem generating key for: {}: | Unknown Entity: | Couldn't convert ESPK to String:|java.io.IOException|Fail to create portable ESPK as XML pk is null

Problem

Following this scenario:

1. Created a new API Project (without Server Settings)

2. In the new project, defined a dependency to the common project.

3. Created a new http service and port.

4. Opened the REST API Repository, clicked Add and filled in all the required fields of the dialog.

this set of errors were thrown:


INVALID 2019/12/04 15:27:45.677 [main ] [main] [WARN] Problem generating key for: {}:

com.vordel.es.EntityStoreException: Unknown Entity: -7429112697469190821

at com.vordel.es.impl.AbstractEntityStore.getEntity(AbstractEntityStore.java:86)

at com.vordel.es.impl.EntityEncoder.pkToPath(EntityEncoder.java:301)


INVALID 2019/12/04 15:27:45.677 [main ] [main] Couldn't convert ESPK to String:

java.io.IOException: com.vordel.es.EntityStoreException: Unknown Entity: -7429112697469190821

at com.vordel.es.impl.EntityEncoder.pkToPath(EntityEncoder.java:314)

at com.vordel.es.xes.PortableESPKFactory.convertESPKToXML(PortableESPKFactory.java:215)


ERROR 2019/12/04 15:27:45.677 [main ] [main] Fail to create portable ESPK as XML pk is null

INVALID 2019/12/04 15:27:45.678 [main ] [main] java exception:

com.vordel.es.EntityStoreException: Unknown Entity: -7429112697469190821

at com.vordel.es.impl.AbstractEntityStore.getEntity(AbstractEntityStore.java:86)

at com.vordel.es.impl.AbstractEntityStore.getEntity(AbstractEntityStore.java:77)


Resolution

1. Create a common project (with Server Settings) and add a HTTP service listener 'HTTP' with a http port (eg. 8080)
2. Create an API project and add an identical listener 'HTTP' with and identical port
3. Add the dependency between the API Project and the Common project.
4. Close the API project
5. Restart Policy Studio (perhaps not strictly necessary)
6. Reopen the API project
7. Create the Rest API