aspose file tools*
The moose likes Tomcat and the fly likes Why ServerLifecycleListener is commented out in Tomcat 7's server.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Why ServerLifecycleListener is commented out in Tomcat 7 Watch "Why ServerLifecycleListener is commented out in Tomcat 7 New topic
Author

Why ServerLifecycleListener is commented out in Tomcat 7's server.xml?

Sharmistha Sarkar
Ranch Hand

Joined: Dec 18, 2012
Posts: 44
In Tomcat 6 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> tag is present but not in Tomcat 7.
I have seen in Changelog of Tomcat 7 and found that; it has removed in Tomcat 7 but I want to know the reason why it has removed and how it's functionality is working after removing?


Use of ServerLifeCycleListener in Tomcat 6:

The Server Lifecycle Listener initializes the MBeanServer for the MBeans that may be used to manager Tomcat via JMX. Without this listener, none of the Tomcat MBeans will be available.

This listener must only be nested within Server elements.

No additional attributes are supported by the Server Lifecycle Listener.

How can Tomcat 7 support the above if they remove it...?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Maybe Tomcat 7 doesn't have that functionality; do you have any indications to believe that it does?
Sharmistha Sarkar
Ranch Hand

Joined: Dec 18, 2012
Posts: 44
I think It does. I checked with jConsole. mBean is used via jConsole. I have checked an application with Tomcat 6 and Java 6 ;and it's performance with jConsole with the PID. Then the same application I checked with tomcat 7 and java 7 with new PID created and it also opening mBean in jConsole just like before. But confused, because jConsole is a behavior of JDK. It is inside jdk's bin folder. How can I prove Tomcat 7 supports mBean with jConsole? I don't know whether the jConsole experiment is correct or not..............
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Tomcat has supported JMX for a long time, and still does. It's possible that the internal implementation has changed; but why would you care if it has?
Sharmistha Sarkar
Ranch Hand

Joined: Dec 18, 2012
Posts: 44
Ok , the reason is; I am migrating an application to Tomcat 7 with Java 7 which is running fine in Tomcat 6 with Java 6. Suspect this migration may cause any issue since ServerLifeCycleListener has removed, so is there all functionality work same in Tomcat 7 just like Tomcat 6 or later I may get exception or miss anything? So I am trying to prove that even after removing ServerLifeCycleListener in Tomcat 7 will not effect the application. Can you give me some idea how to prove this? There must have some reason to remove ServerLifeCycleListener in Tomcat 7 .
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Ulf Dittmer wrote:Tomcat has supported JMX for a long time, and still does.

Why don't you just hook up JConsole or VisualVM to Tomcat and check for yourself if all the MBeans you're expecting are still there?
Sharmistha Sarkar
Ranch Hand

Joined: Dec 18, 2012
Posts: 44
I don't know how to see tomcat 6 mbean in jconsole. These days I was connecting jconsole with java PID.

Now the steps i did to connect jconsole,
1. run tomcat 6
2. in jconsole I choose "Remote Process" radio button and typed service:jmx:rmi:///jndi/rmi://localhost:7466
3 I left username and password textbox empty.

i am getting an exception and unable to connect jconsole. I doubt in the service:jmx uri.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Hm, not sure what JConsole needs. I prefer VisualVM - it detects local JVM processes that are JMX enabled automatically :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why ServerLifecycleListener is commented out in Tomcat 7's server.xml?