Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] unable to connect to JMX port

Some links:

The etc/jetty-jmx.xml

The Sections:

  1) Default
  2) Create Registry Approach
  3) Create ConnectorServer Approach



--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Oct 22, 2013 at 10:30 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Are you wanting to connect to jmx from a remote server?

If so, you'll want to read the commented sections in your etc/jetty-jmx.xml and use the configuration most appropriate for you.
By default, jmx is enabled locally for the JVM to access.
No port listening, but once you connect with a jmx tool via the JVM process, like jconsole, a new random port is now listening.

There are 3 possible configurations in etc/jetty-jmx.xml for you.

 1) Default (just starts the MBeanServer and MBeanContainer)
 2) Default + Create Registry approach
 3) Default + ConnectorServer approach

If you just uncomment the 3rd block, comprising the 
   <New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
section you'll have a port 1099 port opened and listening.



--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Oct 22, 2013 at 10:07 AM, joshuarbox-junk1@xxxxxxxxx <joshuarbox-junk1@xxxxxxxxx> wrote:
Thanks Joakim.  After adding the extra debug line, I see similar output to you [1].

I know you don't see port 1099 in netstat, but are you able to telnet to it, with, e.g. "telnet localhost 1099"?

I'm not sure if my problem is Jetty, or false expectations that it should be responding to TCP on port 1099.  To that end, I also tried using the jmx plugin to eclipse, but I'm getting the same "connection refused" exception.  For some reason my Jetty seems not to be listening on port 1099.

[1] output I get when starting the server, after adding "-Dorg.eclipse.jetty.jmx.MBeanContainer.LEVEL=DEBUG":
2013-10-22 09:41:15.090:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.Server@137a9034->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:15.094:DBUG:oejj.MBeanContainer:main: Registered org.eclipse.jetty.jmx:type=mbeancontainer,id=0
2013-10-22 09:41:15.361:DBUG:oejj.MBeanContainer:main: beanAdded ServerConnector@2921304c{HTTP/1.1}{0.0.0.0:8080}->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:15.375:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.deploy.DeploymentManager@69cb839f->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.359:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.rewrite.handler.RewriteHandler@46a01a84->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.367:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.handler.HandlerCollection@6a0e4b8a->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.383:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.handler.MovedContextHandler$Redirector@2bfd8364->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.383:DBUG:oejj.MBeanContainer:main: beanAdded o.e.j.s.h.MovedContextHandler@71d5930f{/oldContextPath,null,AVAILABLE}->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.498:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.servlet.ServletHandler@6f6c349e->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.506:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.security.ConstraintSecurityHandler@415abfe1->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.506:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.session.SessionHandler@4d77ec7b->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.511:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.servlet.ErrorPageErrorHandler@6c1e5d2f->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
2013-10-22 09:41:17.515:DBUG:oejj.MBeanContainer:main: beanAdded o.e.j.w.WebAppContext@3af5087d{/test-spec,[file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/, jar:file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/WEB-INF/lib/test-web-fragment-9.0.6.v20130930.jar!/META-INF/resources/],AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-spec.war}->org.eclipse.jetty.jmx.MBeanContainer@67e1ab17
+ 35 more similar lines....


On Monday, October 21, 2013 5:16 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
With --exec enabled, i can still connect, albeit to the forked jetty process, not start.jar

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Mon, Oct 21, 2013 at 5:12 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Just tried this setup on 9.0.6, and it worked.

OPTIONS=jmx
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099
-Dcom.sun.management.jmxremote
etc/jetty-jmx.xml
-Dorg.eclipse.jetty.jmx.MBeanContainer.LEVEL=DEBUG

Heck, I didn't even use --exec

The extra DEBUG entry enables debug logging for that class, so that I can see that the MBeanContainer is started.

