Here's my Java code:

public static void main(String[] args) throws Exception {

CamelContext camelCtx = new DefaultCamelContext();
camelCtx.getManagementStrategy().getManagementAgent().setCreateConnector(true);
camelCtx.getManagementStrategy().getManagementAgent().setUsePlatformMBeanServer(true);
camelCtx.getManagementStrategy().getManagementAgent().setMBeanObjectDomainName("com.a.b.c");
camelCtx.getManagementStrategy().getManagementAgent().setRegisterNewRoutes(true);
camelCtx.getManagementStrategy().getManagementAgent().start();
camelCtx.addRoutes(new JavaRouteBuilder());
camelCtx.start();
}

And my route builder:

public class JavaRouteBuilder extends RouteBuilder {

    public void configure() {
    from("file://input")
    .log("HELLO");
    }
}

In jconsole, when I try and connect to:

service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/jmxrmi/camel

It fails.



On Thu, Aug 22, 2013 at 11:16 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> Before you call the .start() method on CamelContext, you can configure
> Camel.
>
>
> On Thu, Aug 22, 2013 at 2:48 PM, Mark <elihusma...@gmail.com> wrote:
> > How is that done using Java DSL?  I am doing "mvn exec:java".
> >
> >
> >
> > On Thu, Aug 22, 2013 at 2:08 AM, Claus Ibsen <claus.ib...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> Did you configure the JMX settings before you started CamelContext?
> >> This is needed for it to have effect.
> >>
> >>
> >> On Wed, Aug 21, 2013 at 7:07 PM, Tyler Durvik <phangb...@gmail.com>
> wrote:
> >> > I "ported" my java DSL to Spring DSL and can connect using the JMX
> URI:
> >> >
> >> > service:jmx:rmi:///jndi/rmi://<hostname>:1099/jmxrmi/camel
> >> >
> >> > I did add the following line in the Spring DSL:
> >> >
> >> > <camel:jmxAgent id="jmx" mbeanObjectDomainName="com.a.b.c" />
> >> >
> >> > In the Java DSL I have the following:
> >> >
> >> > ManagementAgent agent =
> >> > getContext().getManagementStrategy().getManagementAgent();
> >> > if( !agent.getCreateConnector() )
> >> > agent.setCreateConnector( true );
> >> >
> >> > agent.setUsePlatformMBeanServer(true);
> >> > agent.setMBeanObjectDomainName("com.a.b.c");
> >> >
> >> > And it doesn't help me at all.
> >> >
> >> >
> >> >
> >> > On Wed, Aug 21, 2013 at 10:09 AM, Tyler Durvik <phangb...@gmail.com>
> >> wrote:
> >> >
> >> >> Also, I am running JDK 1.7.0_25-b16 64-bit on Windows 7 Pro.
> >> >>
> >> >>
> >> >>
> >> >> On Wed, Aug 21, 2013 at 9:47 AM, Tyler Durvik <phangb...@gmail.com>
> >> wrote:
> >> >>
> >> >>> I am running standalone.  Created the project using "mvn
> >> >>> archetype:generate" and went through the steps to create a Java DSL
> >> project.
> >> >>>
> >> >>>
> >> >>>
> >> >>> On Wed, Aug 21, 2013 at 9:43 AM, Claus Ibsen <claus.ib...@gmail.com
> >> >wrote:
> >> >>>
> >> >>>> Are you running standalone or in some server/container? And if so
> >> which
> >> >>>> one?
> >> >>>>
> >> >>>> On Wed, Aug 21, 2013 at 3:35 PM, Tyler Durvik <phangb...@gmail.com
> >
> >> >>>> wrote:
> >> >>>> > I have routes defined using Java DSL and want to connect to the
> JVM
> >> >>>> > remotely to monitor the Camel Processors using jconsole.  Is
> there
> >> >>>> > something special that I must do in the Java DSL to enable remote
> >> JMX?
> >> >>>> >  Even when I'm on the same machine, jconsole can only connect
> when I
> >> >>>> choose
> >> >>>> > the PID.  The URL I am using to try and connect is:
> >> >>>> >
> >> >>>> > service:jmx:rmi:///jndi/rmi://<computer name>:1099/jmxrmi/camel
> >> >>>> >
> >> >>>> > I did notice in my Java DSL that the method
> >> >>>> >
> >> >>>> >
> >> >>>>
> >>
> getContext().getManagementStrategy().getManagementAgent().getCreateConnector()
> >> >>>> >
> >> >>>> > returns false.  I set it to true and get the same results.  What
> am
> >> I
> >> >>>> doing
> >> >>>> > wrong?  I am using Camel version 2.11.1.
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> --
> >> >>>> Claus Ibsen
> >> >>>> -----------------
> >> >>>> Red Hat, Inc.
> >> >>>> Email: cib...@redhat.com
> >> >>>> Twitter: davsclaus
> >> >>>> Blog: http://davsclaus.com
> >> >>>> Author of Camel in Action: http://www.manning.com/ibsen
> >> >>>>
> >> >>>
> >> >>>
> >> >>
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> Red Hat, Inc.
> >> Email: cib...@redhat.com
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Reply via email to