jaas:realm-manage raises a NullPointerException

Details

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]

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]

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.

Jürgen Kindler
added a comment - 21/Sep/12 08:51 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?

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.

Jean-Baptiste Onofré
added a comment - 21/Sep/12 08:56 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.