camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Pro" <>
Subject cxfrs: Address already in use at Redeployment
Date Wed, 14 Nov 2012 14:46:31 GMT

I use Camel (2.10.2) inside Glassfish ( with the CdiCamelContext as Singleton. I don't
want to use Spring, so I use CDI. I have many JMS-Routes, which works all fine. But I have
a strange issue with "cxfrs" and "Address already in use" after a redeployment.
The "cxfrs" route looks like that:
public class RestCamelRoute extends RouteBuilder
    public RestCamelRoute()
    { }

    public void configure() throws Exception
        from("cxfrs://" + ValidationRestService.class.getName())
            .process(new Processor()
                public void process(Exchange exchange) throws Exception
                    //custom processing here
            .log("-> JAX RS Request Body: \n: ${body}")
            .log("-> JAX RS Request headers: \n: ${headers}")

I can deploy that route on Glassfish only once successfully. When I redeploy the route I see
"Address already in use" messages in the log-files. It looks like that the embedded Jetty-Server
is not stopped within an undeployment. 

The @PreDestroy method is called at the undeployment, which only do "camelCtx.stop()". Is
it possible, that "camelCtx.stop()" is not stopping the jetty server, so the port "61621"
stays open? 

Here the CDI Singleton:
public class CamelBootStrap
    Logger logger = Logger.getLogger(CamelBootStrap.class.getName());

    CdiCamelContext camelCtx;

    RestCamelRoute restCamelRoute;

    public void init() throws Exception
  "$$$$$$ Create CamelContext and register Camel Routes ... $$$$$$");


            // Start Camel Context

  "$$$$$$ CamelContext created and camel routes started. $$$$$$");
        catch (Exception e)
            if(camelCtx != null)
      "!!!!! CamelContext stopped within INIT !!!!!");

     * Camel Stoppen
     * @throws Exception
    public void stop() throws Exception
        camelCtx.stop();"!!!!! CamelContext stopped within PreDestroy !!!!!");
        System.out.println("$$$$$$$$$$ CAMEL STOPPED $$$$$$$$$$");

Would be great if someone could help me.


View raw message