$ java -jar start.jar 
WARNING: System properties and/or JVM args set.  Consider using --dry-run or --exec
2013-10-21 17:05:32.225:DBUG:oejj.MBeanContainer:main: beanAdded org.eclipse.jetty.server.Server@31873729->qtp57003552{STOPPED,10<=0<=200,i=0,q=0}
...(snip)...
2013-10-21 17:05:34.399:DBUG:oejj.MBeanContainer:main: Registered org.eclipse.jetty.server:context=SSL-http/1.1@17ccbdbe,type=httpconfiguration,id=0
2013-10-21 17:05:34.400:DBUG:oejj.MBeanContainer:main: beanAdded HttpConnectionFactory@1f719a8d{HTTP/1.1}->org.eclipse.jetty.jmx.MBeanContainer@566749c5
2013-10-21 17:05:34.401:INFO:oejs.ServerConnector:main: Started ServerConnector@17ccbdbe{SSL-http/1.1}{0.0.0.0:8443}

I can connect to it via jconsole, on the same machine that started the server, but oddly, port 1099 does not show up in netstat.







--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Mon, Oct 21, 2013 at 4:56 PM, joshuarbox-junk1@xxxxxxxxx <joshuarbox-junk1@xxxxxxxxx> wrote:
I am unable to connect JConsole to my JMX instance, nor telnet to port 1099 (the configured JMX port.)  I believe it's causing Intellij IDE not to work with my Jetty server.  Here are the details of what I did:

I have downloaded jetty-distribution-9.0.6.v20130930

I am running it on Mac OS X 10.7.5.

I uncommented the JMX configuration, and the "--exec" configuration, per http://www.eclipse.org/jetty/documentation/current/jetty-jconsole.html

My start.ini looks like this:
#===========================================================
# JMX Management
# To enable remote JMX access uncomment jmxremote and
# enable --exec
#-----------------------------------------------------------
OPTIONS=jmx
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099
-Dcom.sun.management.jmxremote
etc/jetty-jmx.xml

I noticed this warning on Jetty stderr when JConsole attempts to connect. Looks suspicious, but don't know what to do about it:
objc[8849]: Class JavaLaunchHelper is implemented in both /Library/Java/Home/bin/java and
 /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

Here is the console output at startup:
scml-jrichardson:jetty-distribution-9.0.6.v20130930 jric$ java -jar start.jar
2013-10-11 11:09:28.695:WARN::main: test-realm is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:28.781:INFO:oejs.Server:main: jetty-9.0.6.v20130930
2013-10-11 11:09:28.830:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps/] at interval 1
2013-10-11 11:09:28.833:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/] at interval 1
2013-10-11 11:09:28.856:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@57cd3447{/oldContextPath,null,AVAILABLE}
2013-10-11 11:09:29.395:WARN::main: test-spec webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:29.563:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@367e5959{/test-spec,[file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/, jar:file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/WEB-INF/lib/test-web-fragment-9.0.6.v20130930.jar!/META-INF/resources/],AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-spec.war}
2013-10-11 11:09:29.929:WARN::main: test webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.283:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3b0037c8{/test,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test.war-_test-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test.war}
2013-10-11 11:09:30.288:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.ContextHandler@4dcb3539{/javadoc,file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/javadoc,AVAILABLE}
2013-10-11 11:09:30.381:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3ec06d57{/,file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/ROOT/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/ROOT}
2013-10-11 11:09:30.454:WARN::main: test-jndi webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.494:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@695eb69a{/test-jndi,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-jndi.war-_test-jndi-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-jndi.war}
2013-10-11 11:09:30.590:WARN::main: test-jaas webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.601:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4d129d08{/test-jaas,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-jaas.war-_test-jaas-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-jaas.war}
2013-10-11 11:09:30.848:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.867:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@7248f9e0{/async-rest,[file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-/webapp/, jar:file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-/webapp/WEB-INF/lib/example-async-rest-jar-9.0.6.v20130930.jar!/META-INF/resources/],AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/async-rest.war}
2013-10-11 11:09:31.148:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4b6bf659{/proxy,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-xref-proxy.war-_xref-proxy-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/xref-proxy.war}
2013-10-11 11:09:31.837:INFO:oejs.ServerConnector:main: Started ServerConnector@7bde635a{HTTP/1.1}{0.0.0.0:8080}
2013-10-11 11:09:32.015:INFO:oejs.ServerConnector:main: Started ServerConnector@5ec881b5{SSL-http/1.1}{0.0.0.0:8443}

