On 2/1/11 7:08, PN. Truong Phuc wrote:
Hi all,

I'm new to osgi and felix.
I have read the tutorial about the Http service on felix site. I have try to
create the simple servlet like the tutorial mention.
I have start the bundle org.apache.felix.http.bundle-2.0.4.jar but when I
start to start my bundle the Http service did not run.

Are you saying that your bundle cannot find the HTTP Service?

Assuming you are running with Felix framework 3.0.x, if you type "lb" in the OSGi shell, what is the state of the OSGi bundle?

-> richard

Below is my code:

  public class Main implements BundleActivator{

  public void start(BundleContext bc) throws Exception {
  ServiceReference sRef =
bc.getServiceReference(HttpService.class.getName());
  if (sRef != null)

  {

   HttpService service = (HttpService) bc.getService(sRef);

   service.registerServlet("/hello", new Service(), null, null);

  }

  else{

  System.out.println("No http service");

  }

  }


  public void stop(BundleContext bc) throws Exception {
  }


}

I'm appreciate your help.

Thanks,
Regards,


Trường Phúc


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to