karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Lichtin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-1954) NullPointerException on custom Karaf shell command: ClassNotFoundException: org.apache.felix.service.command.Function not found
Date Wed, 23 Aug 2017 14:03:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-1954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138394#comment-16138394
] 

Martin Lichtin commented on KARAF-1954:
---------------------------------------

Is this still in issue in later Karaf versions?

> NullPointerException on custom Karaf shell command: ClassNotFoundException: org.apache.felix.service.command.Function
not found
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-1954
>                 URL: https://issues.apache.org/jira/browse/KARAF-1954
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.3.0
>         Environment: Karaf
>   Karaf version               2.3.0
>   Karaf home                  /home/ceefour/git/bippo-commerce5/karaf
>   Karaf base                  /home/ceefour/git/bippo-commerce5/karaf
>   OSGi Framework              org.apache.felix.framework - 4.0.3
> JVM
>   Java Virtual Machine        OpenJDK 64-Bit Server VM version 23.2-b09
>   Version                     1.7.0_07
>   Vendor                      Oracle Corporation
>   Uptime                      6 hours 27 minutes
>   Total compile time          35.832 seconds
> Threads
>   Live threads                187
>   Daemon threads              169
>   Peak                        216
>   Total started               1656
> Memory
>   Current heap size           147,445 kbytes
>   Maximum heap size           466,048 kbytes
>   Committed heap size         275,200 kbytes
>   Pending objects             0
>   Garbage collector           Name = 'PS Scavenge', Collections = 1648, Time = 7.910
seconds
>   Garbage collector           Name = 'PS MarkSweep', Collections = 10, Time = 1.679 seconds
> Classes
>   Current classes loaded      12,470
>   Total classes loaded        17,370
>   Total classes unloaded      4,900
> Operating system
>   Name                        Linux version 3.2.0-32-generic
>   Architecture                amd64
>   Processors                  8
>            Reporter: Hendy Irawan
>            Assignee: Jean-Baptiste Onofré
>         Attachments: karaf1954.zip
>
>
> I have a shell command extending OsgiSupportCommand which always throws NullPointerException
no matter what.
> {code}
> karaf@root> as:json
> Error executing command: java.lang.NullPointerException
> {code}
> trace:
> {code}
> 2012-10-19 21:10:43,862 | ERROR | l Console Thread | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  294 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> java.lang.ClassNotFoundException: org.apache.felix.service.command.Function not found
by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.jline.Console.run(Console.java:175)[14:org.apache.karaf.shell.console:2.3.0]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_07]
> 2012-10-19 21:10:43,863 | ERROR | l Console Thread | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  323 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.ClassNotFoundException:
org.apache.felix.service.command.Function not found by soluvas-json [1774]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:295)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.jline.Console.run(Console.java:175)[14:org.apache.karaf.shell.console:2.3.0]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_07]
> Caused by: java.lang.ClassNotFoundException: org.apache.felix.service.command.Function
not found by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         ... 18 more
> 2012-10-19 21:10:43,865 | INFO  | l Console Thread | Console                        
 | araf.shell.console.jline.Console  199 | 14 - org.apache.karaf.shell.console - 2.3.0 | Exception
caught while executing command
> java.lang.NullPointerException
>         at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:61)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.jline.Console.run(Console.java:175)[14:org.apache.karaf.shell.console:2.3.0]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_07]
> {code}
> "help as:json" throws:
> {code}
> 2012-10-19 21:14:23,816 | ERROR | -[*:help, $args] | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  294 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> java.lang.ClassNotFoundException: org.apache.felix.service.command.Function not found
by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.SingleCommandHelpProvider.getHelp(SingleCommandHelpProvider.java:51)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem$1.getValue(HelpSystem.java:71)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.substVars(InterpolationHelper.java:174)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.performSubstitution(InterpolationHelper.java:84)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem.getHelp(HelpSystem.java:68)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpAction.doExecute(HelpAction.java:40)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
> 2012-10-19 21:14:23,818 | ERROR | -[*:help, $args] | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  323 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.ClassNotFoundException:
org.apache.felix.service.command.Function not found by soluvas-json [1774]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:295)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.SingleCommandHelpProvider.getHelp(SingleCommandHelpProvider.java:51)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem$1.getValue(HelpSystem.java:71)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.substVars(InterpolationHelper.java:174)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.performSubstitution(InterpolationHelper.java:84)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem.getHelp(HelpSystem.java:68)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpAction.doExecute(HelpAction.java:40)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
> Caused by: java.lang.ClassNotFoundException: org.apache.felix.service.command.Function
not found by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         ... 28 more
> {code}
> "as:json --help" throws:
> {code}
> 2012-10-19 18:24:14,515 | ERROR | -[*:help, $args] | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  294 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> java.lang.ClassNotFoundException: org.apache.felix.service.command.Function not found
by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.SingleCommandHelpProvider.getHelp(SingleCommandHelpProvider.java:51)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem$1.getValue(HelpSystem.java:71)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.substVars(InterpolationHelper.java:174)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.performSubstitution(InterpolationHelper.java:84)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem.getHelp(HelpSystem.java:68)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpAction.doExecute(HelpAction.java:40)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
> 2012-10-19 18:24:14,517 | ERROR | -[*:help, $args] | ServiceRecipe                  
 | lueprint.container.ServiceRecipe  323 | 7 - org.apache.aries.blueprint.core - 1.0.1 | Error
