Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

getting an InitialContext from a pure Java client

boris_fierlings
Discoverer
0 Kudos

Hi All,

we have a NW CE 7.1 SP3 installation and I'm trying to get an InitialContext from a pure Java Client.


    public static void main(String[] args)
    {
        Hashtable env = new Hashtable();
        env.put(
            Context.INITIAL_CONTEXT_FACTORY,
            "com.sap.engine.services.jndi.InitialContextFactoryImpl");
        env.put(Context.PROVIDER_URL, "ttx1345:50004");
        env.put(Context.SECURITY_PRINCIPAL, "Administrator");
        env.put(Context.SECURITY_CREDENTIALS, "*****");
        Context context = null;
        try
        {
            context = new InitialContext(env);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            if (context != null)
            {
                try
                {
                    context.close();
                }
                catch (NamingException e1)
                {
                    e1.printStackTrace();
                }
            }
        }
    }

This works fine for the Netweaver 2004 J2EE Engine, but now I get the following error: com.sap.engine.services.jndi.persistent.exceptions.SecurityException: Cannot get InitialContext, operation is not allowed.

The User has the jndi_get_initial_context Action assigned in UME. Logon with WEB Application is no problem and works fine for this User.

In Netweaver 2004 the component service.naming has an security role jndi_get_initial_context assigned. It was configured within the Visual Administrator security provider->Components->Security Roles.

In the WEB based SAP NetWeaver Administrator I only found the component service.naming under the topic Authentication. But here you can only configure the Login Module Stack.

In Netweaver 2004 this was done in Visual Administrator security provider->component->Authentication.

So, does anyone know how/where to configure security roles for the component service.naming?

Boris

Edited by: Boris Fierlings on Jul 10, 2008 4:14 PM

3 REPLIES 3

boris_fierlings
Discoverer
0 Kudos

found the solution myself

0 Kudos

Hi,

Could you please share how did you find the solution and please let us know the specific scenario.

Thanks.

Srihari

Former Member
0 Kudos

Boris,

Can you kindly share the solution?

Others may have the same problem.

Regards,

Ballock.