Hi, 

I want to work with blueprint
I have a problem to get the service OSGi  : 

With 
<bean id="ProviderActivator" 
class="com.bw.osgi.provider.impl.HelloWorldServiceImpl" >
    <property name="bundleContext" ref="blueprintBundleContext"/>
</bean>

inside PersonServlet.java (from Karaf Tutorial Part 4 - CXF Services in
OSGi) :

package net.lr.tutorial.karaf.cxf.personservice.webui;
..
import com.bw.osgi.provider.able.HelloWorldService;
import com.bw.osgi.provider.impl.HelloWorldServiceImpl;
...

public class PersonServlet extends HttpServlet {
...
 @Override
   protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
        String id = req.getParameter("id");
        String name = req.getParameter("name");
        String url = req.getParameter("url");
        Person person = new Person();
        person.setId(id);
        person.setName(name);
        person.setUrl(url);
        personService.addPerson(person );
        resp.sendRedirect("/personui");
    
         HelloWorldService helloService
=(HelloWorldService)bundleContext.getService(helloServiceReference);
        
         helloService.hello("***test to send message**** ");


I have this error : "bundleContext cannot be resolved"


this example is without blueprint(= I want to do the same thing with
blueprint) : 

public class HelloWorldActivator implements BundleActivator {
    //private HelloWorldConsumer consumer;
    ServiceReference helloServiceReference;

    @Override
    public void start(BundleContext bundleContext) throws Exception {
        
        System.out.println("HelloWorldActivator start ");
         helloServiceReference=
bundleContext.getServiceReference(HelloWorldService.class.getName());

         HelloWorldService helloService
=(HelloWorldService)bundleContext.getService(helloServiceReference);
         
         helloService.hello("***this is the example message : wasup **** ");




Thank you for your help and advice.





--
View this message in context: 
http://karaf.922171.n3.nabble.com/blueprint-bundleContext-cannot-be-resolved-tp4033886.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to