retrieving service from ServiceRecipe[name='shell-350']
> org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.ClassNotFoundException:
org.apache.felix.service.command.Function not found by soluvas-json [1774]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:295)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:247)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:349)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:502)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:308)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:219)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:310)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.Felix.getService(Felix.java:3420)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:468)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.gogo.runtime.CommandProxy.getTarget(CommandProxy.java:50)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:72)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.SingleCommandHelpProvider.getHelp(SingleCommandHelpProvider.java:51)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem$1.getValue(HelpSystem.java:71)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.substVars(InterpolationHelper.java:174)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.util.InterpolationHelper.performSubstitution(InterpolationHelper.java:84)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpSystem.getHelp(HelpSystem.java:68)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.help.HelpAction.doExecute(HelpAction.java:40)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
>         at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
> Caused by: java.lang.ClassNotFoundException: org.apache.felix.service.command.Function
not found by soluvas-json [1774]
>         at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)[org.apache.felix.framework-4.0.3.jar:]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_07]
>         at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)[org.apache.felix.framework-4.0.3.jar:]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:401)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.convertStringsToClasses(ServiceRecipe.java:416)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.getClassesForProxying(ServiceRecipe.java:406)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         ... 28 more
> {code}
> The actual code is not even executed yet.
> Command :
> {code}
> package org.soluvas.json;
> import org.apache.felix.gogo.commands.Argument;
> import org.apache.felix.gogo.commands.Command;
> import org.apache.karaf.shell.console.OsgiCommandSupport;
> import com.fasterxml.jackson.databind.ObjectMapper;
> /**
>  * Format any object as JSON.
>  * @author ceefour
>  */
> @Command(scope="as", name="json", description="Format any object as JSON.")
> public class AsJsonCommand extends OsgiCommandSupport {
> 	
> //	private transient Logger log = LoggerFactory.getLogger(AsJsonCommand.class);
> 	
> 	private ObjectMapper mapper;
> 	
> 	@Argument(name="object", required=true, description="Object to format as JSON, e.g.
(process:find hello).")
> 	private Object input;
> 	
> 	public AsJsonCommand(ObjectMapper mapper) {
> 		super();
> 		this.mapper = mapper;
> 	}
> 	/* (non-Javadoc)
> 	 * @see org.apache.karaf.shell.console.AbstractAction#doExecute()
> 	 */
> 	@Override
> 	protected Object doExecute() throws Exception {
> 		return mapper.writeValueAsString(input);
> 	}
> }
> {code}
> Blueprint :
> {code}
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0
>         http://karaf.apache.org/xmlns/shell/v1.1.0 http://karaf.apache.org/xmlns/shell/v1.1.0">
> 	<reference-list id="jacksonModuleSuppliers" interface="com.google.common.base.Supplier"
> 		filter="(className=com.fasterxml.jackson.databind.Module)" availability="optional"/>
> 	<bean id="jacksonMapperFactory" class="org.soluvas.json.JacksonMapperFactoryImpl"
> 		depends-on="jacksonModuleSuppliers">
> 		<argument ref="jacksonModuleSuppliers"/>
> 	</bean>
> 	<service ref="jacksonMapperFactory" auto-export="interfaces">
> 		<service-properties>
> 			<entry key="className" value="com.fasterxml.jackson.databind.ObjectMapper"/>
> 		</service-properties>
> 	</service>
> 	<bean id="jacksonMapper" factory-ref="jacksonMapperFactory" factory-method="get"
> 		scope="prototype"/>
> 	<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
> 		<command name="as/json">
> 			<action class="org.soluvas.json.AsJsonCommand">
> 				<argument ref="jacksonMapper"/>
> 			</action>
> 		</command>
> 	</command-bundle>
> </blueprint>
> {code}
> Note: This is an open source project at: https://github.com/soluvas/soluvas-framework/tree/master/json



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


Mime
View raw message