Any help, much appreciated!

Thanks, --josh


On Monday, October 21, 2013 10:18 AM, Joshua Richardson <jric@xxxxxxxxx> wrote:
I am unable to connect JConsole to my JMX instance, nor telnet to port 1099 (the configured JMX port.)  I believe it's causing Intellij IDE not to work with my Jetty server.  Here are the details of what I did:

I have downloaded jetty-distribution-9.0.6.v20130930

I am running it on Mac OS X 10.7.5.

I uncommented the JMX configuration, and the "--exec" configuration, per http://www.eclipse.org/jetty/documentation/current/jetty-jconsole.html

My start.ini looks like this:
#===========================================================
# JMX Management
# To enable remote JMX access uncomment jmxremote and
# enable --exec
#-----------------------------------------------------------
OPTIONS=jmx
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099
-Dcom.sun.management.jmxremote
etc/jetty-jmx.xml

I noticed this warning on Jetty stderr when JConsole attempts to connect. Looks suspicious, but don't know what to do about it:
objc[8849]: Class JavaLaunchHelper is implemented in both /Library/Java/Home/bin/java and
 /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

Here is the console output at startup:
scml-jrichardson:jetty-distribution-9.0.6.v20130930 jric$ java -jar start.jar
2013-10-11 11:09:28.695:WARN::main: test-realm is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:28.781:INFO:oejs.Server:main: jetty-9.0.6.v20130930
2013-10-11 11:09:28.830:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps/] at interval 1
2013-10-11 11:09:28.833:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/] at interval 1
2013-10-11 11:09:28.856:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.MovedContextHandler@57cd3447{/oldContextPath,null,AVAILABLE}
2013-10-11 11:09:29.395:WARN::main: test-spec webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:29.563:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@367e5959{/test-spec,[file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/, jar:file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-spec.war-_test-spec-any-/webapp/WEB-INF/lib/test-web-fragment-9.0.6.v20130930.jar!/META-INF/resources/],AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-spec.war}
2013-10-11 11:09:29.929:WARN::main: test webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.283:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3b0037c8{/test,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test.war-_test-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test.war}
2013-10-11 11:09:30.288:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.ContextHandler@4dcb3539{/javadoc,file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/javadoc,AVAILABLE}
2013-10-11 11:09:30.381:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@3ec06d57{/,file:/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/ROOT/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/ROOT}
2013-10-11 11:09:30.454:WARN::main: test-jndi webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.494:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@695eb69a{/test-jndi,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-jndi.war-_test-jndi-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-jndi.war}
2013-10-11 11:09:30.590:WARN::main: test-jaas webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.601:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4d129d08{/test-jaas,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-test-jaas.war-_test-jaas-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/test-jaas.war}
2013-10-11 11:09:30.848:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
2013-10-11 11:09:30.867:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@7248f9e0{/async-rest,[file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-/webapp/, jar:file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-/webapp/WEB-INF/lib/example-async-rest-jar-9.0.6.v20130930.jar!/META-INF/resources/],AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/async-rest.war}
2013-10-11 11:09:31.148:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4b6bf659{/proxy,file:/private/var/folders/b6/1hrm44bs67sf00dhml3ntldxcr632h/T/jetty-0.0.0.0-8080-xref-proxy.war-_xref-proxy-any-/webapp/,AVAILABLE}{/Users/jric/Downloads/jetty-distribution-9.0.6.v20130930/webapps.demo/xref-proxy.war}
2013-10-11 11:09:31.837:INFO:oejs.ServerConnector:main: Started ServerConnector@7bde635a{HTTP/1.1}{0.0.0.0:8080}
2013-10-11 11:09:32.015:INFO:oejs.ServerConnector:main: Started ServerConnector@5ec881b5{SSL-http/1.1}{0.0.0.0:8443}

Any help, much appreciated!

Thanks, --josh



_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users








Back to the top