[jboss-user] [Beginners Corner] - Re: JBoss API usage examples
danishkhan
do-not-reply at jboss.com
Thu Jul 17 14:17:27 EDT 2008
"PeterJ" wrote : public static void main(String[] args) throws Exception {
| | Context ctx = new InitialContext();
| | MBeanServerConnection mconn =(MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
| | ObjectName name = new ObjectName("jboss.jca:name=xxxDS,service=ManagedConnectionPool");
| | Object val=mconn.getAttribute(name,"InUseConnectionCount");
| | System.out.println(name+"\n\tInUseConnectionCount="+val);
| | }
Hi Peter,
upon running this code, I get the following exception..
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at JBossTest.main(JBossTest.java:12)
Any idea how to fix it?
-Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165149#4165149
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165149
More information about the jboss-user
mailing list