google-home / smart-home-java

Apache License 2.0
92 stars 47 forks source link

Error when creating devices #6

Closed murilobaliego closed 4 years ago

murilobaliego commented 4 years ago

When I tried to create a device using postman the error below happened. Is not clear for me how the body in postman should look like. Also could be a problem in my database in firebase?

[i~java-smart-home-fd3a3/20200602t182237.427116508645550812].: 2020-06-02 23:11:10 [RequestC30FD3B0] INFO :: doPost, body = { "id": "6", "type": "action.devices.types.SWITCH", "traits": [ "action.devices.traits.OnOff" ], "name": { "defaultNames": [ "Plug Socket" ], "name": "Smart Switch", "nicknames": [ "New Switch" ] }, "deviceInfo": { "manufacturer": "Siddhy Co", "model": "Siddhys On/Off Switch", "hwVersion": "6.0", "swVersion": "7.0.1" }, "willReportState": true, "attributes": { "commandOnlyOnOff": false } }

[i~java-smart-home-fd3a3/20200602t182237.427116508645550812].: 2020-06-02 23:11:10 [RequestC30FD3B0] ERROR:: adding device failed: {} java.lang.NullPointerException at com.example.MyDataStore.addDevice(MyDataStore.java:146) at com.example.SmartHomeCreateServlet.doPost(SmartHomeCreateServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772) at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at com.google.apphosting.runtime.jetty9.ParseBlobUploadHandler.handle(ParseBlobUploadHandler.java:119) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182) at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doHandle(AppEngineWebAppContext.java:187) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:293) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:539) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:213) at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81) at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:134) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:757) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:720) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:690) at com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:882) at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:270) at java.lang.Thread.run(Thread.java:748)

murilobaliego commented 4 years ago

Found that Cloud Firestore was not correcly enabled.