Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

spring boot - Camel Context Not Listed in Hawtio JMX At All

I have deployed three example apache camel examples into tomcat:

/camel-example-activemq-tomcat-3.5.0-SNAPSHOT   
/camel-example-cxf-tomcat-3.5.0-SNAPSHOT    
/camel-example-servlet-tomcat-3.5.0-SNAPSHOT

They're all up and running OK.

One of them uses ActiveMQ and I can see the queues from Hawtio.

Hawtio ActiveMQ tree

However, under JMX, the Camel Context is not listed/discovered. Refreshing the page changes nothing.

Hawtio JMX tree

Executing mBeanServersInfo() (full path Code>http://localhost:8080/hawtio-default-2.10.0/jolokia/exec/jolokia:type=ServerHandler,qualifier=hawtio/mBeanServersInfo()), which looks like it provides the raw data to display in the JMX tree, produces the following:

Found 1 MBeanServers
    ++ com.sun.jmx.mbeanserver.JmxMBeanServer@56620197: default domain = DefaultDomain, 284 MBeans
        Domains:
         == java.util.logging
              type=Logging
         == jdk.management.jfr
              type=FlightRecorder
         == org.apache.activemq
              brokerName=myBroker,connectionName=vm_//myBroker#0,connectionViewType=remoteAddress,connector=clientConnectors,connectorName=vm,type=Broker
              brokerName=myBroker,connectionName=vm_//myBroker#2,connectionViewType=remoteAddress,connector=clientConnectors,connectorName=vm,type=Broker
              brokerName=myBroker,clientId=ID_WIN-10-DM-63203-1594039525518-3_1,endpoint=dynamicProducer,producerId=ID_WIN-10-DM-63203-1594039525518-4_1_2_1,type=Broker
              brokerName=myBroker,destinationName=ActiveMQ.Advisory.Connection,destinationType=Topic,type=Broker
              brokerName=myBroker,destinationName=ActiveMQ.Advisory.Queue,destinationType=Topic,type=Broker
              brokerName=myBroker,destinationName=inbox,destinationType=Queue,type=Broker
              brokerName=myBroker,connector=clientConnectors,connectorName=tcp,type=Broker
              brokerName=myBroker,instanceName=KahaDBPersistenceAdapter[C_xamppactivemq-datamyBrokerKahaDB_Index_C_xamppactivemq-datamyBrokerKahaDB],service=PersistenceAdapter,type=Broker
              brokerName=myBroker,connectionName=ID_WIN-10-DM-63203-1594039525518-3_1,connectionViewType=clientId,connector=clientConnectors,connectorName=vm,type=Broker
              brokerName=myBroker,type=Broker
              brokerName=myBroker,connector=clientConnectors,connectorName=vm,type=Broker
              brokerName=myBroker,clientId=ID_WIN-10-DM-63203-1594039525518-3_1,consumerId=ID_WIN-10-DM-63203-1594039525518-4_1_-1_1,destinationName=ActiveMQ.Advisory.TempQueue_ActiveMQ.Advisory.TempTopic,destinationType=Topic,endpoint=Consumer,type=Broker
              brokerName=myBroker,clientId=ID_WIN-10-DM-63203-1594039525518-5_1,endpoint=dynamicProducer,producerId=ID_WIN-10-DM-63203-1594039525518-6_1_1_1,type=Broker
              brokerName=myBroker,clientId=ID_WIN-10-DM-63203-1594039525518-5_1,consumerId=ID_WIN-10-DM-63203-1594039525518-6_1_-1_1,destinationName=ActiveMQ.Advisory.TempQueue_ActiveMQ.Advisory.TempTopic,destinationType=Topic,endpoint=Consumer,type=Broker
              brokerName=myBroker,destinationName=ActiveMQ.Advisory.Consumer.Queue.inbox,destinationType=Topic,type=Broker
              brokerName=myBroker,service=Health,type=Broker
              brokerName=myBroker,clientId=ID_WIN-10-DM-63203-1594039525518-3_1,consumerId=ID_WIN-10-DM-63203-1594039525518-4_1_1_1,destinationName=inbox,destinationType=Queue,endpoint=Consumer,type=Broker
              brokerName=myBroker,connectionName=ID_WIN-10-DM-63203-1594039525518-5_1,connectionViewType=clientId,connector=clientConnectors,connectorName=vm,type=Broker
              brokerName=myBroker,destinationName=outbox,destinationType=Queue,type=Broker
              brokerName=myBroker,destinationName=ActiveMQ.Advisory.MasterBroker,destinationType=Topic,type=Broker
         == java.nio
              name=direct,type=BufferPool
              name=mapped,type=BufferPool
         == Users
              database=UserDatabase,rolename="admin-script",type=Role
              database=UserDatabase,rolename="manager-gui",type=Role
              database=UserDatabase,rolename="admin-gui",type=Role
              database=UserDatabase,type=User,username="tomcat"
              database=UserDatabase,type=UserDatabase
              database=UserDatabase,rolename="manager-status",type=Role
              database=UserDatabase,rolename="manager-jmx",type=Role
              database=UserDatabase,rolename="manager-script",type=Role
         == JMImplementation
              type=MBeanServerDelegate
         == java.lang
              name=Metaspace Manager,type=MemoryManager
              name=Metaspace,type=MemoryPool
              name=CodeHeap 'profiled nmethods',type=MemoryPool
              type=ClassLoading
              type=Runtime
              name=CodeCacheManager,type=MemoryManager
              type=OperatingSystem
              name=Compressed Class Space,type=MemoryPool
              type=Threading
              name=CodeHeap 'non-nmethods',type=MemoryPool
              name=G1 Eden Space,type=MemoryPool
              name=G1 Old Gen,type=MemoryPool
              name=G1 Survivor Space,type=MemoryPool
              name=G1 Young Generation,type=GarbageCollector
              type=Memory
              type=Compilation
              name=G1 Old Generation,type=GarbageCollector
              name=CodeHeap 'non-profiled nmethods',type=MemoryPool
         == com.sun.management
              type=HotSpotDiagnostic
              type=DiagnosticCommand
         == jmx4perl
              qualifier=hawtio,type=Config
         == org.apache.logging.log4j2
              component=ContextSelector,type=20ca6c9a
              component=ContextSelector,type=6f5f79f0
              component=Loggers,name=,type=6f5f79f0
              component=Appenders,name=console,type=6f5f79f0
              component=Loggers,name=,type=2cfeff1b
              component=Appenders,name=console,type=20ca6c9a
              type=2cfeff1b
              component=ContextSelector,type=2cfeff1b
              type=6f5f79f0
              component=Appenders,name=console,type=2cfeff1b
              component=StatusLogger,type=2cfeff1b
              type=20ca6c9a
              component=StatusLogger,type=20ca6c9a
              component=StatusLogger,type=6f5f79f0
              component=Loggers,name=,type=20ca6c9a
         == hawtio
              type=Registry
              type=About
              type=IdeFacade
              type=ConfigFacade
              type=LogQuery
              type=TreeWatcher
              name=RBACRegistry,type=security
              area=jmx,name=HawtioDummyJMXSecurity,rank=0,type=security
         == Catalina
              context=/host-manager,host=localhost,type=Loader
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Servlet,name=HostManager
              context=/hawtio-default-2.10.0,host=localhost,name=hawtio/role,resourcetype=Context,type=Environment
              context=/manager,host=localhost,type=Cache
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsEchoMessage
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-activemq-tomcat-3.5.0-SNAPSHOT,j2eeType=Servlet,name=default
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-cxf-tomcat-3.5.0-SNAPSHOT,name=jsp,type=JspMonitor
              name="http-bio-8080",type=GlobalRequestProcessor
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=default
              context=/hawtio-default-2.10.0,host=localhost,name=hawtio/realm,resourcetype=Context,type=Environment
              name=HttpRequest4,type=RequestProcessor,worker="http-bio-8080"
              context=/hawtio-default-2.10.0,host=localhost,name=NonLoginAuthenticator,type=Valve
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/hawtio-default-2.10.0,j2eeType=Filter,name=XContentTypeOptionsFilter
              J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/hawtio-default-2.10.0
              context=/manager,host=localhost,type=Loader
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=SessionExample
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=RequestHeaderExample
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/hawtio-default-2.10.0,j2eeType=Filter,name=XXSSProtectionFilter
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Filter,name=Tomcat WebSocket (JSR356) Filter
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-servlet-tomcat-3.5.0-SNAPSHOT,j2eeType=Filter,name=Tomcat WebSocket (JSR356) Filter
              context=/host-manager,host=localhost,name=StandardContextValve,type=Valve
              context=/camel-example-cxf-tomcat-3.5.0-SNAPSHOT,host=localhost,type=Manager
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsEchoStream
              type=Service
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=jsp
              context=/docs,host=localhost,name=NonLoginAuthenticator,type=Valve
              context=/hawtio-default-2.10.0,host=localhost,name=hawtio/rolePrincipalClasses,resourcetype=Context,type=Environment
              context=/hawtio-default-2.10.0,host=localhost,type=Cache
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/hawtio-default-2.10.0,j2eeType=Servlet,name=keycloak
              context=/camel-example-servlet-tomcat-3.5.0-SNAPSHOT,host=localhost,name=StandardContextValve,type=Valve
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,name=jsp,type=JspMonitor
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-servlet-tomcat-3.5.0-SNAPSHOT,name=jsp,type=JspMonitor
              name=HttpRequest2,type=RequestProcessor,worker="http-bio-8080"
              J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/docs
              context=/camel-example-activemq-tomcat-3.5.0-SNAPSHOT,host=localhost,type=Manager
              context=/examples,host=localhost,type=Manager
              context=/examples,host=localhost,name=minExemptions,resourcetype=Context,type=Environment
              context=/docs,host=localhost,type=Loader
              type=StringCache
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-servlet-tomcat-3.5.0-SNAPSHOT,j2eeType=Servlet,name=jsp
              context=/camel-example-cxf-tomcat-3.5.0-SNAPSHOT,host=localhost,type=WebappClassLoader
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=Tomcat WebSocket (JSR356) Filter
              context=/examples,host=localhost,type=WebappClassLoader
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/camel-example-cxf-tomcat-3.5.0-SNAPSHOT,j2eeType=Filter,name=Tomcat WebSocket (JSR356) Filter
              J2EEApplication=none,J2EEServer=none,WebModule=//localhost/hawtio-default-2.10.0,j2eeType=Servlet,name=pl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

JMX is disabled by default since Camel 3.0. To enable JMX, you need to add camel-management dependency. If you are using maven, add camel-management to pom.xml:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-management</artifactId>
  <version>${camel.version}</version>
</dependency>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...