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é
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com