Skip to Content
author's profile photo Former Member
Former Member

initCtx.lookup("jmx") throws strange Exception


I am trying to get handle of an MBeanServer from the JVM like described

in the Netweaver help (in reality there is still a try .. catch clause to be added):

import javax.naming.InitialContext;



// Lookup MBeanServer from the JNDI

InitialContext initCtx = new InitialContext();

MBeanServer mbs = (MBeanServer) initCtx.lookup("jmx");

But if I do that I alway get this Exception you can see below. So now I wonder do I have a problem with the configuration of my server or is the documentation of SAP wrong? Has somebody else tried something like this.

Thanks for any hints!!


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(

at javax.naming.InitialContext.getDefaultInitCtx(

at javax.naming.InitialContext.getURLOrDefaultInitCtx(

at javax.naming.InitialContext.lookup(

at M.init(

at M.main(

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 09, 2004 at 07:43 AM

    Hi Nils,

    did you specify the InitialContext factory to be used? Because that's missing in the code snippet.

    You should use something like

    Properties env = new Properties();

    env.put(Context.INITIAL_CONTEXT_FACTORY, "");


    for more information about creating InitialContext see the documentation at

    Hope that helps.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ivaylo!

      Thanks for the advice, but the thing is running on the server side and the document you refered me to says the following:

      Clients that are running on the server side do not need to specify any properties. They simply use the InitialContext constructor without parameters:

      Context ctx = new InitialContext();

      And I suppose the "Properties env" is supposed to get in "InitialContext(env);", but since I won't use this call at all ...

      Hm, it is a pity, since sometimes it would really easier not to do it remotely. Any other ideas?

      Thanks in advance,


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.