Ah, sorry, this was with 3.0.1. All features were installed through the
regular 'feature:install', so whatever those versions are are what I'm
using.


On Mon, Apr 21, 2014 at 12:56 PM, jbonofre [via Karaf] <
[email protected]> wrote:

> Hi Nick,
>
> with which Karaf version you tried this ?
>
> Regards
> JB
>
> On 04/21/2014 02:50 PM, nstuart wrote:
>
> > Is it possible (or should it be possible) to have a Karaf command
> published
> > from the pax-cdi extensions? From my brief test it would appear not to
> work,
> > but I do not know if I missing anything. Here's my simple test service:
> >
> > @OsgiServiceProvider(classes = {OsgiCommandSupport.class})
> > @Command(scope="test", name="hello", description = "Test command")
> > public class Testing extends OsgiCommandSupport{
> >
> > @Inject
> > @OsgiService
> > private HelloWorldService worldService;
> >
> > @PostConstruct
> > public void init(){
> > System.out.println("TESTING "  + worldService.sayHello().getEmail());
> > }
> >
> > @Override
> > protected Object doExecute() throws Exception {
> > System.out.println(worldService.sayHello().getEmail());
> > return null;
> > }
> > }
> >
> > The service is getting registered from CDI correctly as the
> PostConstruct is
> > getting fired, with the dependent service being injected. However, if I
> try
> > to run 'test:hello' I get a command not found error. If I add the
> <command>
> > part to the blueprint.xml file I can run the command, but get an NPE
> when
> > running it which means the worldService is not injected.
> >
> > Any thoughts? Should I file a feature request?
> >
> > Thanks!
> > -Nick
> >
> >
> >
> >
> > --
> > View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-Command-from-CDI-Service-tp4032877.html
> > Sent from the Karaf - User mailing list archive at Nabble.com.
> >
>
> --
> Jean-Baptiste Onofré
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4032880&i=0>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://karaf.922171.n3.nabble.com/Karaf-Command-from-CDI-Service-tp4032877p4032880.html
>  To unsubscribe from Karaf Command from CDI Service?, click 
> here<http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4032877&code=bmljaG9sYXMuc3R1YXJ0QGdtYWlsLmNvbXw0MDMyODc3fC01NTA0Nzk2NTE=>
> .
> NAML<http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-Command-from-CDI-Service-tp4032877p4032891.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to