Karaf
  1. Karaf
  2. KARAF-1541

jaas:realm-manage raises a NullPointerException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.7, 2.3.0, 3.0.0
    • Fix Version/s: 2.3.0, 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      With Karaf 3.0.0, when performing:

      jaas:realm-manage --realm karaf

      we get:

      java.lang.NullPointerException
      at org.apache.karaf.jaas.command.JaasCommandSupport.findEntryByRealmAndName(JaasCommandSupport.java:96)
      at org.apache.karaf.jaas.command.ManageRealmCommand.doExecute(ManageRealmCommand.java:60)
      at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)
      at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)
      at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_26]
      at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)
      at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)
      at org.apache.karaf.shell.console.commands.$BlueprintCommand316217735.execute(Unknown Source)
      at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
      at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)
      at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)
      at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
      at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
      at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
      at org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:169)
      at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.doRun(ConsoleFactoryService.java:87)[39:org.apache.karaf.shell.console:3.0.0.SNAPSHOT]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3$1.run(ConsoleFactoryService.java:78)
      at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_26]
      at javax.security.auth.Subject.doAs(Subject.java:337)[:1.6.0_26]
      at org.apache.karaf.shell.console.impl.jline.ConsoleFactoryService$3.run(ConsoleFactoryService.java:76)[39:org.apache.karaf.shell.console:3.0.0.SNAPSHOT]

        Activity

        Hide
        Jean-Baptiste Onofré added a comment -
        • On Karaf 2.2.x:
        • I have only one realm, that I can manage using jaas:manage command
        • However, if jaas:manage --index 1 or jaas:manage --realm karaf work, I can't do:

        karaf@root> jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
        Could not find module: org.apache.karaf.jaas.modules.properties.PropertiesLoginModule in realm:karaf

        • On Karaf 2.3.x and Karaf 3.0.x:
        • karaf@root> jaas:manage --index 1
          Error executing command: java.lang.NullPointerException
          java.lang.NullPointerException
          at org.apache.karaf.jaas.command.JaasCommandSupport.findEntryByRealmAndName(JaasCommandSupport.java:100)[39:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT]
          at org.apache.karaf.jaas.command.ManageRealmCommand.doExecute(ManageRealmCommand.java:65)[39:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT]
          at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at org.apache.karaf.shell.console.jline.Console.run(Console.java:167)[26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
          at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]
        • karaf@root> jaas:manage --realm karaf
          Error executing command: java.lang.NullPointerException
          (same as previous)
        • karaf@root> jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
          Could not find module: org.apache.karaf.jaas.modules.properties.PropertiesLoginModule in realm:karaf
        Show
        Jean-Baptiste Onofré added a comment - On Karaf 2.2.x: I have only one realm, that I can manage using jaas:manage command However, if jaas:manage --index 1 or jaas:manage --realm karaf work, I can't do: karaf@root> jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule Could not find module: org.apache.karaf.jaas.modules.properties.PropertiesLoginModule in realm:karaf On Karaf 2.3.x and Karaf 3.0.x: karaf@root> jaas:manage --index 1 Error executing command: java.lang.NullPointerException java.lang.NullPointerException at org.apache.karaf.jaas.command.JaasCommandSupport.findEntryByRealmAndName(JaasCommandSupport.java:100) [39:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT] at org.apache.karaf.jaas.command.ManageRealmCommand.doExecute(ManageRealmCommand.java:65) [39:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT] at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.karaf.shell.console.jline.Console.run(Console.java:167) [26:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at java.lang.Thread.run(Thread.java:662) [:1.6.0_26] karaf@root> jaas:manage --realm karaf Error executing command: java.lang.NullPointerException (same as previous) karaf@root> jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule Could not find module: org.apache.karaf.jaas.modules.properties.PropertiesLoginModule in realm:karaf
        Hide
        Jean-Baptiste Onofré added a comment -

        Regarding the Karaf 2.2.x issue, the login module name displayed in jaas:realms (org.apache.karaf.jaas.modules.properties.PropertiesLoginModule) doesn't correspond with the "real" one (org.apache.karaf.jaas.boot.ProxyLoginModule). I'm digging around that.

        Show
        Jean-Baptiste Onofré added a comment - Regarding the Karaf 2.2.x issue, the login module name displayed in jaas:realms (org.apache.karaf.jaas.modules.properties.PropertiesLoginModule) doesn't correspond with the "real" one (org.apache.karaf.jaas.boot.ProxyLoginModule). I'm digging around that.
        Hide
        Jürgen Kindler added a comment -

        Does not look fixed to me in 2.3.0 SNAPSHOT (apache-karaf-2.3.0-20120919.001705-108.tar.gz )

        2012-09-19 15:14:06,136 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.FrameworkMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=framework,version=1.5
        2012-09-19 15:14:06,137 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.compendium:service=cm,version=1.3
        2012-09-19 15:14:06,138 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.PackageStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=packageState,version=1.5
        2012-09-19 15:14:06,138 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=bundleState,version=1.5
        2012-09-19 15:14:06,140 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=serviceState,version=1.5
        2012-09-19 15:14:08,121 | INFO | l Console Thread | Console | araf.shell.console.jline.Console 196 | 14 - org.apache.karaf.shell.console - 2.3.0.SNAPSHOT | Exception caught while executing command
        java.lang.NullPointerException
        at org.apache.karaf.jaas.command.JaasCommandSupport.findEntryByRealmAndName(JaasCommandSupport.java:98)[44:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT]
        at org.apache.karaf.jaas.command.ManageRealmCommand.doExecute(ManageRealmCommand.java:60)[44:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT]
        at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at org.apache.karaf.shell.console.jline.Console.run(Console.java:172)[14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT]
        at java.lang.Thread.run(Thread.java:680)[:1.6.0_35]

        Show
        Jürgen Kindler added a comment - Does not look fixed to me in 2.3.0 SNAPSHOT (apache-karaf-2.3.0-20120919.001705-108.tar.gz ) 2012-09-19 15:14:06,136 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.FrameworkMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=framework,version=1.5 2012-09-19 15:14:06,137 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.compendium:service=cm,version=1.3 2012-09-19 15:14:06,138 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.PackageStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=packageState,version=1.5 2012-09-19 15:14:06,138 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=bundleState,version=1.5 2012-09-19 15:14:06,140 | INFO | JMX OSGi Agent | core | ? ? | 28 - org.apache.aries.jmx.core - 1.0.0 | Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@71f6f0bf with name osgi.core:type=serviceState,version=1.5 2012-09-19 15:14:08,121 | INFO | l Console Thread | Console | araf.shell.console.jline.Console 196 | 14 - org.apache.karaf.shell.console - 2.3.0.SNAPSHOT | Exception caught while executing command java.lang.NullPointerException at org.apache.karaf.jaas.command.JaasCommandSupport.findEntryByRealmAndName(JaasCommandSupport.java:98) [44:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT] at org.apache.karaf.jaas.command.ManageRealmCommand.doExecute(ManageRealmCommand.java:60) [44:org.apache.karaf.jaas.command:2.3.0.SNAPSHOT] at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at org.apache.karaf.shell.console.jline.Console.run(Console.java:172) [14:org.apache.karaf.shell.console:2.3.0.SNAPSHOT] at java.lang.Thread.run(Thread.java:680) [:1.6.0_35]
        Hide
        Jürgen Kindler added a comment -

        Seems that

        jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule;

        is a possible workaround.

        Could it be that we just need org.apache.karaf.jaas.modules.properties.PropertiesLoginModule as a (sensible?) default for the module and everything works for now?

        Show
        Jürgen Kindler added a comment - Seems that jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule; is a possible workaround. Could it be that we just need org.apache.karaf.jaas.modules.properties.PropertiesLoginModule as a (sensible?) default for the module and everything works for now?
        Hide
        Jean-Baptiste Onofré added a comment -

        It's not a workaround, it's the way to use it now. Previously we had only one login module (the PropertiesLoginModule), but now, we introduce the agent login module, that's why you have to provide the login module that you want to manage.

        However, I will enhance to avoid the NullPointerException.

        Show
        Jean-Baptiste Onofré added a comment - It's not a workaround, it's the way to use it now. Previously we had only one login module (the PropertiesLoginModule), but now, we introduce the agent login module, that's why you have to provide the login module that you want to manage. However, I will enhance to avoid the NullPointerException.
        Hide
        Jürgen Kindler added a comment -

        Ok, a friendly error message would certainly also do :-D

        Show
        Jürgen Kindler added a comment - Ok, a friendly error message would certainly also do :-D
        Hide
        Jean-Baptiste Onofré added a comment -

        Yup agree.

        Show
        Jean-Baptiste Onofré added a comment - Yup agree.
        Hide
        Jean-Baptiste Onofré added a comment -

        On Karaf 2.3.x:

        • jaas:manage --index 1 => NullPointerException
        • jaas:manage --realm karaf => NullPointerException
        • jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule => OK
        Show
        Jean-Baptiste Onofré added a comment - On Karaf 2.3.x: jaas:manage --index 1 => NullPointerException jaas:manage --realm karaf => NullPointerException jaas:manage --realm karaf --module org.apache.karaf.jaas.modules.properties.PropertiesLoginModule => OK
        Show
        Jean-Baptiste Onofré added a comment - Fixed on karaf-2.3.x: http://svn.apache.org/viewvc?view=revision&revision=1389132
        Show
        Jean-Baptiste Onofré added a comment - Fixed on trunk: http://svn.apache.org/viewvc?view=revision&revision=1389137

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Jean-Baptiste Onofré
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development