You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by recursion <ba...@yahoo.com> on 2009/06/15 13:47:10 UTC

Am i using the OpenEJB JMX provider correctly ?

Hi all,

In similarity with what i know from looking up the management bean over
other application servers, over OpenEJB 3.1.1 i ran the following code :

Properties props = new Properties();
		props.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
		props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");		
		InitialContext ctx = new InitialContext(props);
		Object ref = ctx.lookup("MEJB");
		ManagementHome mHome = (ManagementHome)
PortableRemoteObject.narrow(ref,ManagementHome.class);
		Management mejb = mHome.create();
		
		StringBuilder queryBuilder = new StringBuilder(100);		
		queryBuilder.append("*" + ":").append("j2eeType=").append(
"J2EEApplication");
		String query = queryBuilder.toString();
		
		Set<?> result = mejb.queryNames(new ObjectName(query), null);
                System.out.println(result.size());

Unfortunately, having in mind that i have deployed 2 applications (ejb
modules), i always get 0 from the snippet above! I tried with
"j2eeType=EJBModule", with the same result.

What am i doing wrong in order to query the MBean provider ?


recursion.

-- 
View this message in context: http://www.nabble.com/Am-i-using-the-OpenEJB-JMX-provider-correctly---tp24033204p24033204.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Am i using the OpenEJB JMX provider correctly ?

Posted by recursion <ba...@yahoo.com>.
Hi David,

It would be really great to see a classical JMX support in OpenEJB.
As far as my needs are concerned, i am just experimenting with OpenEJB, and
i thought that it would be nice to write a small EJB application, that looks
up JMX and reports information about existing deployed EJBs on the server.
This is what i thought JMX could be useful for.



recursion.
-- 
View this message in context: http://www.nabble.com/Am-i-using-the-OpenEJB-JMX-provider-correctly---tp24033204p24048219.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Am i using the OpenEJB JMX provider correctly ?

Posted by David Blevins <da...@visi.com>.
On Jun 15, 2009, at 4:47 AM, recursion wrote:

>
> Hi all,
>
> In similarity with what i know from looking up the management bean  
> over
> other application servers, over OpenEJB 3.1.1 i ran the following  
> code :
>
> Properties props = new Properties();
> 		props.put("java.naming.factory.initial",
> "org.apache.openejb.client.RemoteInitialContextFactory");
> 		props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");		
> 		InitialContext ctx = new InitialContext(props);
> 		Object ref = ctx.lookup("MEJB");
> 		ManagementHome mHome = (ManagementHome)
> PortableRemoteObject.narrow(ref,ManagementHome.class);
> 		Management mejb = mHome.create();
> 		
> 		StringBuilder queryBuilder = new StringBuilder(100);		
> 		queryBuilder.append("*" + ":").append("j2eeType=").append(
> "J2EEApplication");
> 		String query = queryBuilder.toString();
> 		
> 		Set<?> result = mejb.queryNames(new ObjectName(query), null);
>                System.out.println(result.size());
>
> Unfortunately, having in mind that i have deployed 2 applications (ejb
> modules), i always get 0 from the snippet above! I tried with
> "j2eeType=EJBModule", with the same result.
>
> What am i doing wrong in order to query the MBean provider ?

We don't support JSR-77, though Geronimo does which uses OpenEJB.   
More general JMX support with statistics is high on the todo list,  
though, and is something a few of us have noted as critical.  We can  
definitely add something in this regard for the next release.  Some  
questions for you:

Do you have a specific need for the JSR-77 layout and object model?   
What statistics are most important to you?  Any other details on what  
your needs are in relation to jmx are great.


-David