Re: When has the server started?
On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. Hi, This is a very old thread; however as I am now browsing the JMX tree via jconsole, the strange null element is due to the fact that the J2EEApplication attribute has the value null for all the GBeans which are not part of a J2EEApplication, i.e. an EAR. Thanks, Gianny
Re: When has the server started?
Hi All, I have submitted a JIRA and patch to provide this GBean. http://issues.apache.org/jira/browse/GERONIMO-2385 feedback as always welcome... TTFN, -bd- On Sep 4, 2006, at 3:06 PM, David Jencks wrote: On Sep 4, 2006, at 4:54 PM, Jason Dillon wrote: On Sep 4, 2006, at 1:39 PM, David Jencks wrote: IMO this would be a perversion of the geronimo architecture. What does fully started mean anyway? If you start with say geronimo-jetty-minimal and add cars to turn it into a full j2ee server while it is running, when exactly is it started? It certainly has nothing to do with the kernel. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. ya- that's a bug :-( Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. That's a great idea! Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... yup thanks david jencks --jason
Re: When has the server started?
On Sep 7, 2006, at 9:44 AM, Bill Dudney wrote: Hi Jason, I had some time to dig into this a bit and it looks to me like anything that does not belong to a particular J2EE app ends up here. i.e. MBean Name == geronimo:J2EEApplication=null,J2EEServer-geronimo,... is common to all. Looks to me like the deployables in the config that don't have a J2EEApplication specified get null and thus the weird null entry. Changing that to something else would probably be tedious... IIRC J2EEApplication=null is specified and required by jsr-77 for stuff from J2EE apps that aren't in an ear (standalone app clients, web apps, connectors, ejbs). If it's in an ear, J2EEApplication=ear-name in some form thanks david jencks TTFN, -bd- On Sep 3, 2006, at 6:54 AM, Jason Dillon wrote: Somewhat related... I mentioned this before, but jconsole shows a weird null element in the tree... any idea why? --jason jconsole.tiff On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
Jason Dillon wrote: On Sep 4, 2006, at 1:39 PM, David Jencks wrote: IMO this would be a perversion of the geronimo architecture. What does fully started mean anyway? If you start with say geronimo-jetty-minimal and add cars to turn it into a full j2ee server while it is running, when exactly is it started? It certainly has nothing to do with the kernel. Not to get too pedantic but what if some of the configurations in the persistent configuration couldn't be started for some reason, is the server still fully started? Perhaps something more like initialBootstrapCompleted might be more intuitive. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... --jason
Re: When has the server started?
On 9/5/06, Matt Hogstrom [EMAIL PROTECTED] wrote: Not to get too pedantic but what if some of the configurations in the persistent configuration couldn't be started for some reason, is the server still fully started? Currently if that happens, the server shuts down. That's another issue we might want to revisit. Thanks, Aaron Perhaps something more like initialBootstrapCompleted might be more intuitive. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... --jason
Re: When has the server started?
I'm not sure that happens in every instance. I seem to remember that an Application (Daytrader) that failed to start and the server still initialized. I'll need to confirm this. Aaron Mulder wrote: On 9/5/06, Matt Hogstrom [EMAIL PROTECTED] wrote: Not to get too pedantic but what if some of the configurations in the persistent configuration couldn't be started for some reason, is the server still fully started? Currently if that happens, the server shuts down. That's another issue we might want to revisit. Thanks, Aaron Perhaps something more like initialBootstrapCompleted might be more intuitive. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... --jason
Re: When has the server started?
On Sep 3, 2006, at 7:53 PM, Jason Dillon wrote: Okay, I was able to get something working... though I had to use classes from geronimo-kernel... not sure how to perform the same operations with just JMX interfaces. If anyone knows, please speak up... it would be nice to not need to use kernel classes to check a few boolean attributes on remote beans. I still think we might want to expose fullyStarted on the kernel directly, and configure it so that its exposed as a MBean attribute, so that AbstractName and AbstractNameQuery are not needed. IMO this would be a perversion of the geronimo architecture. What does fully started mean anyway? If you start with say geronimo- jetty-minimal and add cars to turn it into a full j2ee server while it is running, when exactly is it started? It certainly has nothing to do with the kernel. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. There used to be something to detect and wait for this in the m1 geronimo deployment plugin thanks david jencks * * * Anyways, what I have now works well... and now geronimo:start can tell when the minimal servers are started :-) Thanks for the hint about PersistentConfigurationList. --jason On Sep 3, 2006, at 6:00 AM, Aaron Mulder wrote: I think if you get the AbstractName for the LocalAttributeManager in a test program, there's a method on the AbstractName to get or generate an ObjectName, and then you could use that ObjectName to access the LocalAttributeManager (and therefore the kernelFullyStarted attribute) via JMX. I'm not sure that will work, but it's where I would start. If that doesn't work, you could try invoking the getAttribute(abstractName, attributeName) operation on the Kernel via JMX (so you'd access the Kernel via JMX, but call an operation on it to access the LocalAttributeManager). FWIW, I think Daemon just loops over a Set to be fully generic -- I'm pretty sure that in practice, the LocalAttributeManager is the one and only PersistentConfigurationList in the server. Thanks, Aaron On 9/3/06, Jason Dillon [EMAIL PROTECTED] wrote: Any idea how to actually do that? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
On Sep 4, 2006, at 1:39 PM, David Jencks wrote: IMO this would be a perversion of the geronimo architecture. What does fully started mean anyway? If you start with say geronimo- jetty-minimal and add cars to turn it into a full j2ee server while it is running, when exactly is it started? It certainly has nothing to do with the kernel. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... --jason
Re: When has the server started?
On Sep 4, 2006, at 4:54 PM, Jason Dillon wrote: On Sep 4, 2006, at 1:39 PM, David Jencks wrote: IMO this would be a perversion of the geronimo architecture. What does fully started mean anyway? If you start with say geronimo- jetty-minimal and add cars to turn it into a full j2ee server while it is running, when exactly is it started? It certainly has nothing to do with the kernel. When we thought about this last the best idea we could come up with is that it's fully started when all the modules listed in persistent configuration lists (should be persistent module lists) that are in the bootstrap or included recursively in those modules are started. Think about what happens if a module in the original PCL includes another PCL. Started (or fully started) means that the server has loaded, initialized and started all modules in the persistent configuration, such that it could then start to serve applications... and start listening on ports, etc. True there might be more modules to be loaded or configured after that, but the point is to tell when the server is ready to start accepting work. There is a period while the server is starting, when it starts listening to http, but it is not ready to serve applications which have been configured to be deployed. ya- that's a bug :-( Anyways, I don't care too much what it is called... but I think that flag should be exposed as a simple Boolean on some common MBean. That's a great idea! Maybe its not the Kernel, as the kernel might be started, but the system might not be ready to serve my webapps or whatever. Having to pull in geronimo-kernel to perform a simple remote call to fetch a boolean is overkill... especially since that module has magical logging fluff that rudely overwrites configuration. If we had a specialized MBean/GBean that just exposed the very common remote functionality via JMX directly then we would be in a very good position to keep tools (IDE plugins, maven plugins, etc) working even after we change the internals around. Such tools need an easy way to: * Detect when the server is started and ready to server applications * Shutdown Probably some other things too... yup thanks david jencks --jason
Re: When has the server started?
I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
Any idea how to actually do that? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
I found some bits in Daemon that I can use... though it iterates over all of the configs from a query... is there on bean that can be used to query the state? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
I think if you get the AbstractName for the LocalAttributeManager in a test program, there's a method on the AbstractName to get or generate an ObjectName, and then you could use that ObjectName to access the LocalAttributeManager (and therefore the kernelFullyStarted attribute) via JMX. I'm not sure that will work, but it's where I would start. If that doesn't work, you could try invoking the getAttribute(abstractName, attributeName) operation on the Kernel via JMX (so you'd access the Kernel via JMX, but call an operation on it to access the LocalAttributeManager). FWIW, I think Daemon just loops over a Set to be fully generic -- I'm pretty sure that in practice, the LocalAttributeManager is the one and only PersistentConfigurationList in the server. Thanks, Aaron On 9/3/06, Jason Dillon [EMAIL PROTECTED] wrote: Any idea how to actually do that? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
Okay, I will try that after I get some sleep. Its just a bit confusing since I don't see any attribute on any mbean that looks anything like kernelFullyStarted from jconsole. Thanks :-) --jason On Sep 3, 2006, at 6:00 AM, Aaron Mulder wrote: I think if you get the AbstractName for the LocalAttributeManager in a test program, there's a method on the AbstractName to get or generate an ObjectName, and then you could use that ObjectName to access the LocalAttributeManager (and therefore the kernelFullyStarted attribute) via JMX. I'm not sure that will work, but it's where I would start. If that doesn't work, you could try invoking the getAttribute(abstractName, attributeName) operation on the Kernel via JMX (so you'd access the Kernel via JMX, but call an operation on it to access the LocalAttributeManager). FWIW, I think Daemon just loops over a Set to be fully generic -- I'm pretty sure that in practice, the LocalAttributeManager is the one and only PersistentConfigurationList in the server. Thanks, Aaron On 9/3/06, Jason Dillon [EMAIL PROTECTED] wrote: Any idea how to actually do that? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
Okay, I was able to get something working... though I had to use classes from geronimo-kernel... not sure how to perform the same operations with just JMX interfaces. If anyone knows, please speak up... it would be nice to not need to use kernel classes to check a few boolean attributes on remote beans. I still think we might want to expose fullyStarted on the kernel directly, and configure it so that its exposed as a MBean attribute, so that AbstractName and AbstractNameQuery are not needed. * * * Anyways, what I have now works well... and now geronimo:start can tell when the minimal servers are started :-) Thanks for the hint about PersistentConfigurationList. --jason On Sep 3, 2006, at 6:00 AM, Aaron Mulder wrote: I think if you get the AbstractName for the LocalAttributeManager in a test program, there's a method on the AbstractName to get or generate an ObjectName, and then you could use that ObjectName to access the LocalAttributeManager (and therefore the kernelFullyStarted attribute) via JMX. I'm not sure that will work, but it's where I would start. If that doesn't work, you could try invoking the getAttribute(abstractName, attributeName) operation on the Kernel via JMX (so you'd access the Kernel via JMX, but call an operation on it to access the LocalAttributeManager). FWIW, I think Daemon just loops over a Set to be fully generic -- I'm pretty sure that in practice, the LocalAttributeManager is the one and only PersistentConfigurationList in the server. Thanks, Aaron On 9/3/06, Jason Dillon [EMAIL PROTECTED] wrote: Any idea how to actually do that? --jason On Sep 3, 2006, at 5:34 AM, Aaron Mulder wrote: I think kernelFullyStarted is a GBean attribute on only certain types of GBeans -- I believe PersistentConfigurationList GBeans. It's set by Daemon.java when the startup process is complete, so it's not a kernel-level feature, but should still work for all practical purposes. I would think you'd be able to get the property from the LocalAttributeManager via JMX. Thanks, Aaron On 9/1/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason
Re: When has the server started?
Hi Jason,I was interested too, in finding out this piece of information from my server... In Geronimo 1.0, the code below 'ServerWhenStart.java' works. It basically gets hold of the Kernel, then gets a KernelManagementHelper object, and then queries for the JVM, to find out its boot time (I am assuming that JVM start time is close to what you are looking for). However, in Geronimo 1.1, this fails. I am able to get the KernelManagementHelper object, and also able to look up the domains. But I cannot get the servers from the first domain.In jconsole, I wish that the VM tab was active. The VM tab gives info about the uptime of VM (I have seen that when I ran jconsole to see JMX info for other software). Then, we could have done currentTime-upTime to get the boot time. If you are successful in getting server configuration information from JMX, please let me know how you did that. Thanks!-Deepu.- ServerWhenStart.java -import java.util.Date ;import javax.management.MBeanServerConnection;import javax.management.remote.JMXConnector;import javax.management.remote.JMXConnectorFactory;import javax.management.remote.JMXServiceURL;import org.apache.geronimo.console.util.KernelManagementHelper;import org.apache.geronimo.kernel.Kernel;import org.apache.geronimo.kernel.jmx.KernelDelegate;import org.apache.geronimo.management.J2EEDomain;import org.apache.geronimo.management.geronimo.J2EEServer;import org.apache.geronimo.management.geronimo.JVM;public class ServerWhenStart { /** * @param args */ public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub java.util.Map environment = new java.util.HashMap(); String[] credentials = new String[]{system, manager}; environment.put(JMXConnector.CREDENTIALS, credentials); JMXServiceURL address = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector); JMXConnector jmxConnector = JMXConnectorFactory.connect (address, environment); MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection(); Kernel kernel = new KernelDelegate(mbServerConnection); KernelManagementHelper mgr = new KernelManagementHelper(kernel); J2EEDomain domain = mgr.getDomains()[0]; //This is where it fails J2EEServer[] server = mgr.getServers(domain)[0]; JVM[] jvms = mgr.getJavaVMs(server); //I am thinking that the first VM is what we are interested in... (is that right??) JVM jvm = jvms[0]; Date bootTime = jvm.getKernelBootTime(); System.out.println(bootTime); }}On 9/2/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX?The ServerBehavior class in the deployment plugin has some code thatconnects to JMX, then lists the configurations, and then takes hefirst configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations()returns an array of ObjectNames, which it does not.I also peeked at the server's JMX tree via jconsole and I don't seeany attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leavethat for another day.So, how can I easily check of the server has started by polling a JMXattribute?--jason ServerWhenStart.java Description: Binary data
Re: When has the server started?
I did not find the KernelDelegate in 1.1 that useful compared to the one in 1.0. KernelDelegate code may not have changed from 1.0 to 1.1. For whatever reasons, the code to retrieve server, domain and other info that used to execute fine in 1.0 did not run properly inspite of changing it to account for changes like AbstractNameQuery in place of GBeanQuery etc. VamsiOn 9/3/06, Deepak Srinivasa [EMAIL PROTECTED] wrote: Hi Jason,I was interested too, in finding out this piece of information from my server... In Geronimo 1.0, the code below 'ServerWhenStart.java' works. It basically gets hold of the Kernel, then gets a KernelManagementHelper object, and then queries for the JVM, to find out its boot time (I am assuming that JVM start time is close to what you are looking for). However, in Geronimo 1.1, this fails. I am able to get the KernelManagementHelper object, and also able to look up the domains. But I cannot get the servers from the first domain.In jconsole, I wish that the VM tab was active. The VM tab gives info about the uptime of VM (I have seen that when I ran jconsole to see JMX info for other software). Then, we could have done currentTime-upTime to get the boot time. If you are successful in getting server configuration information from JMX, please let me know how you did that. Thanks!-Deepu.- ServerWhenStart.java -import java.util.Date ;import javax.management.MBeanServerConnection;import javax.management.remote.JMXConnector;import javax.management.remote.JMXConnectorFactory;import javax.management.remote.JMXServiceURL;import org.apache.geronimo.console.util.KernelManagementHelper;import org.apache.geronimo.kernel.Kernel;import org.apache.geronimo.kernel.jmx.KernelDelegate;import org.apache.geronimo.management.J2EEDomain;import org.apache.geronimo.management.geronimo.J2EEServer;import org.apache.geronimo.management.geronimo.JVM;public class ServerWhenStart { /** * @param args */ public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub java.util.Map environment = new java.util.HashMap(); String[] credentials = new String[]{system, manager}; environment.put(JMXConnector.CREDENTIALS, credentials); JMXServiceURL address = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector); JMXConnector jmxConnector = JMXConnectorFactory.connect (address, environment); MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection(); Kernel kernel = new KernelDelegate(mbServerConnection); KernelManagementHelper mgr = new KernelManagementHelper(kernel); J2EEDomain domain = mgr.getDomains()[0]; //This is where it fails J2EEServer[] server = mgr.getServers(domain)[0]; JVM[] jvms = mgr.getJavaVMs(server); //I am thinking that the first VM is what we are interested in... (is that right??) JVM jvm = jvms[0]; Date bootTime = jvm.getKernelBootTime(); System.out.println(bootTime); }}On 9/2/06, Jason Dillon [EMAIL PROTECTED] wrote: What is the best way to detect when the server has started using JMX?The ServerBehavior class in the deployment plugin has some code thatconnects to JMX, then lists the configurations, and then takes hefirst configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations()returns an array of ObjectNames, which it does not.I also peeked at the server's JMX tree via jconsole and I don't seeany attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leavethat for another day.So, how can I easily check of the server has started by polling a JMXattribute?--jason
When has the server started?
What is the best way to detect when the server has started using JMX? The ServerBehavior class in the deployment plugin has some code that connects to JMX, then lists the configurations, and then takes he first configuration and get the kernelFulltStarted attribute from it... but it assumes that ConfigurationManager.listConfigurations() returns an array of ObjectNames, which it does not. I also peeked at the server's JMX tree via jconsole and I don't see any attribute or operation that matches up to kernelFullyStarted. There is also a strange null element of the tree, but I will leave that for another day. So, how can I easily check of the server has started by polling a JMX attribute? --jason