If you are using ${jetty.base} then any files that you put there will
override the ones in ${jetty.home}.

So for example, if you have ${jetty.home}/etc/jetty-jmx-remote.xml and you
copy that to
${jetty.base}/etc/jetty-jmx-remote.xml  then that one will be used.

You can even verify this behavior with

$ cd myjettybase
$ java -jar /opt/jetty-dist/start.jar --list-config

The XML files at the end will tell you where they will be loaded from.

You can even override the behavior of the jmx-remote.mod by putting your
own version in
${jetty.base}/modules/jmx-remote.mod

That file controls which libraries, other modules, xml files etc are used.

Let me take a closer look at this createRegistry thing now ...


--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/> - intalio.com/jetty
Expert advice, services and support from from the Jetty & CometD experts
eclipse.org/jetty - cometd.org

On Fri, Feb 13, 2015 at 1:52 PM, Austin Witt <[email protected]> wrote:

> I am using Jetty 9.2.5. I have been following these instructions:
> http://www.eclipse.org/jetty/documentation/current/jmx-chapter.html
>
> What I want to do, is have a jetty-jmx.xml file in my webapp, which is
> pointed to by the command-line used to start jetty.
>
> Previously, in Jetty7, I had this argument:
> --pre=$JETTY_BASE/conf/jetty-jmx.xml
>
> Now, in Jetty9, I still have this argument, and it comes before any other
> XML files in the invocation of Jetty. However, I notice that I get no
> remote JMX anything unless I have "--module=jmx-remote" in my start.ini
> (using an auxiliary start.ini, not modifying the jetty distribution's
> start.ini).
>
> However, when I enable the jmx-remote module, the jetty distribution's
> /etc/jetty-jmx-remote.xml is loaded.
>
> I don't want this. It doesn't have the correct path, and the path is not
> parameterized (/jmxrmi is used, but I want /jettyjmx). Additionally, I get
> an error at startup:
>
> ===========================
> INFO   | jvm 1    | 2015/02/13 13:27:36 | 2015-02-13
> 13:27:36.075:WARN:oejx.XmlConfiguration:WrapperJarAppMain: Config error at
> <Call name="start"/> java.lang.reflect.InvocationTargetException in
> file:/usr/local/deploy/jetty-9.2.5/etc/jetty-jmx-remote.xml
> INFO   | jvm 1    | 2015/02/13 13:27:36 | 2015-02-13
> 13:27:36.075:WARN:oejx.XmlConfiguration:WrapperJarAppMain: Config error at
> <New id="ConnectorServer"
> class="org.eclipse.jetty.jmx.ConnectorServer"><Arg>|      <New
> class="javax.management.remote.JMXServiceURL"><Arg
> type="java.lang.String">rmi</Arg><Arg type="java.lang.String"/><Arg
> type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport"
> default="1099"/></Arg><Arg
> type="java.lang.String">/jndi/rmi://<SystemProperty name="jetty.jmxrmihost"
> default="localhost"/>:<SystemProperty name="jetty.jmxrmiport"
> default="1099"/>/jmxrmi</Arg></New>|
> </Arg><Arg>org.eclipse.jetty.jmx:name=rmiconnectorserver</Arg><Call
> name="start"/></New> java.lang.reflect.InvocationTargetException in
> file:/usr/local/deploy/jetty-9.2.5/etc/jetty-jmx-remote.xml
> INFO   | jvm 1    | 2015/02/13 13:27:36 |
> java.lang.reflect.InvocationTargetException
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> java.lang.reflect.Method.invoke(Method.java:483)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.start.Main.start(Main.java:817)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.start.Main.main(Main.java:112)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> java.lang.reflect.Method.invoke(Method.java:483)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.tanukisoftware.wrapper.WrapperJarApp.run(WrapperJarApp.java:394)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> java.lang.Thread.run(Thread.java:745)
> INFO   | jvm 1    | 2015/02/13 13:27:36 | Caused by:
> java.lang.reflect.InvocationTargetException
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> java.lang.reflect.Method.invoke(Method.java:483)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.util.TypeUtil.call(TypeUtil.java:500)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:730)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:417)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:815)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:423)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1243)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> java.security.AccessController.doPrivileged(Native Method)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     ... 13 more
> INFO   | jvm 1    | 2015/02/13 13:27:36 | Caused by: java.io.IOException:
> Cannot bind to URL [rmi://10.28.120.226:4696/jmxrmi]:
> javax.naming.CommunicationException [Root exception is
> java.rmi.NoSuchObjectException: no such object in table]
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:827)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:432)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.jmx.ConnectorServer.doStart(ConnectorServer.java:109)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     ... 27 more
> INFO   | jvm 1    | 2015/02/13 13:27:36 | Caused by:
> javax.naming.CommunicationException [Root exception is
> java.rmi.NoSuchObjectException: no such object in table]
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:147)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:228)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> javax.naming.InitialContext.bind(InitialContext.java:425)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:644)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:427)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     ... 29 more
> INFO   | jvm 1    | 2015/02/13 13:27:36 | Caused by:
> java.rmi.NoSuchObjectException: no such object in table
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.rmi.server.UnicastRef.invoke(UnicastRef.java:379)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     at
> com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:141)
> INFO   | jvm 1    | 2015/02/13 13:27:36 |     ... 33 more
> ===========================
>
> The salient bit of that, *I believe*, is
>
> =========
> INFO   | jvm 1    | 2015/02/13 13:27:36 | Caused by: java.io.IOException:
> Cannot bind to URL [rmi://10.28.120.226:4696/jmxrmi]:
> javax.naming.CommunicationException [Root exception is
> java.rmi.NoSuchObjectException: no such object in table]
> =========
>
> "No such object in table."
>
> In my webapp's jetty-jmx.xml, which is a combination of the work done in
> the jetty-distribution's /etc/jetty-jmx.xml and /etc/jetty-jmx-remote.xml,
> I have a section to create an RMI registry:
>
> ===========================
>     <Call name="createRegistry" class="java.rmi.registry.LocateRegistry">
>         <Arg type="java.lang.Integer"><SystemProperty
> name="com.sun.management.jmxremote.port" /></Arg>
>         <Call name="sleep" class="java.lang.Thread">
>             <Arg type="java.lang.Integer">1000</Arg>
>         </Call>
>     </Call>
> ===========================
>
> It looks like this block doesn't have a counterpart in the jetty
> distribution's XML files. I suspect that jetty-jmx-remote.xml is failing
> with the "no such object in table" error either because the RMI registry
> hasn't been created yet, or because it's using the wrong url (I want a
> connecter at /jettyjmx, but the jetty distribution uses /jmxrmi).
>
> I cannot test this unless I can figure out a way to prevent
> /etc/jetty-jmx-remote.xml from being loaded during jetty startup... or at
> least get my own jetty-jmx.xml to load first.
>
> Here are my questions:
>
>    1. When are jetty distribution XML files in /etc/*.xml loaded,
>    relative to XML files specified on the command-line?
>    2. Is there a way to prevent /etc/jetty-jmx-remote.xml from being
>    loaded, while still keeping --module=jmx-remote in my start.jar?
>
> I can customize my own start.ini, my own start.d, and I can customize the
> command-line used to start Jetty but it would be much more difficult for me
> to have to modify files in the jetty distribution.
>
> I have attached my start.ini and my webapp's jetty-jmx.xml. My Jetty 9.2.5
> distribution is unmodified.
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to