eclipse-agail / agile-core

Source code repository for agile core components
Eclipse Public License 2.0
7 stars 16 forks source link

Error on GET `/devices/typeof` #40

Closed craigmulligan closed 7 years ago

craigmulligan commented 7 years ago

{ "code": "INTERNAL_SERVER_ERROR", "message": null }

http://petstore.swagger.io/?url=http://agile-iot.github.io/agile-api-spec/docs/swagger/api.swagger.yml#!/DeviceManager/TypeOf

cskiraly commented 7 years ago

Was the parameter an already discovered thing or something made up? Using the latest image, or compiled by you?

craigmulligan commented 7 years ago

What do you mean by parameter? That endpoint doesn't take any? it should should return an array of devicetypes right? Its latest image.

cskiraly commented 7 years ago

Sounds like we should improve documentation :-( It takes a DeviceOverview, as it comes from discovery. It only gives you the device types that possibly match that specific discovered device.

craigmulligan commented 7 years ago

Okay thanks fixed the call. Now I'm occasionally getting a strange exception, every so often when I hit that endpoint.

agile-core_1  | 20:48:19.683 [qtp22223153-11] ERROR i.a.h.exception.AgileExceptionMapper - Error occured
agile-core_1  | org.freedesktop.dbus.exceptions.DBusExecutionException: Failed to construct outgoing method call: Trying to marshall to unconvertable type (from java.lang.String to 40).
agile-core_1  |     at org.freedesktop.dbus.RemoteInvocationHandler.executeRemoteMethod(Unknown Source)
agile-core_1  |     at org.freedesktop.dbus.RemoteInvocationHandler.invoke(Unknown Source)
agile-core_1  |     at com.sun.proxy.$Proxy36.MatchingDeviceTypes(Unknown Source)
agile-core_1  |     at iot.agile.http.resource.DeviceManager.MatchingDeviceTypes(DeviceManager.java:81)
agile-core_1  |     at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
agile-core_1  |     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
agile-core_1  |     at java.lang.reflect.Method.invoke(Method.java:498)
agile-core_1  |     at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
agile-core_1  |     at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
agile-core_1  |     at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
agile-core_1  |     at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
agile-core_1  |     at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
agile-core_1  |     at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
agile-core_1  |     at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
agile-core_1  |     at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
agile-core_1  |     at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
agile-core_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
agile-core_1  |     at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
agile-core_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
agile-core_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
agile-core_1  |     at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
agile-core_1  |     at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
agile-core_1  |     at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
agile-core_1  |     at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
agile-core_1  |     at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
agile-core_1  |     at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
agile-core_1  |     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
agile-core_1  |     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
agile-core_1  |     at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
agile-core_1  |     at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
agile-core_1  |     at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
agile-core_1  |     at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
agile-core_1  |     at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
agile-core_1  |     at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
agile-core_1  |     at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
agile-core_1  |     at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
agile-core_1  |     at org.eclipse.jetty.server.Server.handle(Server.java:524)
agile-core_1  |     at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
agile-core_1  |     at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
agile-core_1  |     at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
agile-core_1  |     at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
agile-core_1  |     at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
agile-core_1  |     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
agile-core_1  |     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
agile-core_1  |     at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
agile-core_1  |     at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
agile-core_1  |     at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
agile-core_1  |     at java.lang.Thread.run(Thread.java:745)
craigmulligan commented 7 years ago

This happens when I load all the devices in the UI and check which deviceTypes are available.

cskiraly commented 7 years ago

cannot reproduce with current version. Tested with https://github.com/Agile-IoT/agile-core/blob/ee59c975b3b69d7e17dd8dad4fc156dd7ec244a7/test/http/discovered-devicetypes.sh on the REST API and with https://github.com/Agile-IoT/agile-core/blob/ee59c975b3b69d7e17dd8dad4fc156dd7ec244a7/test/discovered-devicetypes.py at the DBus API.