• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Null pointer exception when adding a new user

    scheduled pinned locked moved Troubleshooting
    11 posts 3 posters 2.6k views 2 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • D offline
      Daniele
      global:last-edited-by,

      Hi,
      I successfully set up MyController on a Raspberry Pi 3 B, connected to MySensors network through MQTT gateway.

      I'm trying to add a news user for MQTT, just to avoid using admin user in MQTT gateway configuration.

      Every time I try to add a new user, I get a null pointer exception.
      The complete error log is:

      2017-11-07 11:57:17,468 ERROR [Acme.Utils.ThreadPool(5)-PooledThread: Acme.Serve.Serve$ServeConnection@1fd0f5d] [org.mycontroller.standalone.api.jaxrs.exception.mappers.ApplicationExceptionMapper:42] ApplicationException,
      org.jboss.resteasy.spi.ApplicationException: java.lang.NullPointerException: userId
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:152)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
      	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
      	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
      	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException: userId
      	at org.mycontroller.standalone.api.jaxrs.model.AllowedResources.<init>(AllowedResources.java:33)
      	at org.mycontroller.standalone.api.jaxrs.model.AllowedResources$AllowedResourcesBuilder.build(AllowedResources.java:34)
      	at org.mycontroller.standalone.db.tables.User.getAllowedResources(User.java:86)
      	at org.mycontroller.standalone.db.tables.User.toString(User.java:47)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137)
      	at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458)
      	at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328)
      	at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:244)
      	at org.mycontroller.standalone.api.jaxrs.model.UserJson.createOrUpdateUser(UserJson.java:74)
      	at org.mycontroller.standalone.api.jaxrs.SecurityHandler.addUser(SecurityHandler.java:184)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
      	... 15 common frames omitted```
      one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa
        global:last-edited-by,

        @daniele What version of MyController are you using? I remember I fixed this issue already, could you please confirm it with SNAPSHOT version?

        If you face this issue on SNAPSHOT version, could you please open an issue?

        one-reply-to-this-post last-reply-time reply quote 0
        • D offline
          Daniele
          global:last-edited-by,

          I'm using version 1.0.0.Final from https://www.mycontroller.org/#/downloads
          It's my first time with MyController, and I'm not really an expert... so please be patient!
          Should I move to snapshot version? Is it stable enough for "not so expert" user like me?
          What's the easier way to upgrade?

          Thanks a lot
          Daniele

          jkandasaJ T topic:replies-to-this-post, 2 last-reply-time reply quote 0
          • jkandasaJ offline
            jkandasa @Daniele
            global:last-edited-by,

            @daniele steps to upgrade from one version to another version https://forum.mycontroller.org/topic/206/upgrade-to-new-version

            It's my first time with MyController, and I'm not really an expert... so please be patient!

            Welcome to MyControler 🙂
            No worries. I will setup locally and verify this. Thank you!

            one-reply-to-this-post last-reply-time reply quote 0
            • T offline
              Tag MOD @Daniele
              global:last-edited-by,

              @daniele

              Hi Daniele, welcome!!

              I use the snapshot version for a couple of weeks now, it works like a charm and is very stable......👍

              one-reply-to-this-post last-reply-time reply quote 0
              • D offline
                Daniele
                global:last-edited-by,

                I moved to version 1.1.0 snapshot, but I still have the same issue with user creation.

                T one-reply-to-this-post last-reply-time reply quote 0
                • T offline
                  Tag MOD @Daniele
                  global:last-edited-by,

                  @daniele

                  What if you install the snapshot in a new directory with a clean database...
                  do you still have the issue?

                  It might be that you import a "broken" database.....

                  one-reply-to-this-post last-reply-time reply quote 0
                  • D offline
                    Daniele
                    global:last-edited-by,

                    I built it from scratch, not from a backup of the previous version

                    T one-reply-to-this-post last-reply-time reply quote 0
                    • T offline
                      Tag MOD @Daniele
                      global:last-edited-by, Tag

                      @daniele

                      Was able to reproduce your problem!

                      2017-11-17 21:03:39,766 ERROR [Acme.Utils.ThreadPool(0)-PooledThread: Acme.Serve.Serve$ServeConnection@4dc1b0] [org.mycontroller.standalone.api.jaxrs.exception.mappers.ApplicationExceptionMapper:42] ApplicationException,
                      org.jboss.resteasy.spi.ApplicationException: java.lang.NullPointerException: userId
                      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:152)
                      	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                      	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                      	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                      	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                      	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
                      	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
                      	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
                      	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
                      	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
                      	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
                      	at java.lang.Thread.run(Thread.java:748)
                      Caused by: java.lang.NullPointerException: userId
                      	at org.mycontroller.standalone.api.jaxrs.model.AllowedResources.<init>(AllowedResources.java:33)
                      	at org.mycontroller.standalone.api.jaxrs.model.AllowedResources$AllowedResourcesBuilder.build(AllowedResources.java:34)
                      	at org.mycontroller.standalone.db.tables.User.getAllowedResources(User.java:86)
                      	at org.mycontroller.standalone.db.tables.User.toString(User.java:47)
                      	at java.lang.String.valueOf(String.java:2994)
                      	at java.lang.StringBuilder.append(StringBuilder.java:131)
                      	at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137)
                      	at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458)
                      	at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328)
                      	at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:244)
                      	at org.mycontroller.standalone.api.jaxrs.model.UserJson.createOrUpdateUser(UserJson.java:74)
                      	at org.mycontroller.standalone.api.jaxrs.SecurityHandler.addUser(SecurityHandler.java:184)
                      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                      	at java.lang.reflect.Method.invoke(Method.java:498)
                      	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                      	... 15 common frames omitted
                      

                      Do you fill in all fields when creating the user?
                      for the email addres just add a@b.com if there is no email available

                      This error only shows if not all fields are filled.... (at least on my system, using the same version you use..)

                      seems you can use spaces in the username

                      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
                      • jkandasaJ offline
                        jkandasa @Tag
                        global:last-edited-by,

                        @tag @Daniele Thank you. I have created an issue to track this.

                        https://github.com/mycontroller-org/mycontroller/issues/426

                        T one-reply-to-this-post last-reply-time reply quote 0
                        • T offline
                          Tag MOD @jkandasa
                          global:last-edited-by,

                          @jkandasa
                          👍 Thank you!

                          one-reply-to-this-post last-reply-time reply quote 0
                          • first-post
                            last-post

                          0

                          online

                          644

                          users

                          532

                          topics

                          3.4k

                          posts
                          Copyright © 2015-2025 MyController.org | Contributors | Localization