Skip to Content
0
Jul 10, 2008 at 02:13 PM

getting an InitialContext from a pure Java client

20 Views

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