I answer to my questions...

try {
  ObjectName JNDIRealm = new
ObjectName("Catalina:type=Realm,path=/DJLRWebapp,host=localhost");
     List list = MBeanServerFactory.findMBeanServer(null);
     MBeanServer server = (MBeanServer) list.iterator().next();
     System.out.println(server.getAttribute(JNDIRealm,"connectionName"));
     System.out.println(server.getAttribute(JNDIRealm,"connectionURL"));

System.out.println(server.getAttribute(JNDIRealm,"connectionPassword"));
     System.out.println(server.getAttribute(JNDIRealm,"contextFactory"));
     System.out.println(server.getAttribute(JNDIRealm,"digest"));
     System.out.println(server.getAttribute(JNDIRealm,"userBase"));
  }
     catch(Exception e){
      System.out.println(e);
     }


----- Original Message ----- 
From: "jean charles jabouille" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[email protected]>
Sent: Wednesday, March 16, 2005 10:03 AM
Subject: Re: JNDIrealm Mbean


> I modify my function, and I verify that the Mbean exists. But how can I
get
> the value of my Mbean attributes ?
>
> here is my code:
>
> try {
>
>   ObjectName timer = new
> ObjectName("Catalina:type=Realm,path=/DJLRWebapp,host=localhost");
>      List list = MBeanServerFactory.findMBeanServer(null);
>      MBeanServer server = (MBeanServer) list.iterator().next();
>      //String type=nodeName + ":" + projectName+":"+date;
>      System.out.println(server.isRegistered(timer));
>      int i=0;
>      while(i<5){   //listing of the 5th attributes
>
>
System.out.println(server.getMBeanInfo(timer).getAttributes()[i].getName());
>         i++;
>      }
>   }
>      catch(Exception e){
>
>      }
>
>
> Thanks for answers
>
> Jabouille Jean Charles
>
>
>
> ----- Original Message ----- 
> From: "jean charles jabouille" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Friday, March 11, 2005 10:48 AM
> Subject: JNDIrealm Mbean
>
>
> Hi,
>
>
> I use Tomcat 5.5 and I created a JNDIRealm in the server.xml file. I
d'like
> to accede to the JNDIMean mbean but I can't find informations about source
> code exemple. I saw this page that contains all Tomcat Mbean
>
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/funcspecs/mbean-names.html
>
> Is there a mbean-descriptor.xml to add to my application ? I do think
> because I think that Tomcat Mbean are loaded automatically.
>
> Here is an exemple of my tentative to access to the Tomcat JNDIRealm mbean
> and to access to the connectionUrl of my realm. This code is not working
:-(
>
> try {
>
>   ObjectName timer = new
>
ObjectName("Catalina:type=org.apache.catalina.realm.JNDIRealm,name=JNDIRealm
> ");
>      List list = MBeanServerFactory.findMBeanServer(null);
>      MBeanServer server = (MBeanServer) list.iterator().next();
>
> String connectionUrl;
> connectionUrl=(String)server.invoke(timer,"connectionURL",new Object[]
>   },new String[] { "".getClass().getName()});
>   }
>      catch(Exception e){
>
>      }
>
>
> Do you have an code exemple or a solution ?
>
> Thanks for your answers,
>
> Jabouille Jean Charles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to