I'm using the local App Engine and I have a working Endpoint, but when I add the following API, the API Explorer (https://developers.google.com/apis-explorer/?base=http://localhost:8888/_ah/api#p/) doesn't load while the JavaScript console has an unhandled exception.
@ApiMethod(name = "getClientByPublicId")
public Client getClientByPublicId(@Named("publicId") String publicId) {
EntityManager mgr = getEntityManager();
Client client = null;
client = mgr.find(Client.class, publicId);
mgr.close();
return client;
}
Within the Chrome JavaScript console, it doesn't give anything useful because it's minimized
Uncaught java.lang.NullPointerException
(anonymous function)
(anonymous function)
h
(anonymous function)
F.(anonymous function).z.(anonymous function).z.(anonymous function)
_.T.K.__cb
h
c
The whole API Explorer page comes up blank.
I've ran this in debug mode and set a breakpoint within the added API, but it isn't triggered.
If I load the discovery document at http://localhost:8888/_ah/api/discovery/v1/apis/clientendpoint/v1/rest, it fails with the following response.
{
"error" : {
"message" : ""
}
}
If I remove this new API it all works fine, albeit without having the new API.
Anyone know what is causing this?
Update
I stumbled across Google APis Explorer didn't found my available ApiMethod from my app-engine app and it sounds like there may be a path collision, which I don't understand yet but I'm going to try to work on this idea now.
If this may be the issue, the related API is
@ApiMethod(name = "getClient")
public Client getClient(@Named("id") Long id) {
EntityManager mgr = getEntityManager();
Client client = null;
try {
client = mgr.find(Client.class, id);
} finally {
mgr.close();
}
return client;
}
I'll give this a shot and answer my question, unless someone knows different.