Currently, I am developing an REST API extension. For that, I need to create ‘PlatFormSession’.
I inserted the following code to create the session. But it doesn’t create a session. Throws an exception.
PlatformLoginAPI platformLoginAPI = PlatformAPIAccessor.getPlatformLoginAPI()
PlatformSession session = platformLoginAPI.login("username", "password")
What am I doing wrong here?
See the following exception:
SEVERE: Error when executing rest api extension call to apiExtension|GET|synjobdetails
org.bonitasoft.engine.session.InvalidSessionException: Session is null!
at org.bonitasoft.engine.api.impl.ServerAPIImpl.beforeInvokeMethod(ServerAPIImpl.java:214)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:123)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:86)
at com.sun.proxy.$Proxy75.getTenants(Unknown Source)
at com.bonitasoft.engine.api.PlatformAPI$getTenants.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at nz.ac.auckland.bpm.rest.util.BonitaUtil.getTenants(BonitaUtil.groovy:124)
at nz.ac.auckland.bpm.rest.util.BonitaUtil$getTenants.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at nz.ac.auckland.bpm.rest.SyncJobDetailsRestAPI.doHandle(SyncJobDetailsRestAPI.groovy:51)
at org.bonitasoft.console.common.server.page.RestApiRendererExt.doHandle(RestApiRendererExt.java:33)
at org.bonitasoft.console.common.server.page.RestApiRenderer.renderResponse(RestApiRenderer.java:76)
at org.bonitasoft.console.common.server.page.RestApiRenderer.handleRestApiCall(RestApiRenderer.java:60)
at org.bonitasoft.web.rest.server.api.extension.ApiExtensionResource.handleRequest(ApiExtensionResource.java:86)
at org.bonitasoft.web.rest.server.api.extension.ApiExtensionResource.doHandle(ApiExtensionResource.java:42)
at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:683)
at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:357)
at org.restlet.resource.ServerResource.handle(ServerResource.java:1044)
at org.restlet.resource.Finder.handle(Finder.java:236)
at org.restlet.routing.Filter.doHandle(Filter.java:150)
at org.restlet.routing.Filter.handle(Filter.java:197)
at org.restlet.routing.Router.doHandle(Router.java:422)
at org.restlet.routing.Router.handle(Router.java:639)
at org.restlet.routing.Filter.doHandle(Filter.java:150)
at org.restlet.routing.Filter.handle(Filter.java:197)
at org.restlet.routing.Filter.doHandle(Filter.java:150)
at org.restlet.routing.Filter.handle(Filter.java:197)
at org.restlet.routing.Filter.doHandle(Filter.java:150)
at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)
at org.restlet.routing.Filter.handle(Filter.java:197)