users@jersey.java.net

Re: Jersey in Equinox3.7 --ContainerException: No WebApplication provider is present

From: anthonylee <anthonynlee_at_gmail.com>
Date: Wed, 20 Oct 2010 13:21:30 -0700 (PDT)

Hi all,

I just got it works in ugly way -- I added Thread.sleep() to wait for some
time and tried one more time.

Below are OSGI console output and source code of Activator's start() method:
It looks like Equinox tried to start mqmonitor bundle before Jersey!
But mqmonitor depends on Jersey...
I couldn't understand it.

===================The first time==================================
osgi> ss

Framework is launched.

id State Bundle
0 STARTING org.eclipse.osgi_3.7.0.v20100910
3 ACTIVE javax.servlet_2.5.0.v200910301333
4 ACTIVE org.eclipse.osgi.services_3.2.100.v20100503
5 ACTIVE org.mortbay.jetty.server_6.1.23.v201004211559
6 ACTIVE org.eclipse.equinox.http.jetty_2.0.0.v20100503
7 ACTIVE org.eclipse.equinox.http.servlet_1.1.0.v20100503
8 ACTIVE org.apache.commons.logging_1.0.4.v201005080501
9 ACTIVE org.mortbay.jetty.util_6.1.23.v201004211559
10 ACTIVE org.apache.log4j_1.2.13.v200903072027
11 ACTIVE com.ibm.mq.pcf_1.0.0
12 ACTIVE com.ibm.mq_1.0.0
13 STARTING com.fxinnovation.mqmonitor_1.0.0
14 RESOLVED javax.ws.rs.jsr311-api_1.1.1
15 RESOLVED com.sun.jersey.jersey-core_1.3.0.SNAPSHOT
16 RESOLVED com.sun.jersey.jersey-server_1.3.0.SNAPSHOT


==================The second time==================================
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.7.0.v20100910
3 ACTIVE javax.servlet_2.5.0.v200910301333
4 ACTIVE org.eclipse.osgi.services_3.2.100.v20100503
5 ACTIVE org.mortbay.jetty.server_6.1.23.v201004211559
6 ACTIVE org.eclipse.equinox.http.jetty_2.0.0.v20100503
7 ACTIVE org.eclipse.equinox.http.servlet_1.1.0.v20100503
8 ACTIVE org.apache.commons.logging_1.0.4.v201005080501
9 ACTIVE org.mortbay.jetty.util_6.1.23.v201004211559
10 ACTIVE org.apache.log4j_1.2.13.v200903072027
11 ACTIVE com.ibm.mq.pcf_1.0.0
12 ACTIVE com.ibm.mq_1.0.0
13 ACTIVE com.fxinnovation.mqmonitor_1.0.0
14 ACTIVE javax.ws.rs.jsr311-api_1.1.1
15 ACTIVE com.sun.jersey.jersey-core_1.3.0.SNAPSHOT
16 ACTIVE com.sun.jersey.jersey-server_1.3.0.SNAPSHOT









==========start() of Activator================
@Override
            public synchronized void start(BundleContext bundleContext) throws
Exception {
                this.bc = bundleContext;

                logger.info("STARTING HTTP SERVICE BUNDLE");

                this.tracker = new ServiceTracker(this.bc,
HttpService.class.getName(), null) {

                  @Override
                  public Object addingService(ServiceReference serviceRef) {
                         System.out.println("add HTTP service...");
                     httpService = (HttpService)super.addingService(serviceRef);
                     try{
                             registerServlets();
                     }catch(Throwable t){
                             System.out.println(t);
                             //wait for 100 seconds and try one more time
                             try{
                                     Thread.sleep(100000);
                                     registerServlets();
                             }catch(Throwable t3){
                                     System.out.println(t3);
                             }
                     }
                     return httpService;
                  }
                  
                  @Override
                    public void removedService(ServiceReference ref, Object
service) {
                        if (httpService == service) {
                            unregisterServlets();
                            httpService = null;
                        }
                        super.removedService(ref, service);
                    }
                };

                this.tracker.open();

                logger.info("HTTP SERVICE BUNDLE STARTED");
            }
-- 
View this message in context: http://jersey.576304.n2.nabble.com/Jersey-in-Equinox3-7-ContainerException-No-WebApplication-provider-is-present-tp5656365p5656501.html
Sent from the Jersey mailing list archive at Nabble.com.