Your code looks a bit weird, where you create a new camel context just
further below, after you have configured the name on the existing
context.

Does the pasted code in the email even compile?

On Fri, Oct 27, 2017 at 9:49 AM, Pakarinen, Jari
<[email protected]> wrote:
> Hi,
>
> I would like to use my own names instead of "camel-1" to differentiate the 
> contexts from each other.
>
> Below is the code I use. Problematic line is the 
> ((DefaultCamelContext)camelContext).setName("my context name"); line. If I 
> comment it out, it works under Tomcat. If I use it, it fails silently. It 
> runs fine locally (without Tomcat). Tomcat says it is running, but nothing 
> (not even one line) is shown in the Camel log, even with trace or debug log 
> setting.
>
> How do I set the context name ?
>
> public class MyCamelContextInitialisingListener implements 
> ServletContextListener {
>     private CamelContext  camelContext;
>
>     public void contextInitialized(ServletContextEvent servletContextEvent) {
>         SimpleRegistry registry = new SimpleRegistry();
>         try {
>             ((DefaultCamelContext)camelContext).setName("my context name");
>             registry.put("ProcessExcelFile", new ProcessExcelFile());
>             camelContext = new DefaultCamelContext(registry);
>             camelContext.addRoutes(new MyRouteBuilder());
>             camelContext.start();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
>
>     public void contextDestroyed(ServletContextEvent servletContextEvent) {
>         try {
>             camelContext.stop();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
>
> --
> Jari
>
>
>
> This e-mail transmission may contain confidential or legally privileged 
> information that is intended only for the individual or entity named in the 
> e-mail address. If you are not the intended recipient, you are hereby 
> notified that any disclosure, copying, distribution, or reliance upon the 
> contents of this e-mail is strictly prohibited. If you have received this 
> e-mail transmission in error, please reply to the sender, so that they can 
> arrange for proper delivery, and then please delete the message from your 
> computer systems. Thank you.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to