How to get a handle to tomcat Mbean Server?
Hi All, I was just learning 'bt Mbeans. To begin with, I was learning to use and test the Mbeans that are already existing in tomcat so I get to know how Mbeans work. I have written my own Agent called UserManager to call the Mbeans to list users (Tomcat Admin functionality : based on classes ApplicationServlet, UserUtils and ListUserServlet of tomcat source). I'm just not able to get a handle to the correct Mbean server. Can I get a handle to tomcat mbean server at all if I have to use it else where?? I'm getting the below exception. Kindly let me know how do I get a handle to the Mbean server from outside the Admin Application. I've used the same parameters as used by the Admin application classes. I'm using tomcat 5.0.25. Please tell me how to get a reference / handle to the Mbean server. Application DUMP is okey [EMAIL PROTECTED] log4j:WARN No appenders could be found for logger (org.apache.commons.modeler.Re gistry). log4j:WARN Please initialize the log4j system properly. listUsers : UserUtil.getUsersForm(mserver,databaseName); listUsers has Server === [EMAIL PROTECTED] listUsers has databaseName === Users:type=UserDatabase,database=UserDatabase In MBeanServer mserver = [EMAIL PROTECTED] The obj is Users:type=UserDatabase,database=UserDatabase javax.management.InstanceNotFoundException: MBeanServer cannot find MBean with O bjectName Users:type=UserDatabase,database=UserDatabase at mx4j.server.MBeanServerImpl.findMBeanMetaData(MBeanServerImpl.java:52 8) at mx4j.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:1235) at org.apache.webapp.admin.users.UserUtil.getUsersForm(UserUtil.java:106 ) at org.apache.webapp.admin.users.UserManager.listUsers(UserManager.java: 198) at org.apache.webapp.admin.users.Jyo.main(Jyo.java:26) List is Null Press any key to continue . . . Thanks, Jyothi -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get a handle to tomcat Mbean Server?
I don't know if this helps but this is a function I use to load the user database. After that, I use the different methods implemented in the org.apache.catalina.UserDatabase class. I found the functions and the parameters needed by searching the source for the function I wanted. I use this to dynamically add and search for users. I can also add roles and add roles to users. private void loadUserDatabase() { if(MBeanServerFactory.findMBeanServer(null).size() 0) { m_BeanServer = (MBeanServer) BeanServerFactory.findMBeanServer(null).get(0); } else { m_BeanServer = MBeanServerFactory.createMBeanServer(); } try { ObjectName obname = new ObjectName( userDB ); MBeanInfo info = m_BeanServer.getMBeanInfo( obname ); MBeanOperationInfo opInfo[] = info.getOperations(); MBeanAttributeInfo atribInfo[] = info.getAttributes(); for( int i = 0; i opInfo.length; i++ ) { log( loadUserDatabase, Operation: + opInfo[i].getName() + is defined ); } for( int i = 0; i atribInfo.length; i++ ) { log( loadUserDatabase, Attribute: + atribInfo[i].getName() + = + m_BeanServer.getAttribute( obname, atribInfo[i].getName() ) ); } } catch( Exception e ) { e.printStackTrace(); } } Robert S. Harper 801.265.8800 ex. 255 -Original Message- From: Honnavalli, Jyothi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 3:30 PM To: 'Tomcat Users List' Subject: How to get a handle to tomcat Mbean Server? Hi All, I was just learning 'bt Mbeans. To begin with, I was learning to use and test the Mbeans that are already existing in tomcat so I get to know how Mbeans work. I have written my own Agent called UserManager to call the [snip] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MBean Server Failure
I agree that the IllegalArgumentException would suggest that perhaps something has changed with parameters to a method. (I thought that, too.) But it's exactly the same JMX JAR that's running fine on two other machines. What explains that? --- Bill Barker [EMAIL PROTECTED] wrote: The machine that has problems has an older version of JMX installed somewhere. That's about all I can make out from the stack traces. Michael Duffy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I HATE it when I ask a question that nobody will touch! ;) I learned more about my MBean server failure. It's not working on my desktop, so I went to another machine and installed JDK 1.4.1 and Tomcat 4.1.24 LE clean. No MBean server failure, and the admin tool runs great. Conclusion: my desktop setup is the problem. I've been poring through my system parameters. I cleaned up my PATH. I don't have a CLASSPATH set for the system. I let every app set that for itself. So even if I have servlet.jar in several places, there's no way Tomcat would find a bad one, because its CLASSPATH would include those directories. I'm cleaning out old s'ware that might be doing it. I had an old J2EE 1.3 hanging around. I was hoping that getting rid of it would solve the dilemma, but no dice. The root cause in the log file is: Caused by: java.lang.IllegalArgumentException: Invalid descriptor passed in parameter Does anyone know how I can find what's being passed and see what the problem is? I don't know anything about JMX or MBeans. Is there any developer who's knowledgable enough about MBeans to be able to tell me what could be causing this? Thanks - MOD __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
MBean Server Failure
I HATE it when I ask a question that nobody will touch! ;) I learned more about my MBean server failure. It's not working on my desktop, so I went to another machine and installed JDK 1.4.1 and Tomcat 4.1.24 LE clean. No MBean server failure, and the admin tool runs great. Conclusion: my desktop setup is the problem. I've been poring through my system parameters. I cleaned up my PATH. I don't have a CLASSPATH set for the system. I let every app set that for itself. So even if I have servlet.jar in several places, there's no way Tomcat would find a bad one, because its CLASSPATH would include those directories. I'm cleaning out old s'ware that might be doing it. I had an old J2EE 1.3 hanging around. I was hoping that getting rid of it would solve the dilemma, but no dice. The root cause in the log file is: Caused by: java.lang.IllegalArgumentException: Invalid descriptor passed in parameter Does anyone know how I can find what's being passed and see what the problem is? I don't know anything about JMX or MBeans. Is there any developer who's knowledgable enough about MBeans to be able to tell me what could be causing this? Thanks - MOD __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MBean Server Failure
The machine that has problems has an older version of JMX installed somewhere. That's about all I can make out from the stack traces. Michael Duffy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I HATE it when I ask a question that nobody will touch! ;) I learned more about my MBean server failure. It's not working on my desktop, so I went to another machine and installed JDK 1.4.1 and Tomcat 4.1.24 LE clean. No MBean server failure, and the admin tool runs great. Conclusion: my desktop setup is the problem. I've been poring through my system parameters. I cleaned up my PATH. I don't have a CLASSPATH set for the system. I let every app set that for itself. So even if I have servlet.jar in several places, there's no way Tomcat would find a bad one, because its CLASSPATH would include those directories. I'm cleaning out old s'ware that might be doing it. I had an old J2EE 1.3 hanging around. I was hoping that getting rid of it would solve the dilemma, but no dice. The root cause in the log file is: Caused by: java.lang.IllegalArgumentException: Invalid descriptor passed in parameter Does anyone know how I can find what's being passed and see what the problem is? I don't know anything about JMX or MBeans. Is there any developer who's knowledgable enough about MBeans to be able to tell me what could be causing this? Thanks - MOD __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Admin Webapp Problems (WAS: MBean server?)
What is the MBean server? On Mon, 2002-12-02 at 21:01, Shawn Wilson wrote: Okay, this was just dumb on my part. When I installed Tomcat I installed the tomcat-noexamples and tomcat-admin RPM's. However, I noticed that installing Tomcat on a different machine (with examples), the first section in the server.xml file having to do with (believe it or not!) MBean server was not commented out like it was in the noexamples server.xml file. So basically that's all the problem was... if I had looked at server.xml more closely sooner I could have saved myself lots of frustration! Thanks for all the help, -shawn Jacob Kjome wrote: Hi Shawn, I'd recommend installing the full non-RPM version that includes all necessary jars. In that version, you will see the following files in common/endorsed: xercesImpl.jar xmlParserAPIs.jar What Bill says it correct, though. The Xerces version that come with Tomcat causes problems with Struts apps because of an XML parsing bug in Xerces which was recently fixed. You can either do as he says and go back to using 2.1.0 version or move to the latest jars which contain the fix: http://gump.covalent.net/jars/latest/xml-xerces2/ Otherwise, you could also check the xml commons to grab a xml-commons-api's jar that contains an earlier version of the xerces packages equivalent to the 2.1.0 release. http://xml.apache.org/commons/ Jake Tuesday, November 26, 2002, 10:05:27 AM, you wrote: SW Hi Bill, SW Thanks for the info. I checked, but there isn't any xerces jar in SW $CATALINA_HOME/common/endorsed... only jaxp_parser_impl.jar and SW xml-commons-apis.jar. This was just a basic RPM install of Tomcat along SW with the admin webapps. Also, the exception trace I posted _was_ from SW catalina.out, so that's as detailed as it gets. SW By the way, what is this MBean server it is looking for anyways? SW Thanks, SW -shawn SW Bill Barker wrote: I'm guessing that there is a more informative message in 'catalina.out', and that the problem is that 4.1.12 doesn't work with xerces-2.2.x (other than 'nightly'). Replace the xerces jars in $CATALINA_HOME/common/endorsed with the 2.1.0 version, and it should be fine. Shawn Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Admin Webapp Problems (WAS: MBean server?)
Okay, this was just dumb on my part. When I installed Tomcat I installed the tomcat-noexamples and tomcat-admin RPM's. However, I noticed that installing Tomcat on a different machine (with examples), the first section in the server.xml file having to do with (believe it or not!) MBean server was not commented out like it was in the noexamples server.xml file. So basically that's all the problem was... if I had looked at server.xml more closely sooner I could have saved myself lots of frustration! Thanks for all the help, -shawn Jacob Kjome wrote: Hi Shawn, I'd recommend installing the full non-RPM version that includes all necessary jars. In that version, you will see the following files in common/endorsed: xercesImpl.jar xmlParserAPIs.jar What Bill says it correct, though. The Xerces version that come with Tomcat causes problems with Struts apps because of an XML parsing bug in Xerces which was recently fixed. You can either do as he says and go back to using 2.1.0 version or move to the latest jars which contain the fix: http://gump.covalent.net/jars/latest/xml-xerces2/ Otherwise, you could also check the xml commons to grab a xml-commons-api's jar that contains an earlier version of the xerces packages equivalent to the 2.1.0 release. http://xml.apache.org/commons/ Jake Tuesday, November 26, 2002, 10:05:27 AM, you wrote: SW Hi Bill, SW Thanks for the info. I checked, but there isn't any xerces jar in SW $CATALINA_HOME/common/endorsed... only jaxp_parser_impl.jar and SW xml-commons-apis.jar. This was just a basic RPM install of Tomcat along SW with the admin webapps. Also, the exception trace I posted _was_ from SW catalina.out, so that's as detailed as it gets. SW By the way, what is this MBean server it is looking for anyways? SW Thanks, SW -shawn SW Bill Barker wrote: I'm guessing that there is a more informative message in 'catalina.out', and that the problem is that 4.1.12 doesn't work with xerces-2.2.x (other than 'nightly'). Replace the xerces jars in $CATALINA_HOME/common/endorsed with the 2.1.0 version, and it should be fine. Shawn Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re[2]: Admin Webapp Problems (WAS: MBean server?)
Hi Shawn, I'd recommend installing the full non-RPM version that includes all necessary jars. In that version, you will see the following files in common/endorsed: xercesImpl.jar xmlParserAPIs.jar What Bill says it correct, though. The Xerces version that come with Tomcat causes problems with Struts apps because of an XML parsing bug in Xerces which was recently fixed. You can either do as he says and go back to using 2.1.0 version or move to the latest jars which contain the fix: http://gump.covalent.net/jars/latest/xml-xerces2/ Otherwise, you could also check the xml commons to grab a xml-commons-api's jar that contains an earlier version of the xerces packages equivalent to the 2.1.0 release. http://xml.apache.org/commons/ Jake Tuesday, November 26, 2002, 10:05:27 AM, you wrote: SW Hi Bill, SW Thanks for the info. I checked, but there isn't any xerces jar in SW $CATALINA_HOME/common/endorsed... only jaxp_parser_impl.jar and SW xml-commons-apis.jar. This was just a basic RPM install of Tomcat along SW with the admin webapps. Also, the exception trace I posted _was_ from SW catalina.out, so that's as detailed as it gets. SW By the way, what is this MBean server it is looking for anyways? SW Thanks, SW -shawn SW Bill Barker wrote: I'm guessing that there is a more informative message in 'catalina.out', and that the problem is that 4.1.12 doesn't work with xerces-2.2.x (other than 'nightly'). Replace the xerces jars in $CATALINA_HOME/common/endorsed with the 2.1.0 version, and it should be fine. Shawn Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Best regards, Jacobmailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
MBean server?
I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: MBean server?
I'm guessing that there is a more informative message in 'catalina.out', and that the problem is that 4.1.12 doesn't work with xerces-2.2.x (other than 'nightly'). Replace the xerces jars in $CATALINA_HOME/common/endorsed with the 2.1.0 version, and it should be fine. Shawn Wilson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following packages installed on a RedHat 7.3 box: tomcat4-4.1.12-full.2jpp tomcat4-admin-webapps-4.1.12-full.2jpp Tomcat starts up fine and I can log into the admin app without problem. However, the moment I try to do anything in the admin app I get a HTTP Status 503 - Servlet action is currently unavailable error, and I see this in my catalina.out log file: javax.servlet.UnavailableException: MBeanServer is not available at org.apache.webapp.admin.ApplicationServlet.initServer(Unknown Source) at org.apache.webapp.admin.ApplicationServlet.getServer(Unknown Source) at org.apache.webapp.admin.TomcatTreeBuilder.buildTree(Unknown Source) at org.apache.webapp.admin.SetUpTreeAction.perform(Unknown Source) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va) at org.apache.struts.action.ActionServlet.process(ActionServlet.java) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) ... ... What does this exception mean, and what do I need to do to get the admin app running? Thanks, -shawn -- Shawn Wilson [[EMAIL PROTECTED]] Software Developer, ATMReports.com PH: 877-327-0873, FAX: 406-294-5806 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]