Jetty Server does not receive request

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jetty Server does not receive request

ashish.evolving
This post has NOT been accepted by the mailing list yet.
Hi,

Currently we are facing problem where the jetty server which is embaded with apache-cxf not receive any request only in RHEL. Please find the enviornment details below:

OS: RHEL 5.10
Java Version:1.7.0_51
Apache-cxf version:2.7.5

The problem here is nither we receive any request not the application throws any error.

Please find the code synopsis below:


Server Implementation:


 public void init() throws Exception {
        server = new Server(getConfig().isHttps() ? 0 : getConfig().getPort());
        //        
        TomeLogger.INSTANCE.debug("init()::server");
        ContextHandler context = new ContextHandler();
        TomeLogger.INSTANCE.debug("init()::context");
        context.setContextPath(getConfig().getPublishURI());
        context.setResourceBase(".");
        context.setClassLoader(Thread.currentThread().getContextClassLoader());
        //
        TomeLogger.INSTANCE.debug("init()::context.setClassLoader");
        QueuedThreadPool pool = new QueuedThreadPool();
        if (getConfig().getMinThreads() > 0)
            pool.setMinThreads(getConfig().getMinThreads());
        if (getConfig().getMaxThreads() > 0)
            pool.setMaxThreads(getConfig().getMaxThreads());
        server.setThreadPool(pool);
        //
        if (getConfig().isHttps()) {
            SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
            ssl_connector.setPort(getConfig().getPort());
            SslContextFactory cf = ssl_connector.getSslContextFactory();
            cf.setKeyStorePath(getConfig().getServerKeyStorePath());
            cf.setKeyStorePassword(getConfig().getServerKeyStorePassword());
            cf.setKeyManagerPassword(getConfig().getServerKeyPassword());
            cf.setTrustStorePassword(getConfig().getServerTrustStorePassword());
            cf.setTrustStore(getConfig().getServerTrustStorePath());
            if (getConfig().isClientAuthenticationRequired()) {
                cf.setNeedClientAuth(true);
            }
            server.addConnector(ssl_connector);
        }
        //
        RequestHandlerTest requestHandler = RequestHandlerTest.loadProviderService();
        requestHandler.initConfiguration(getConfig());
        context.setHandler(requestHandler);
        server.setHandler(context);
    }

    @Override
    public synchronized void start() throws Exception {
        if (server.isStopped()) {
            server.start();
        }
    }

    @Override
    public synchronized void stop() throws Exception {
        if (server.isRunning()) {
            server.stop();
            server = null;
        }
    }

   

Request Handler:

 public static final RequestHandler loadProviderService() throws Exception {
       
        if (handler == null) {
        HandlerProvider provider = (HandlerProvider) GenericImplProvider.loadProviderClass(HandlerProvider.class);
        return provider.getHandle();
        }
        TomeLogger.INSTANCE.debug("loadProviderService::Handler Loaded");
                return handler;

    }
   
    public interface HandlerProvider {
    RequestHandler getHandle();
        }

    private GenericSOHandlerConfiguration config_;

    public void initConfiguration(GenericSOHandlerConfiguration config) throws Exception {
                TomeLogger.INSTANCE.debug("initConfiguration::Configuration Initialized");
        config_ = config;
    }

    public GenericSOHandlerConfiguration getConfig() {
        return config_;
    }

    @Override
    public final void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    TomeLogger.INSTANCE.debug("Message Received");
    TomeLogger.INSTANCE.error("Message Received");
    StringBuffer sb = new StringBuffer();
    InputStream in = request.getInputStream();
    int b = in.read();
    do {
    sb.append((char) b);

                } while ((b = in.read()) != -1);
    TomeLogger.INSTANCE.debug("Message Received:"+sb.toString());
    TomeLogger.INSTANCE.error("Message Received:"+sb.toString());
        if (!SOAgentManager.INSTANCE.hasCapacity()) {
            response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
            baseRequest.setHandled(true);
            return;
        }
       
        //
        GenericSOSubmitter soSubmitter = SOAgentManager.INSTANCE.getRegistory().getService(GenericSOSubmitter.class);
        try {
            if (soSubmitter.isContinuation(request, response)) {
                handleResponse(soSubmitter, request, response);
                baseRequest.setHandled(true);
            } else {
                GenericSOBean bean = createServiceOrder(request, response);
                if (config_.isAsync()) {
                    soSubmitter.submitSOAsync(request, response, config_.getAckTimeout(), config_.getCompletionTimeout(), config_.getMaxResponseDeliveryRetries(), config_.getResponseDeliveryRetryInterval(), bean);
                } else {
                    soSubmitter.submitSO(request, response, config_.getCompletionTimeout(), bean);
                }
            }
        } catch (Exception exception) {
            if ((!soSubmitter.isContinuation(request, response)) && !(exception instanceof TimeoutException)) {
                GenericSOBean bean = createErrorServiceOrder(request, response, exception);
                soSubmitter.submitErrorSO(request, response, config_.getCompletionTimeout(), bean);
            }
            handleErrorResponse(exception, soSubmitter, request, response);
            baseRequest.setHandled(true);
        }
    }